Forum Replies Created
Okay, seems like I really have to learn more about PHP. Via google I found https://wordpress.stackexchange.com/questions/60272/find-out-if-logged-in-user-is-not-subscriber. That gave me a rough idea, but I did not manage to change the code for a redirect.
However, I found a workaround. I placed the following code…
<?php if ( current_user_can('member') ) : ?>
<?php endif; ?>
in these files:
/wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/members/index.php (lines 27 and 144)
/wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/members/single/home.php (13 and 122)
There´s no redirection now, but the content is not visible anymore for the role “subscriber”, but visible for “member”.
Here is a solution to exclude users, that are not logged in: https://buddypress.org/support/topic/hide-profile-from-non-logged-in-users/#post-147745.
But how to exclude/redirect users, that have the user role “subscriber”? Redirect might be working with
<?php wp_redirect( home_url() ); exit; ?
@djpaul Does BuddyPress use the same email-address for sending like WordPress? If not, that might be the problem: Some webhosters (like Hosteurope) restrict the usage of email addresses in scripts like WordPress to prevent spam.
For example I usually have to choose one email-address on my webhoster´s config platform. After that I can use it in WordPress. Any other email address won´t work for sending with WordPress, if I don´t use a plugin like https://wordpress.org/plugins/wp-mail-smtp/.
It seems, that as soon as the user has activated the account (and logged in once?), he is no longer “pending”. The user then the becomes a “subscriber”.
So, I would have to check, if a user is on the Members list/a profile page. Done with your code. But I would have to check, if he is a “subscriber”, too – and in this case redirect him to another url. Any hints, how to achieve that and where to place the code?