BuddyDev

Search

Exclude members from the sitewide gallery

  • Participant
    Level: Initiated
    Posts: 4
    Geoff Beale on #55747

    On our site we would like to exclude certain members from having their galleries shown on the sitewide galleries page. Certainly their membership level would be one criterion for example. Could you suggest the best way to add this code please?

  • Keymaster
    (BuddyDev Team)
    Posts: 25160
    Brajesh Singh on #55753

    Hi Geoff,
    Thank you for the question.

    We can do it by hooking to mpp_before_gallery_query. before I assist, i have a few questions:-

    1. Do you want to exclude from Sitewide gallery(non related to BuddyPress) or do you want to do it for BuddyPress gallery directory?

    2. What is the plugin that you are using for membership level? Can you give me an example(e.g Users with membership level x should not have their gallery visible)

    3. Do you want it for gallery and media both or just gallery?

    Please share the details and I will assist.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 4
    Geoff Beale on #55764

    Hi Brajesh,

    Thank you very much for your reply.

    1. We want to exclude only for the BuddyPress gallery directory.

    2. We are using Paid Memberships Pro and everyone has a membership level either Basic or Silver. We want to exclude Basic members, I think they are level 1.

    3. We want to exclude both galleries and media.

    Be grateful for your guidance, thanks.

    Regards,
    Geoff

  • Keymaster
    (BuddyDev Team)
    Posts: 25160
    Brajesh Singh on #55765

    Hi Geoff,
    Thank you for sharing the details.

    Please allow me to get back to you in next 24 hours.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25160
    Brajesh Singh on #55777

    Hi Geoff,
    Hope you are doing well.

    Thank you for your patience.

    I am sorry, It took me a little longer. I had not recently used Paid Membership Pro and had trouble finding all users with a specific subscription level. Based on their table, I have written a function(Please test it if it is working or not) to achieve this.

    https://pastebin.com/raw/aAc8sm0V

    Please put it in bp-custom.php and It will hide galleries from all users with “Basic” membership level.

    Let me know if it works or not?

    Regards
    Brajesh

    PS:- I have updated the link with correct code.

  • Keymaster
    (BuddyDev Team)
    Posts: 25160
    Brajesh Singh on #55779

    Hi,
    I had a small issue with the old code. Have updated the link with correct code. Please use the code from the new link.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 4
    Geoff Beale on #55782

    Hi,
    Thank you very much indeed, it workd perfectly! One thing I didn’t consider though, when you search the sitewide gallery Basic members galleries are still included and can be viewed. Would there be a way of omitting them?

    Regards,
    Geoff

  • Keymaster
    (BuddyDev Team)
    Posts: 25160
    Brajesh Singh on #55783

    Thank you Geoff.
    I am glad it worked.

    Please allow me to look into it and share the updated code today.

    I am assuming by sitewide gallery search you are referring to the search form in the BuddyPress gallery directory.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 4
    Geoff Beale on #55788

    Yes the search form in the Buddypress gallery directory. It would be great to be able exclude by membership level, thanks.

You must be logged in to reply to this topic.

This topic is: not resolved