Hi is there a way that if a user is not a member in the group when they click the group from the group listing (eg “https://www.domainname.com/groups/” ) it will redirect to a certain page?
Thanks in advance.
Hi Simon,
Thank you for the question.Please use the following code.
/** * Redirects user to custom url if they visit the group and are not member of the group. * Site admins are not restricted. */ add_action( 'bp_template_redirect', function () { if ( ! is_super_admin() && bp_is_group() && ! groups_is_user_member( get_current_user_id(), groups_get_current_group()->id ) ) { // change the url to any page. $redirect_url = site_url( '/about' ); bp_core_redirect( $redirect_url ); } } );
You can change the redirect url as you please.
Regards
Brajesh
Viewing 4 posts - 1 through 4 (of 4 total)
The topic ‘ [Resolved] Buddypress group is not member redirect’ is closed to new replies.
This topic is: resolved