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
function um_users_update_role() { | |
if ( isset( $_GET['um_remove_subscriber'] ) && '1' == $_GET['um_remove_subscriber'] ) { | |
$users = get_users( | |
array( | |
'fields' => 'ids', | |
'role__in' => array( 'um_gold-member', 'um_bronze-member', 'um_silber-member' ), | |
'number' => -1, | |
) | |
); | |
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
function custom_um_query_args_c2n_gender__filter_meta( $skip, $query, $field, $value, $filter_type, $is_default ) { | |
if ( ! is_array( $value ) ) { | |
$value = array( $value ); | |
} | |
// $join_alias is pre-escaped. | |
$query->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata {$join_alias} ON {$join_alias}.user_id = u.ID"; | |
$values_array = array(); | |
foreach ( $value as $single_val ) { |
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( 'init', 'my_custom_init' ); | |
function my_custom_init() { | |
if ( isset( $_GET['check_lifeguard'] ) && '1' == $_GET['check_lifeguard'] ) { | |
global $wpdb; | |
$meta_results = $wpdb->get_results( | |
"SELECT um.* | |
FROM {$wpdb->usermeta} um | |
WHERE um.user_id IN('1736','1251')", | |
ARRAY_A |
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
// It works since the 2.2.3: | |
// Avoid changing the post title to the "restricted content title". | |
add_filter( 'um_ignore_restricted_title', '__return_true' ); | |
// Avoid changing the post content to the "restricted content content" not recommended to use or use with caution! | |
add_filter( 'um_ignore_restricted_content', '__return_true' ); | |
// Avoid flushing the post excerpt when post is restricted. | |
add_filter( 'um_ignore_restricted_excerpt', '__return_true' ); | |
// It works since the 2.8.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
<?php | |
namespace um\core; | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
if ( ! class_exists( 'um\core\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
// Select this option https://imgur.com/VM2tJhv | |
// for getting show verified users and active users(last login recent) first in result | |
function um_custom_verified_last_login( $query_args, $sortby ) { | |
if ( $sortby == 'verified_first' ) { | |
if ( empty( $query_args['meta_query'] ) ) { | |
$query_args['meta_query'] = array(); | |
} | |
$query_args['meta_query'][] = array( | |
'relation' => 'OR', |
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 | |
namespace um\core; | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
if ( ! class_exists( 'um\core\Form' ) ) { | |
/** |
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
function um_customcb_populate_countries() { | |
$countries = array(); | |
if ( ! function_exists( 'get_countries' ) ) { | |
return $countries; | |
} | |
$all_countries = get_countries(); | |
if ( empty( $all_countries ) ) { | |
return $countries; | |
} |
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
// Generate slug in format: {First Name}-{First letter of Last Name}~{hash} | |
function um_custom_generate_custom_slug( $user_obj ) { | |
return strtolower( $user_obj->first_name . '-' . substr( $user_obj->last_name, 0, 1 ) . '~' . substr( strrev( md5( uniqid( 'um_user_hash' . $user_obj->ID, true ) . $user_obj->ID ) ), 0, 5 ) ); | |
} | |
function um_update_custom_usermetaaa( $user_id ) { | |
$permalink_base = UM()->options()->get( 'permalink_base' ); | |
if ( 'custom_meta' === $permalink_base ) { | |
$custom_meta = UM()->options()->get( 'permalink_base_custom_meta' ); |
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
// Replace the function in ultimate-member/includes/core/class-rewrite.php | |
/** | |
* Locate/display a profile. | |
*/ | |
public function locate_user_profile() { | |
$permalink_base = UM()->options()->get( 'permalink_base' ); | |
if ( 'custom_meta' === $permalink_base ) { | |
$custom_meta = UM()->options()->get( 'permalink_base_custom_meta' ); | |
if ( empty( $custom_meta ) ) { |
NewerOlder