-
hey,
we have some groups (loosers,winners etc. (for each group one role) and GroupLeaders of these Groups(also extra role). Is it possible that GroupLeaders can manage their group (Edit and delete) but he cant edit the users of another group.Admins can still edit everybody.
But maybe you can add usermanagement feature like:
Adminpanel
role
[Name of the role] | ->can be managed by [Add other roles]
…
(That should work in the frontend)
I dont want to hardcode this into
view.php -> userpro_can_edit_user( $user_id ) so it would be perfect if you can code this little snippet 🙂 Thank youWe would also pay for this feature, we really need this plugin immediately.
I found a solution changeing the userpro_can_edit_user( $user_id ) function in user-functions.php. Is it possible to overwrite this function and define it somewhere else (So i don’t have to change it -everytime you update your plugin)? but Plugin Feature request still exits 🙂
Thank youWhat’s the code /fix that you found? Also can you verify your purchase code.
Thats just a small example how i will Manage this
At function userpro_get_edit_user() addPHP12$userbla = userpro_can_edit_user( $user->ID );if (($user->ID && current_user_can('manage_options')) || $user->ID == get_current_user_id() || $userbla)And thats how my userpro_can_edit_user( $user_id ) function looks like:
PHP12345678910111213141516171819202122232425262728293031323334/* Can edit user profile */function userpro_can_edit_user( $user_id ){if ( current_user_can('edit_users') || $user_id == get_current_user_id() ) {return true;} else {//Get role of current profile$primuser_id = $user_id;$userx = new WP_User( $primuser_id );$temproleprofile = "";if ( !empty( $userx->roles ) && is_array( $userx->roles ) ) {foreach ( $userx->roles as $role )$temproleprofile = $role;}//Get role of current user$primuser_id = get_current_user_id();$userx = new WP_User( $primuser_id );$temprolecur = "";if ( !empty( $userx->roles ) && is_array( $userx->roles ) ) {foreach ( $userx->roles as $role )$temprolecur = $role;}if ( $temprolecur == "ROLEOFGROUPLEADER" && $temproleprofile == "ROLEOFUSER") {return true;}//...-> Add more if statement for other Groupsreturn false;}}Thats all, but every update you do the functions will be overwritten and i have to copy that again into the functions. An adminmenu suggested above would be very easy to code and would replace the “ROLEOFGROUPLEADER” and “ROLEOFUSER” .
Short description: Add roleleaders which can manage one or more specific roles (Edit and Delete Userpro profiles)
with restriction to other roles.
Adminmenu: Select which role is the leader of one or more roles
Changed functions: userpro_can_edit_user( $user_id )
userpro_get_edit_user()You think you can add this to your Plugin? It would be the first Plugin with UserRole Leader support. (GroupLeaders who can manage their groups).
f.example -> you have different groups(roles) like munich and berlin. Each group has one or more leaders who can manage the profiles of the user (actually you cant register on my site but leaders can add members of their managed group) The leaders of Munich don’t have rights to view and edit users of Berlin. The leader of Germany can view and edit all of the groups selected.
But still a question, how can i overwrite your functions? Cause actually i always have to change the functions everytime you update your plugin.
I also coded an CSV User Import Plugin for Userpro based on an extern wp plugin. Just a few lines added to the plugin but it works perfectly.
greetz
You must be logged in to reply to this topic.