BuddyDev

Search

[Resolved] Alllow one more role than admin to see "private" gallaries

  • Participant
    Level: Initiated
    Posts: 12
    Christien on #8275

    Hi!

    I have just installed Medeapress to my Buddtpress site. I see there are privacy options and a user can choose to have ‘private’ or ‘only me’ media. I believe irrespective of the privacy choice of user an admin can always see any media.

    I want :

    1 – to allow one more user role, an s2member role to see private media files. This role should be able to only see not edit or remove any media of other members.

    2 – Is it possible that the admin can create galleries and add media to any users profiles?

    Kindly help me with the above two, these options are crucial to my requirement.

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #8277

    Hi Christian,
    thank you for posting.

    1. The functionality is not available directly in MediaPress. you can easily add it. Please see
    https://github.com/buddydev/mediapress/blob/master/core/mpp-permissions.php#L39

    All you need to do is check if the current logged in user is the user you want to allow private access and add “private” to the returned status array.

    2. We don’t have an ui for this. you can do it if you want. All you need to do is it set the post_author to the user for which the gallery needs to be created.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 12
    Christien on #8278

    Thank you for the quick answer! However, what you have given me is too much for my level of understanding.

    1. If I look at the code you have sent me to, line 85 to 116 seem to be checking if a user can see (ONLY SEE NO EDIT) private galleries

    will the following work?

    Line 103 :

    if ( is_super_admin() && !current_user_can(access_s2member_level2)) {

    Will I edit the plugin files or can I work with functions.php or bp-custom.php?

    2. “set the post_author to the user for which the gallery needs to be created” where do I set it?

    Thank you for the help

  • Participant
    Level: Initiated
    Posts: 12
    Christien on #8317

    bump

  • Participant
    Level: Initiated
    Posts: 12
    Christien on #8360

    So no further help for me? You could at least say it. Thank you anyways!

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #8371

    Hi Christian,
    I am sorry, It was a perception mistake. I though, I already replied to your topic.

    The problem is the task you are trying to accomplish with MediaPress is doable but needs some experience with coding.

    Changing core files is not suggested as that will restrict you fro updating in future.

    Now,

    1. Yes, the permission is for access not update, so they will be able to see but not modify.
    2. The Gallery is just another post type, so any way to change the author will work.

    If you are not too comfortable with code, it may not be the right time to use MediaPress for this specific use case.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 12
    Christien on #8401

    Thank you @sbrajesh for the help 🙂

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #8409

    Thank you for understanding Christien. I am sorry that MediaPress could not fit to your current requirements. I certainly hope to be of some help in future.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 12
    Christien on #8564

    Hello @sbrajesh !

    I have added ‘|| current_user_can(access_s2member_level2)’ to the line 373 of mpp-permissions.php and it is working 🙂 I will keep this file updating every time I update the plugin.

    Can you tell me the file’s name that needs to be edited to achieve the second result? – ‘allow admin to create galleries and add media to any users profiles’ (I mean buddypress galleries)

    Thank you very much

  • Participant
    Level: Initiated
    Posts: 12
    Christien on #8588

The topic ‘ [Resolved] Alllow one more role than admin to see "private" gallaries’ is closed to new replies.

This topic is: resolved