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
global $um_messaging; | |
$user_id = 'xx'; // enter user id here | |
$count = $um_messaging->api->get_unread_count( $user_id ); | |
echo $count; |
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
/* add a custom tab to show user pages */ | |
add_filter('um_profile_tabs', 'pages_tab', 1000 ); | |
function pages_tab( $tabs ) { | |
$tabs['pages'] = array( | |
'name' => 'Pages', | |
'icon' => 'um-faicon-pencil', | |
'custom' => true | |
); | |
return $tabs; | |
} |
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
/* | |
In this code sample, you can learn how to apply custom | |
validations on any fields you want. | |
This can be done using these steps: | |
1. Edit the field in backend (field modal) | |
2. Where it asks for field validation choose "Custom" | |
3. Enter a unique validation action name e.g. my_8numbers |
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 sample shows you how to use the API to create | |
and add custom notifications (for real-time notifications) | |
plugin. | |
STEP 1: You need to extend the filter: um_notifications_core_log_types with your | |
new notification type as follows for 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
// 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
// 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
// API Request | |
$url = 'http://localhost/um-api/get.user/?id=1'; | |
// Include your public key and token to the URL | |
$url = add_query_arg('key', '75d9a913782eee3d990e4464ce26213e', $url ); | |
$url = add_query_arg('token', 'bae6ee38cf02a50a0ac8259eed34ceb9', $url ); | |
// Process your request | |
$request = wp_remote_get( $url ); | |
$response = json_decode( wp_remote_retrieve_body( $request ) , true ); |
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
#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; |
NewerOlder