Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 9 years ago

#5482 closed defect (bug) (no action required)

No membership accept/reject buttons for group admins

Reported by: zsono's profile Zsono Owned by:
Milestone: Priority: normal
Severity: normal Version: 1.9.2
Component: Groups Keywords: reporter-feedback
Cc:

Description

I'd like to report a bug that blocks group admins/mods from accepting new users who requested membership to their group.

Specs: using BuddyPress 1.9.2 with WordPress 3.8.1

Problem: if I am an acknowledged member and admin/mod of a certain group and another user requests membership, I cannot accept/reject him or her, because I cannot see the Accept and Reject buttons on the group admin panel under Pending Members. It does not matter if I'm a website admin or anything else - once I join the group, these buttons are gone.

Did a quick check in the code of the bp_button() function and found the following:
No button if you are the current user in a loop
if ( true === $this->block_self && is_user_logged_in() && bp_loggedin_user_id() === bp_get_member_user_id() )
return false;

I tried to output the last two values - bp_loggedin_user_id() and bp_get_member_user_id() - inside the bp_group_has_membership_requests() loop and:
Case 1: if I am member of the group, they are the same, even though the user in the pending members loop is someone totally different;
Case 2: if I remove myself from the group, the bp_loggedin_used_id() returns my ID and the bp_get_member_user_id() returns the ID of the pending member.

Many thanks,

Zsombor

Change History (15)

#1 @boonebgorges
10 years ago

  • Keywords reporter-feedback added

I've attempted to reproduce this in 1.9.2 and 2.0 trunk and have been unsuccessful. The buttons are showing up as expected.

Maybe a dumb question, but just to be clear: When you say "the group admin panel under Pending Members", what do you mean? I don't think there's anything in BP that's called 'Pending Members' (though perhaps you're translating from another language). Are we talking about URLs like http://example.com/groups/mygroup/admin/manage-members/?

if I am member of the group, they are the same, even though the user in the pending members loop is someone totally different

Yes, I can see that this would cause the problem, but I have no sense of how this could happen. Perhaps you could print the entire value of $GLOBALS['members_template'] when inside the loop, so we could have a clearer sense of whether your value is corrupted somehow?

#2 @Zsono
10 years ago

Thanks for you quick answer, boonebgorges!

The URL for me is http://example.com/groups/mygroup/admin/membership-requests/ and this part is handled by the /bp-themes/bp-default/groups/single admin.php file, from line 301:

<?php /* Manage Membership Requests */ ?>
<?php if ( bp_is_group_admin_screen( 'membership-requests' ) ) : ?>

So yes, we are talking about the same part. However, I took the time and did a fresh test install and in that case it's working (sorry for not doing it earlier), no matter how I play around with memberships. I'll definitely dump the members_template global to see what the problem is.

Thanks again!

#3 @natb19
10 years ago

Hi, I've just been playing with a similar problem: (latest BP, latest WP, on unix host and local windows xamp servers)

When a user requests membership to a group, as admin I can't accept the request as the buttons do not appear.

I traced it to the bp_button calls in the groups>single>admin.php in the template, and then looking through the code, I found in the BP_Button class that it was failing on the check:

if ( true === $this->block_self && is_user_logged_in() && bp_loggedin_user_id() === bp_get_member_user_id() )

I'm not sure exactly why the bp_get_member_user_id function was returning my id, but it was, and failing the check. Hence no buttons :(

As a work around, I just added the template option block_self => false option in the bt_button call:

<?php bp_button( array( 'id' => 'group_membership_accept', 'block_self' => false, 'component' => 'groups', 'wrapper_class' => 'accept', 'link_href' => bp_get_group_request_accept_link(), 'link_title' => __( 'Accept', 'buddypress' ), 'link_text' => __( 'Accept', 'buddypress' ) ) ); ?>

But I'm certainly not sure it's the right thing to do for all cases!

#4 @boonebgorges
10 years ago

Thanks for chiming in, natb19. It's still unclear to me how/why bp_get_member_user_id() would return the logged-in user's ID. As I asked Zsono, could you share the contents of the $members_template global while in the loop, to get a better sense of what might be going wrong?

#5 @natb19
10 years ago

No problem:

BP_Core_Members_Template Object
(
    [current_member] => -1
    [member_count] => 2
    [members] => Array
        (
            [0] => stdClass Object
                (
                    [ID] => 1
                    [user_registered] => 2013-09-21 11:45:05
                    [user_login] => nathan
                    [user_nicename] => nathan
                    [display_name] => nathan
                    [user_email] => hidden@email.com
                    [id] => 1
                    [fullname] => nathan
                    [total_friend_count] => 2
                    [latest_update] => a:2:{s:2:"id";i:36;s:7:"content";s:26:"Gonna go training soon...
";}
                    [last_activity] => 2014-04-13 14:54:15
                )

            [1] => stdClass Object
                (
                    [ID] => 7
                    [user_registered] => 2014-03-17 14:22:06
                    [user_login] => test3
                    [user_nicename] => test3
                    [display_name] => Tester 3`
                    [user_email] => hidden2@email.com
                    [id] => 7
                    [fullname] => Tester 3`
                    [is_friend] => 0
                    [total_friend_count] => 0
                    [last_activity] => 2014-04-13 14:53:30
                )

        )

    [member] => stdClass Object
        (
            [ID] => 1
            [user_registered] => 2013-09-21 11:45:05
            [user_login] => nathan
            [user_nicename] => nathan
            [display_name] => nathan
            [user_email] => hidden3@email.com
            [id] => 1
            [fullname] => nathan
            [total_friend_count] => 2
            [latest_update] => a:2:{s:2:"id";i:36;s:7:"content";s:26:"Gonna go training soon...
";}
            [last_activity] => 2014-04-13 14:54:15
        )

    [in_the_loop] => 
    [pag_page] => 1
    [pag_num] => 15
    [pag_links] => 
    [total_member_count] => 2
    [type] => online
)

#6 @boonebgorges
10 years ago

Thanks very much, natb19. So, just to be clear:

  • you are logged in as 'nathan', and are a site admin
  • you are not a member of the group
  • you have previously requested membership to the group

Is that right?

Are you not seeing *either* of the Accept/Reject buttons? Ie, are you seeing them for the test3 user?

#7 @natb19
10 years ago

Nope :)

  • I'm logged in as nathan and I'm a site admin
  • I'm a member of the group (as an admin/the creator of the group)
  • Another user 'test3' has requested access to the group, which I want to accept

The buttons aren't appearing for the user test3. I don't appear in the list as I'm already a member. Just to be clear, this is in the 'requests' action of the admin page.

#8 @boonebgorges
10 years ago

Ok, thanks. At least this narrows down the issue somewhat. It looks like your current user is being mistakenly returned from the requests query - nathan shouldn't be showing up as in the 'members' array.

What version of BP are you running? These queries changed quite a bit in 2.0. If 1.9.x, have you tested trunk? Can you do so to see if it's happening there too?

#9 @natb19
10 years ago

I'm running Version 1.9.2 (updated through my WP admin), I'm in the middle of a project I'm afraid, so I don't have the time to play with this much.

Sorry :(

#10 @boonebgorges
10 years ago

Parts of this query were rewritten in BP 2.0. Can I ask one of the users who were experiencing the problem to test after they've had a chance to upgrade? If the problem is gone with 2.0, I can stop digging :)

#11 @DJPaul
10 years ago

It would be helpful to know if you are using any BuddyPress widgets in any sidebar on the page you're seeing this problem on.

#12 @boonebgorges
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Closing this one due to lack of activity. If there's still a problem after upgrading to BP 2.0.x, please feel free to reopen with details.

#13 follow-up: @m4lvin
10 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

This problem still happens to me with the current BP version 2.2.1.

Situation is exactly as described in comment:7 by @natb19.

The only buddypress-related sidebar widget we us is "who's currently online".

For now we use the ugly fix which was discussed earlier, adding "'block_self' => false," to the bp_button() call in the template buddypress/forums/requests-loop.php" line 31 and 33.

Which other information do you need to fix this permanently?

#14 in reply to: ↑ 13 @boonebgorges
10 years ago

  • Milestone set to Awaiting Review

Replying to m4lvin:

Which other information do you need to fix this permanently?

It was never even fixed temporarily, because I've never managed to reproduce it. The buttons are showing up just fine in my tests.

It's possible that there is some problem with globals bleeding into each other, possibly as a result of a widget on the same page. m4lvin - what theme are you running? Are you using any BuddyPress widgets?

#15 @DJPaul
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from reopened to closed

Closing this again because we do not have enough details to investigate it.

Note: See TracTickets for help on using tickets.