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_filter( 'um_prepare_user_query_args', 'um_remove_current_user_from_list', 100, 2 ); | |
function um_remove_current_user_from_list( $query_args, $args ) { | |
if ( is_user_logged_in() ) { | |
if ( ! empty( $query_args['exclude'] ) ) | |
$query_args['exclude'] = array_merge( $query_args['exclude'], array( get_current_user_id() ) ); | |
else | |
$query_args['exclude'] = array( get_current_user_id() ); | |
} | |
return $query_args; |
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( 'template_redirect', 'um_restrict_login_page_logged_in' ); | |
function um_restrict_login_page_logged_in() { | |
if ( um_is_core_page('login') && is_user_logged_in() ) { | |
wp_redirect( um_get_core_page( 'user' ) ); | |
exit; | |
} | |
} |
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_filter( 'wp_dropdown_users_args', 'um_show_all_users', 10, 2 ); | |
function um_show_all_users( $query_args, $r ) { | |
if ( isset( $query_args['who'] ) && 'authors' == $query_args['who'] ) { | |
$query_args['who'] = ''; | |
} | |
return $query_args; | |
} |
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 login page URL to UM login page | |
* @param string $login_url | |
* @param string $redirect | |
* @return string | |
*/ | |
function um_login_url( $login_url, $redirect ){ | |
$page_id = UM()->options()->get( 'core_login' ); | |
if ( get_post( $page_id ) ) { | |
$login_url = add_query_arg( 'redirect_to', urlencode( $redirect ), get_permalink( $page_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
add_filter( 'um_email_template_body_attrs', 'my_body_template', 10, 2 ); | |
function my_body_template( $slug, $args ) { | |
return 'style="-webkit-text-size-adjust: none;-ms-text-size-adjust: none; margin: 0; padding: 0; width: 100%;"'; | |
} |
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_filter( 'um_email_template_html_formatting', 'my_email_template_html', 10, 2 ); | |
function my_email_template_html( $slug, $args ) { | |
ob_start(); ?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<!--[if gte mso 15]> | |
<xml> | |
<o:OfficeDocumentSettings> |
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_filter( 'woocommerce_subscriptions_update_users_role', 'my_custom_disable_wcs_role_change', 10, 3 ); | |
function my_custom_disable_wcs_role_change( $enable, $user, $role_new ) { | |
return false; | |
} |
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
$posts = get_posts( array( | |
'numberposts' => -1, | |
'post_type' => 'any', | |
'post_status' => 'publish' | |
) ); | |
foreach ( $posts as $post ) { | |
$content = preg_replace_callback( "/(\[um_show_content roles=\')(.*?)(\'\])/im", "um_custom_change_show_content_roles", $post->post_content ); | |
$post->post_content = $content; |
OlderNewer