Skip to content

Instantly share code, notes, and snippets.

View csaborio001's full-sized avatar

Christian Saborio csaborio001

View GitHub Profile
$current_user = wp_get_current_user();
$current_user_roles = $current_user->roles;
if ( in_array( 'administrator', $current_user_roles, true ) ) {
// Show the Review.
}
public static function external_user_redirect( $redirect_to, $requested_redirect_to, $user ) {
// Is there a user registered to check? Otherwise simply redirect.
if ( isset( $user->roles ) && is_array( $user->roles ) ) {
// Does this user belong to the internal group?
if ( UserManagement::is_user_internal( $user ) ) {
// This will redirect them to WP-Admin.
return $redirect_to;
} elseif ( ! empty( $requested_redirect_to ) ) {
// External User with redirect.
return $requested_redirect_to;
SELECT
*
FROM
wp_posts
INNER JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id
LEFT JOIN (
SELECT
wp_posts.ID
FROM
wp_posts
<?php
/**
* Logic activates / deactivates the plugin.
*
* @package compeer-matching-plugin
*/
namespace ScorpioTek;
class PluginActivation {
var placeSearch, autocomplete;
var componentForm = {
postal_code: 'short_name'
};
jQuery(document).ready(function($){
$(document).on('can_embed_loaded', function() {
$('#postcode').prop('id', 'postal_code');
$('#form-street').prop('id', 'autocomplete');
$('#postal_code').prop('disabled', 'true');
<?php
/**
* Encapsulates the field creation of the announcement custom post type.
*
* @package compeer
* @since 0.0.6.3.3
*/
namespace Compeer;
<?php
function compeer_content_types_init() {
/** Other functions hidden for brevity */
register_post_type( 'announcement', generate_compeer_cpt_options( 'announcement', 'announcements', 'announcements', 'dashicons-rss', true, true ) );
}
add_action( 'init', 'compeer_content_types_init' );
/**
$args = array(
'post_type' => 'volunteer',
'posts_per_page' => '10',
'button_label' => 'Load More',
'button_loading_label' => 'Loading...',
'scroll' => 'false',
'post__in' => implode( ',', $unmatched_volunteers->posts ),
'repeater' => 'template_1',
'id' => 'participant_listing',
);
add_filter( 'pms_submenu_page_capability', 'pmsc_allow_editors_to_view_pages', 20, 2 );
function pmsc_allow_editors_to_view_pages( $capability, $menu_slug ){
if( $menu_slug == 'pms-payments-page' || $menu_slug == 'pms-members-page' || $menu_slug === 'pms-reports-page' || $menu_slug === 'pms-export-page' )
return 'pms_edit_capability';
return $capability;
}
add_filter( 'pms_export_capability', 'pmsc_change_export_capability');
public function test_one_off_trigger_vol_police_report_five_days_prior_expiry_notify_area_coordinator() {
// Create the pending trigger.
$notifications = array(
'all_area_coordinators',
);
$trigger_id = $this->create_trigger_post( 'one_off', 'volunteer', '_police_report_expiry_date', 'ACTUALDATE', $notifications );
// Create the area_coordinator for notification, associate user.
$expected_email = 'area_coordinator_one@compeer.com';
$assigned_area_coordinator_user = $this->factory->user->create(