Replies
Great, it works well.
Thank you very much Brajesh.Ahmed
Yes, ‘particulier’ is the only member type I want redirect.
Ahmed.
thank you for help Brajesh,
Here is the function
function yoostart_restriction() { if ( ! is_user_logged_in() && is_page('devenir-vendeur') ) { wp_redirect( home_url( '/test') ); } $member_type = bp_get_member_type( bp_loggedin_user_id() ); if ( empty( $member_type ) && is_page('devenir-vendeur') ) { wp_redirect( home_url( '/test') ); } if( 'particulier' === $member_type && is_page('devenir-vendeur') ) { wp_redirect( home_url( '/test') ); } } add_action( 'bp_template_redirect', 'yoostart_restriction' );
and it works well,can be improved?
Ahmed
hi Brajesh,
i try 2 ways1st way:
function yoostart_restriction(){
if ( bp_has_member_type( bp_loggedin_user_id(), ‘particulier’) && is_page(‘devenir-vendeur’) ) {
wp_redirect( home_url(‘/test’) );
}
}
add_action(‘bp_template_redirect’, ‘yoostart_restriction’);This function works but doesn’t take users without member type.
2nd way:
function yoostart_restriction(){
$member_type = bp_get_member_type( $current_user->ID );
if (is_user_logged_in() && ‘microentreprise’ === $member_type && is_page(‘devenir-vendeur’) ) {
wp_redirect( home_url( ‘/test’) );
}
}
add_action(‘bp_template_redirect’, ‘yoostart_restriction’);I wanted to use variable but it doesn’t work
thank you
AhmedHi Brajesh,
Thank you, I will contact theme.Ahmed
- Ahmed on July 10, 2017 at 10:32 pm in reply to: [Resolved] Display member type profile by color #9866
thank you
- Ahmed on July 10, 2017 at 9:01 pm in reply to: [Resolved] Display member type profile by color #9863
sorry Brajesh, one more question, if i want to add this class in member directory, how i do that?
- This reply was modified 7 years, 4 months ago by Ahmed.
- Ahmed on July 10, 2017 at 8:34 pm in reply to: [Resolved] Display member type profile by color #9862
thank you very much Brajesh.
I’m looking forward to the update.
you do a great job, bravoAhmed.
- Ahmed on July 10, 2017 at 5:48 pm in reply to: [Resolved] Display member type profile by color #9851
I’m not expert but yes 👍