Skip to:
Content
Pages
Categories
Search
Top
Bottom

Exclude self from members directory

  • Avatar of Henry
    Henry
    Participant

    @henrywright-1

    Does the currently logged in user appear by default in the members directory? If so, is there a reason for this? I was thinking of excluding the currently logged in user.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Avatar of bp-help
    bp-help
    Participant

    @bphelp

    @henrywright-1
    Yes by default. Not really sure why but you could write a function to exclude the current logged in user.

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    Thanks for confirming. I’ll just filter out the logged in user. Probably also do it for the follow pages (I’m using the BP follow plugin too)

    Avatar of aces
    aces
    Participant

    @aces

    @henrywright-1

    http://wordpress.org/plugins/bp-ninja/ ?

    I haven’t tried it myself.

    I’ve seen code snippets around for a stealth mode but don’t have anything to hand…. https://www.google.com/search?q=buddypress+stealth+mode

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    Thanks @ aces seems like an interesting plugin. I’ll check it out

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    I ended up using if ( bp_get_member_user_id() == bp_loggedin_user_id() ) continue; right after bp_the_member() in members-loop.php. I borrowed the idea from an old post by @r-a-y

    The only drawback with this approach is the numbers in the pagination will be off by 1.

    So even though the pagination might read “Showing 1 – 5 of 5 members”, you will see just 4 members on the page (the 5th member is the current user who we’ve just excluded).

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.