• Resolved wpweaver

    (@wpweaver)


    This code:

    function rpg_user_profile_field() {
    	 global $current_user;
    	 global $rpg_groups ;
    
    	 if (isset($_REQUEST['user_id'])) {
    		$user_id = $_REQUEST['user_id'];
    	 } else {
    		$user_id = $current_user->ID;
    	 }

    sets the incorrect user id when this code is invoked from a User Profile when viewed by an admin.

    Situation: As an admin, I open the Profile of some user from the link of their name on a post or whatever. This does open the bbp provile paage of that user. Also includes the Edit link. So now I (logged in as an admin) open the Edit link, and get the bbp version of the profile editor as desired.

    So all the user information of that user is correct and available to me as the admin to edit. EXCEPT the private group checkboxes. Instead of the value for the user, the group values are those of me, the admin. Not so good. This would be the preferred way for an admin to edit a group to which a user belongs instead of using the full user edit page from the dashboard.

    Don’t know when the $_REQUEST[‘user_id’] value might be used, but it looks like opening a user’s profile ends up setting $user_id to the admin’s id instead of the user’s id.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter wpweaver

    (@wpweaver)

    Follow up:

    This fixes the issue for me and the ways I can use the setting:

    if (isset($_REQUEST['user_id'])) {
    		$user_id = $_REQUEST['user_id'];
    	 } else {
    		$user_id = bbp_get_displayed_user_id(); // $current_user->ID;
    	 }

    One more issue – the value/setting checkboxes don’t show when an admin tries to edit themeselvers – I can’t seem to add myself as an admin to a group. I have to use a second asmin account to set me to belong to the groups.

    Plugin Author Robin W

    (@robin-w)

    @wpweaver – many thanks for posting both this and the solution – let me try this and confirm the functionality and I will release a new version.

    One more issue – the value/setting checkboxes don’t show when an admin tries to edit themeselver

    yes that’s a wordpress thing – not much I can do about it – wordpress tries to stop people editing most of themselves !

    Thanks again

    Thread Starter wpweaver

    (@wpweaver)

    Yeah, I figured that out myself while working on this problem some more. That doesn’t make a lot of sense, actually.

    I’m not sure, however, other than it is now the way it is done by your plugin, why the group data has to be in the profile database.

    I also use bbPress Mentions Email Notification plugin. They chose to add the option to disable mention processing on the bbPress user profile, but not via the WP profile info. That means everyone can edit their own settings, so it would be possible to save the group data that way. Must be in the user_meta table.

    But since you’ve already have a lot of users, and the problem is only for admins to set themselves, it really only affects the most expert users anyway. And I’d think that setting groups is a one time thing.

    Plugin Author Robin W

    (@robin-w)

    Keymasters are exempt from groups, so should need to set any parameters on themselves. Most sites have admin and keymasters as the same people, so they would not need to set groups for themselves.

    However Some sites may have admins who are not keymasters, and in this case you may make a valid point.

    Although of course then allowing them set groups for themselves might defeat sites where they want to restrict admins who are not keymasters to certain groups only.

    It’s always a bit of a catch 22 !!

    I’ll code that other change over the weekend hopefully.

    Thanks again for both raising and giving me the fix.

    Plugin Author Robin W

    (@robin-w)

    I’ve just released version 3.3.8 which incorporates your helpful fix – thanks again

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Bug when user profile displayed by admin’ is closed to new replies.