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
<?php | |
/** | |
* Show users with a Job Title "'WP Plugin developer " only | |
**/ | |
add_filter('um_prepare_user_query_args', 'um_my_custom_query_args', 99, 2); | |
function um_my_custom_query_args( $query_args, $args ) { | |
if( $args["form_id"] == "1" ) { // you can validate the current member directory form ID | |
$query_args['meta_query'][] = array( |
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
/** | |
* Returns a user meta value | |
* Usage [um_user user_id="" meta_key="" ] // leave user_id empty if you want to retrive the current user's meta value. | |
* meta_key is the field name that you've set in the UM form builder | |
* You can modify the return meta_value with filter hook 'um_user_shortcode_filter__{$meta_key}' | |
*/ | |
function um_user_shortcode( $atts ) { | |
$atts = extract( shortcode_atts( array( | |
'user_id' => get_current_user_id(), | |
'meta_key' => '', |
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
<?php | |
// Profile View | |
add_filter("um_profile_field_filter_hook__myMetaKeyC","um_profile_field_filter_hook__myMetaKeyC"); | |
function um_profile_field_filter_hook__myMetaKeyC( $value, $data ){ | |
$a = um_user("myMetaKeyA"); | |
$b = um_user("myMetaKeyB"); | |
$value = intval( $a ) + intval( $b ); | |
return $value; |
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
// Requires Ultimate Member v 1.3.69 above. | |
add_filter("um_user_first_name_case","um_custom_name_case"); | |
add_filter("um_user_last_name_case","um_custom_name_case"); | |
function um_custom_name_case( $string ) | |
{ | |
$word_splitters = array(' ', '-', "O'", "L'", "D'", 'St.', 'Mc', 'Mac'); | |
$lowercase_exceptions = array('the', 'van', 'den', 'von', 'und', 'der', 'de', 'di', 'da', 'of', 'and', "l'", "d'"); | |
$uppercase_exceptions = array('III', 'IV', 'VI', 'VII', 'VIII', 'IX'); |
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
<?php | |
add_action('woocommerce_order_status_completed', 'um_woocommerce_approve_user_status'); | |
function um_woocommerce_approve_user_status( $order_id ){ | |
global $ultimatemember; | |
$order = new WC_Order( $order_id ); | |
$user_id = (int)$order->user_id; | |
$items = $order->get_items(); | |
um_fetch_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
<?php | |
add_filter( 'wpseo_canonical', 'um_custom_user_yoast_canonical' ); | |
function um_custom_user_yoast_canonical() { | |
if( function_exists('um_is_core_page') ){ | |
if ( um_is_core_page('user') && um_get_requested_user() ) { | |
um_fetch_user( um_get_requested_user() ); | |
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
<?php | |
/* Add fields to account page */ | |
add_action('um_after_account_general', 'showExtraFields', 100); | |
function showExtraFields() | |
{ | |
$custom_fields = [ | |
"alternate_email" => "Permanent E-mail Address", | |
"major" => "Major", | |
"minor" => "Minor", | |
"gpa" => "GPA", |
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
<?php | |
/** | |
* Restrict specific user roles from accessing profile page | |
*/ | |
add_action("template_redirect","um_custom_page_restriction", 9999 ); | |
function um_custom_page_restriction(){ | |
$hide_from_roles = array( 'child','stranger' ); | |
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
<?php | |
add_filter('um_profile_tabs', 'pages_tab', 1000 ); | |
function pages_tab( $tabs ) { | |
$user_id = um_get_requested_user(); | |
// Show to profile owners only | |
if ( is_user_logged_in() && get_current_user_id() == $user_id ) { | |
$tabs['faves'] = array( | |
'name' => 'Faves', | |
'icon' => 'fa fa-star', |