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
/* | |
You need to hook into um_submit_form_errors_hook with a | |
priority over 10. | |
You can stop registration here if the customer_code field does not | |
match the value you want "ALLOWED_VALUE" in this example | |
*/ |
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_submit_form_errors_hook', 'check_customer_code', 100 ); | |
function check_customer_code( $args ){ | |
if ( isset( $args['customer_code'] ) && $args['customer_code'] != 'ABCDE' ) | |
exit( wp_redirect( add_query_arg('err', 'invalid_customer_code') ) ); | |
} |
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 ); |
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' ); | |
} |
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 ); | |
} |
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 | |
} |
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' ); | |
} |
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(); |
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'); | |
} | |
} |
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; |