Asgaros Roles (yet again)
Quote from jerryS on December 9, 2022, 8:20 amI have been trying to figure out how to set my Wordpress administrator to be an Asgaros Moderator.
I found references in this forum and the documentation to set Asgaros roles via the Wordpress Users editor. But alas there was no field I found to change/edit the Asgaros Role.. puzzling. During debugging I found that that field magically appears when I try and edit a non-wordpress-admin user (logged on as wordpress admin).. So I started digging a bit and found in
/asgaros-forum/admin/admin.php line 112 the following:
public function user_profile_fields($user) { $output = ''; // Show settings only when current user is admin ... if (current_user_can('manage_options')) { // ... and he edits a non-admin user. if (!user_can($user->ID, 'manage_options')) { $role = $this->asgarosforum->permissions->get_forum_role($user->ID); etc etcSo, the logic seems to imply that you can only edit an Asgaros user role if you are currently a wordpress admin AND you are editing a non wordpress admin user.
This seems strange. Is there a reason why this is the case? Is this a bug? I’m happy to ‘hack’ it but don’t want to cause more problems because of my incomplete understanding. I’d like my wordpress admin user to also be an asgaros moderator.
Thanks for your consideration.
Bummer about the wordpress audit, I really like your plugin, the only one I’ve found that matches my use-case. And the code looks beautiful and well commented, thank you for your work.
Ngā mihi, Jerry
I have been trying to figure out how to set my Wordpress administrator to be an Asgaros Moderator.
I found references in this forum and the documentation to set Asgaros roles via the Wordpress Users editor. But alas there was no field I found to change/edit the Asgaros Role.. puzzling. During debugging I found that that field magically appears when I try and edit a non-wordpress-admin user (logged on as wordpress admin).. So I started digging a bit and found in
/asgaros-forum/admin/admin.php line 112 the following:
public function user_profile_fields($user) { $output = ''; // Show settings only when current user is admin ... if (current_user_can('manage_options')) { // ... and he edits a non-admin user. if (!user_can($user->ID, 'manage_options')) { $role = $this->asgarosforum->permissions->get_forum_role($user->ID); etc etc
So, the logic seems to imply that you can only edit an Asgaros user role if you are currently a wordpress admin AND you are editing a non wordpress admin user.
This seems strange. Is there a reason why this is the case? Is this a bug? I’m happy to ‘hack’ it but don’t want to cause more problems because of my incomplete understanding. I’d like my wordpress admin user to also be an asgaros moderator.
Thanks for your consideration.
Bummer about the wordpress audit, I really like your plugin, the only one I’ve found that matches my use-case. And the code looks beautiful and well commented, thank you for your work.
Ngā mihi, Jerry
Quote from Asgaros on March 7, 2023, 8:23 amHello @jerrys
The idea behind that was the following:
- WordPress site administrators are automatically Asgaros Forum administrators
- I wanted to avoid that administrators mess around with the roles of other administrators (because based on rule 1, no matter which role you set, they are always Asgaros Forum administrators as well)
But whats possible is: You can set a user which is NOT a WordPress administrator as a Asgaros Forum administrator.
Hello @jerrys
The idea behind that was the following:
- WordPress site administrators are automatically Asgaros Forum administrators
- I wanted to avoid that administrators mess around with the roles of other administrators (because based on rule 1, no matter which role you set, they are always Asgaros Forum administrators as well)
But whats possible is: You can set a user which is NOT a WordPress administrator as a Asgaros Forum administrator.