Zeige Profil nur ab bestimmter Benutzergruppe
Quote from Biker on April 11, 2022, 11:39 amIn den Einstellungen kann ich ja das so einrichten, dass das Profil nur angemeldeten Benutzern angezeigt wird.
Wir haben bei uns im Forum eine Benutzergruppe, die noch nicht alles sehen kann. (Frischlinge)
Sowohl auf der Wordpress Seite selbst und auch im Forum.
Erst nachdem gewisse Voraussetzungen vorhanden sind werden diese Benutzer in die Gruppe Member befördert.
Ist es möglich der Benutzergruppe Frischlinge die Ansicht der Profile und Avatare zu verbieten? (so wie bei nicht eingeloggten)
In the settings I can set it up so that the profile is only displayed to logged-in users.
We have a user group in our forum that can’t see everything yet. (Newcomers)
Both on the WordPress site itself and in the forum.
These users are only promoted to the Members group after certain prerequisites have been met.
Is it possible to forbid the newcomers user group to view the profiles and avatars? (as with not logged in)
In den Einstellungen kann ich ja das so einrichten, dass das Profil nur angemeldeten Benutzern angezeigt wird.
Wir haben bei uns im Forum eine Benutzergruppe, die noch nicht alles sehen kann. (Frischlinge)
Sowohl auf der Wordpress Seite selbst und auch im Forum.
Erst nachdem gewisse Voraussetzungen vorhanden sind werden diese Benutzer in die Gruppe Member befördert.
Ist es möglich der Benutzergruppe Frischlinge die Ansicht der Profile und Avatare zu verbieten? (so wie bei nicht eingeloggten)
In the settings I can set it up so that the profile is only displayed to logged-in users.
We have a user group in our forum that can’t see everything yet. (Newcomers)
Both on the WordPress site itself and in the forum.
These users are only promoted to the Members group after certain prerequisites have been met.
Is it possible to forbid the newcomers user group to view the profiles and avatars? (as with not logged in)
Only a biker knows why a dog sticks its head out a car window.
Quote from Jim on April 13, 2022, 11:57 pm@biker, this was interesting, but I’ve been playing around with it for far too long. This just covers profiles, not avatars. It probably is not as efficient as it could be. For instance, the filter fires many times just on the main forum page. Maybe there is a better filter to use. And it may not even fully function, so it needs more work. Maybe you can take it from here.
Also, I think Frischlinge would see the message about needing to be logged in to see profiles, so you may need to change the translation of that so it says something like “. . . and be promoted to Member”.
It requires of course the group id of the Frischlinge group (put it in where I put 46).
Hopefully someone who knows more than I can correct any obvious errors!
function hide_from_frischlinge( $profileLink ) { if ( is_user_logged_in() ) { $userObject = wp_get_current_user(); $user_id = $userObject->ID; $user_groups = AsgarosForumUserGroups::getUserGroupsOfUser($user_id, 'all', false); // iterate through array for term_id foreach ( $user_groups as $key => $i ){ if ( $i->term_id == 46 ) { $profileLink = false; } } } return $profileLink; } add_filter('asgarosforum_filter_profile_link', 'hide_from_frischlinge', 10, 1 );
@biker, this was interesting, but I’ve been playing around with it for far too long. This just covers profiles, not avatars. It probably is not as efficient as it could be. For instance, the filter fires many times just on the main forum page. Maybe there is a better filter to use. And it may not even fully function, so it needs more work. Maybe you can take it from here.
Also, I think Frischlinge would see the message about needing to be logged in to see profiles, so you may need to change the translation of that so it says something like “. . . and be promoted to Member”.
It requires of course the group id of the Frischlinge group (put it in where I put 46).
Hopefully someone who knows more than I can correct any obvious errors!
function hide_from_frischlinge( $profileLink ) { if ( is_user_logged_in() ) { $userObject = wp_get_current_user(); $user_id = $userObject->ID; $user_groups = AsgarosForumUserGroups::getUserGroupsOfUser($user_id, 'all', false); // iterate through array for term_id foreach ( $user_groups as $key => $i ){ if ( $i->term_id == 46 ) { $profileLink = false; } } } return $profileLink; } add_filter('asgarosforum_filter_profile_link', 'hide_from_frischlinge', 10, 1 );
Quote from Biker on April 18, 2022, 10:33 amHello @jim
Sorry for the late reply.
I was on the road with the motorcycle the whole time and was only able to test the function now.
With your code, the profile view is prevented for the newcomer.
He can still see the avatars, but the newcomer is also allowed to do so.
Should already be a level better than the guest. 😉
Thank you for your help and have a happy Easter.
Hello @jim
Sorry for the late reply.
I was on the road with the motorcycle the whole time and was only able to test the function now.
With your code, the profile view is prevented for the newcomer.
He can still see the avatars, but the newcomer is also allowed to do so.
Should already be a level better than the guest. 😉
Thank you for your help and have a happy Easter.
Only a biker knows why a dog sticks its head out a car window.