Skip to:
Content
Pages
Categories
Search
Top
Bottom

Is this possible? YES / NO?


  • mairaj
    Participant

    @mairaj

    I wish to have a system in place at my BuddyPress website where for example:

    • Level 1 members can see and maintain their own profiles only. (NO ACCESS TO OTHERS PROFILES, they can access entire pages and posts but not other members’ profiles)
    • Level 2 members can see others profiles too.

    (I may use s2member for levels but it doesn’t provide any function like above)

    Anyone kindly give a hint / idea to achieve the above.
    Thank you very much

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

  • modemlooper
    Moderator

    @modemlooper

    Totally possible but you will need to wrap profile code with s2 member level code.

    On the s2member site check out codex and function current_user_can


    mairaj
    Participant

    @mairaj

    @modemlooper
    Hello,
    Thank you very much that you replied. No, I have been trying to find a solution for this for more than a month at BuddyPress forums, S2member forums and everywhere else I could find people talking about BuddyPress but no luck!

    S2member support has said that this is not possible, they suggest uri restrictions but a uri restriction prevents user from seeing their own profile too.

    If for example I restrict /profile/ a member will not be able to see his/her own profile. I somewhere found a custom uri /members/%%displayed_username%%/ but that too blocks members from own profiles.

    Please put some light on the idea you have in mind.

    Thank you very much for your time and help.


    newpress
    Participant

    @newpress

    buddypress is extremely limited in extensiblity and thin like a wafer. Just count how many settings it has. There are few other social scripts available. You have to give them a try


    modemlooper
    Moderator

    @modemlooper

    Nonsense. If a user is a certain level you just test against it.

    if ( member_level && is_users_profile ) <- not real just fake example

    This is not a setting in S2, you will have to write this code yourself and wrap the profile pages with it. This is why they say it wont work because they have no settings for BP pages.

    When I get a chance I will make a working example.


    Roger Coathup
    Participant

    @rogercoathup

    As @modemlooper points out, this is trivial to implement with a little PHP development knowledge.

    s2member builds on top of the WordPress roles and capabilities system — so, in addition to the s2member wrapper functions, you can also use standard WP functions. Combine them with the BuddyPress API and you have a rich environment for creating code to handle access control to pages.

    You can add your access / redirect logic in your theme’s header.php files, or even neater in an action function (in your functions.php file) — try hooking onto init, or bp-screens.


    mairaj
    Participant

    @mairaj

    Oh!
    Sorry but I do not know php, can you recommend me a place where someone may do it for me for a fee?
    Thank you very much for your time and help.

    regards


    Asynaptic
    Participant

    @synaptic

    sorry, can’t help you but just wanted to say that I’d be interested in this feature as well

    :)


    modemlooper
    Moderator

    @modemlooper

    I did not test this but this is more in the direction you want to go.

    `$user = $bp_displayed_user_id ;
    $capability = ‘some_s2_level’ ;

    if ( !bp_is_my_profile() && !is_admin() && !user_can( $user, $capability ) ) {
    wp_redirect( home_url() ); exit;
    }
    `

    Also, you should write this as a function and then test against the profile page

    `function my_member_level_redirect(){

    if( bp_is_member() )

    code to execute when on profile

    }`


    mairaj
    Participant

    @mairaj

    @modemlooper

    THANKS A TON!!! You have made me achieve 100% of what I was thinking of, your fix has worked like a charm..

    Unfortunately I do not know php as yet so I could not make your entire code work for me but yes a combination of what you have given and what I had has done the trick.

    I picked up `&& !is_admin()` from your code and edited `&& !user_can( $user, $capability )` to `&& !current_user_can(access_s2member_level1)` and added it to the piece of code I had. This worked totally!

    I’m truly thankful to you.
    I wish you all the very best for the good work you do :-)


    mairaj
    Participant

    @mairaj

    @modemlooper Hello and thank you again for your help. What I wanted was fully achieved with the code you provided. This is fine and working very nicely however now I wish to keep a few member profiles out of this restriction. Basically Admins and moderators, I want to allow only these members’ profiles accessible by subscribers (In addition to their own, which is already working).

    The setup at the moment is as follows:

    1. Subscribers can only see and maintain their own profiles.
    2. s2members level 1 and Admins can see others profiles too.

    What I want now is:

    Subscribes can see a few selected members’ profiles too (May we define them either by role or by their id to exclude from the restriction?).

    Any ideas on this?

    Thank you very much.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Is this possible? YES / NO?’ is closed to new replies.
Skip to toolbar