Created
March 5, 2021 16:12
-
-
Save nikitasinelnikov/2d8c1eae15e578fd424a18df9954d7ee to your computer and use it in GitHub Desktop.
Ultimate Member: Make the user profile page restricted for not logged in users with restriction message
This file contains hidden or 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_custom_restriction_settings( $restriction, $post ) { | |
if ( ! is_user_logged_in() && um_is_core_post( $post, 'user' ) ) { | |
$restriction_meta = get_post_meta( $post->ID, 'um_content_restriction', true ); | |
if ( $restriction_meta['_um_accessible'] == '2' && $restriction_meta['_um_noaccess_action'] == '0' ) { | |
$restriction = $restriction_meta; | |
} | |
} | |
return $restriction; | |
} | |
add_filter( 'um_post_content_restriction_settings', 'um_custom_restriction_settings', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment