View gist:cebf7407ea1c93dea904
This file contains 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
/* | |
This is a sample filter that assumes your textfield meta key is "buttoncode" | |
The filter below allow you to change the output dynamically | |
to show a shortcode instead of the value entered for that field | |
Use in theme functions.php and do not have to rely on UM core | |
*/ |
View gist:6c8d18b2b0869662d203
This file contains 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
add_action('um_account_pre_update_profile', 'did_user_change_email', 10, 2 ); | |
function did_user_change_email( $changes, $user_id ) { | |
$data = get_userdata($user_id); | |
if ( isset( $changes['user_email'] ) && $data->user_email != $changes['user_email'] ) { | |
// user e-mail changed! Do something | |
} | |
} |
View gist:21e10196a0b4aa493fbb
This file contains 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
#bbpress-forums .bbp-forums-list li { | |
font-size: 12px !important; | |
margin: 0px 12px 0 0 !important; | |
} | |
#bbpress-forums .bbp-forums-list li a { | |
padding: 1px 4px; | |
font-size: 12px; | |
background: #eee; | |
color: #666; | |
display: inline-block; |
View gist:873ae0013a15228abb70
This file contains 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
add_action('um_after_user_role_is_updated', 'mycustom_role_change_action', 10, 2 ); | |
function mycustom_role_change_action( $user_id, $new_role ) { | |
if ( $new_role == 'admin' ) { | |
die('You can not be a community admin'); | |
} | |
} |
View gist:afb94c5b66c63a34d3c1
This file contains 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
// recent payments | |
function sc_edd_recent_payments( $atts ) { | |
$p_query = new EDD_Payments_Query( array( | |
'number' => 12, | |
'status' => 'publish' | |
) ); | |
$payments = $p_query->get_payments(); |
View gist:8743ef32801f7bf08c82
This file contains 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
add_action('um_after_user_is_approved', 'wp_role_contributor_after_um', 99 ); | |
function wp_role_contributor_after_um( $user_id ) { | |
$wp_user_object = new WP_User( $user_id ); | |
$wp_user_object->set_role( 'contributor' ); | |
} |
View gist:d1cdd1ffb04b74743c6b
This file contains 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
/* This code will update the user registered with gravity | |
form and allow you to give him a specific UM community role */ | |
add_action("gform_user_registered", "um_gravity_user_role_sync", 88, 4); | |
function um_gravity_user_role_sync($user_id, $config, $entry, $user_pass) { | |
update_user_meta($user_id, 'role', 'member'); // member can be your UM role slug | |
} |
View gist:48bf0a269af5d182ad9b
This file contains 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
// Avg downloads per customer | |
function sc_edd_avg_downloads_per_customer( $atts ) { | |
$amount = 0; | |
$query = new WP_Query( array( 'post_type' => 'download' ) ); | |
foreach( $query->posts as $post ) { | |
$amount = $amount + edd_get_download_sales_stats( $post->ID ); | |
} | |
$amount = $amount / edd_count_total_customers(); | |
return number_format( $amount, 2 ); | |
} |
View gist:02311172f7b42adeb3ed
This file contains 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
$users = get_users( array('fields' => 'ID') ); | |
foreach( $users as $user_id ) { | |
delete_user_meta( $user_id, 'display_name' ); | |
} |
View gist:962dcd6eaa6db560f6c7
This file contains 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
/* This example syncs both UM / WP role during user approval */ | |
add_action('um_after_user_is_approved', 'sync_um_and_wp_role', 99 ); | |
function sync_um_and_wp_role( $user_id ) { | |
// Get UM role | |
$role = get_user_meta( $user_id, 'role', true ); | |
// Set WordPress role for same user | |
$wp_user_object = new WP_User( $user_id ); |
OlderNewer