This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function is_bot() { | |
$spiders = array( | |
"abot", | |
"dbot", | |
"ebot", | |
"hbot", | |
"kbot", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_footer', 'make_clickable_image_in_pro_badge' ); | |
function make_clickable_image_in_pro_badge() { | |
$link = "YOUR_DESIRED_LINK"; | |
?> | |
<script type="text/javascript"> | |
jQuery(function($){ | |
$('.psts_widget') | |
.css({ | |
'cursor': 'pointer' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Caution: works only for single events (not recurring events) | |
/* | |
Usage: [eab_event_date date="2014-07-05"], [eab_event_date date="today"], [eab_event_date date="tomorrow"] | |
*/ | |
function process_eab_event_date( $atts ) { | |
$atts = shortcode_atts( array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_all_domains(){ | |
return $wpdb->get_results( 'SELECT Distinct domain from wp_domain_mapping', 'ARRAY_A' ); | |
} | |
// $domains = get_all_domains() should return array of domains |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('admin_init', 'disallowed_theme_page'); | |
function disallowed_theme_page() { | |
global $pagenow; | |
if($pagenow == 'themes.php' && !is_super_admin()){ | |
wp_redirect(admin_url()); | |
exit; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Use [my_mem_card] shorcode in anywhere in a page | |
*/ | |
function my_mem_func() { | |
if( is_user_logged_in() ){ | |
$current_user = wp_get_current_user(); | |
$factory = Membership_Plugin::factory(); | |
$user_object = $factory->get_member( $current_user->ID ); | |
$userlevels = $user_object->get_level_ids(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* $restricted_level is the level ID that needs to be restricted to see BP profile fields | |
* .bp-widget.contact-details here .contact-details should be the class name of the profile group | |
*/ | |
add_action( 'wp_head', 'hide_bp_field' ); | |
function hide_bp_field() { | |
if( is_user_logged_in() ){ | |
$restricted_level = 3; | |
$current_user = wp_get_current_user(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Adding capabilities in admin init | |
add_action( 'admin_init', 'add_author_cap' ); | |
function add_author_cap() { | |
// Get current user's role | |
global $current_user; | |
$user_roles = $current_user->roles; | |
$user_role = array_shift($user_roles); | |
if( $user_role == 'author' ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_footer', 'add_tos' ); | |
function add_tos() { | |
?> | |
<script type="text/javascript"> | |
jQuery(function($){ | |
if($('.mp_cart_shipping').length) { | |
var html = '<tr><td colspan="2"><label><input type="checkbox" id="tos" /> I agree with the <a href="#">terms and conditions.</a></label></td></tr>'; | |
$('.mp_cart_shipping tbody').append(html); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wpms_one_blog_only($active_signup) { | |
// get the array of the current user's blogs | |
$blogs = get_blogs_of_user( get_current_user_id() ); | |
// all users may be members of blog 1 so remove it from the count, could be a "Dashboard" blog as well | |
if ($blogs["1"]) unset($blogs["1"]); | |
//if the user still has blogs, disable signup else continue with existing active_signup rules at SiteAdmin->Options | |
$n = count($blogs); | |
if(n > 0){ |