Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to make pages like Groups, Forums, members and updates only accessible to members?


  • Hans
    Participant

    @hanss

    Just like the title says: How to make pages like Groups, Forums, members and updates only accessible to members? I don’t want random visitors to be able to see the forum posts, the activity of the members and so on.

Viewing 25 replies - 1 through 25 (of 29 total)

  • gasparking
    Participant

    @gasparking

    this plugin hides every pages ton non-registered users
    https://wordpress.org/extend/plugins/registered-users-only-2/

    this one can hide specific pages / components
    https://buddypress.org/community/groups/s2member/

    Hi guys,

    the plugins you mentioned gasparking are not the solution. RUO 2 protects the complete site. S2 member protects certain pages (a great plugin) works ONLY with PayPal. Also the S2 plugin will manage your created pages and posts not standard integrated buddypress or wordpress functional pages.

    I am also searching for a solution to only make the pages Hans mentioned available to registered / logged in users. It seems crazy that these pages are public pages and that there is no easy option within Buddypress to make them only visible to members.

    Thanks for any advice / support upfront!

    Peter

    actually would be very simple – within a bp-custom.php file. have a look at the bp-core-templatetags.php file which contains some simple functions that determine what component/page you are on. Just need to hook that into bp and checked if logged in (if not, then redirect)

    ie
    bp_is_group()
    bp_loggedin_user_id()
    etc


    Hans
    Participant

    @hanss

    I read somewhere here, that the BP team is planning to add privacy options in future releases. I have no idea if they’re going to include these things in it, but I hope so.

    I also found out that the RUO 2 plugin isn’t an option for me. I didn’t take a look at the s2members plugin yet.

    Before I used the WP sentry plugin. This one works for Posts, but it also hides the menubuttons for pages if you’re logged in. So ome changes for this plugin would be helpfull too.

    Hallo Hans, I have just gone through a lengthy process to find the right solution for paid membership for a buddypress site on a WordPress single installation.

    If you are interested to find out more how I solved it – let me know. I am in Germany so I am also dealing with Language challenges and also foreign payment merchant solutions. Contact me directly if you want – gewinncoach. de

    Peter


    Hans
    Participant

    @hanss

    I sent you an email on the adress I found on your website.

    Thnx for your help!

    I use a plugin called CaPa Protect, https://wordpress.org/extend/plugins/capa/, maybe this could help you.

    Kalman


    pcwriter
    Participant

    @pcwriter

    @Hans

    I’ve installed s2member on my site specifically because it CAN restrict access to both paid memberships AND free accounts. You can restrict access to posts, pages, tags, categories, single pages and uri’s. You can also have lots of fun with advanced conditionals and display different content to different membership levels, including the free level. For more info, check out this readme: http://www.primothemes.com/readme/914/

    Here’s my membership options page to give you an idea of how I’ve set it up with free/paid plans: http://rspace.org/membership/


    pcwriter
    Participant

    @pcwriter

    Or you could try this simple solution in your page templates: http://pastebin.com/KFeEAh1Z


    Hans
    Participant

    @hanss

    @Kalman Labovitz: The plugin causes a fatal error and could not be activited. :-( I’ll send an email to the author.

    @pcwriter: Your simple soluttion is easy and handy for custom pages indeed. But how to use it to protect the forums for example? :-(


    pcwriter
    Participant

    @pcwriter

    @Hans

    You would need to create a forums-loop.php file in your child theme. Try this: http://pastebin.com/mpizkJXq
    Notes on highlights:
    – Lines 1 to 3 have been added to include a message to non-logged-in users.
    – The is_user_logged_in conditional has been moved from line 10 and added to the initial “if” statement on line 5 (actually lines 6 & 1 in forums-loop.php).

    This should work but unfortunately, I can’t test it on my site ‘cuz my server is down. Oh well… it looks like I’m going to have to dust off my xbox ;-)
    Let us know how it goes.

    EDIT: 5 min after posting this, my server’s back up again. Lemme test my own theory…


    pcwriter
    Participant

    @pcwriter

    @Hans

    Nope, that didn’t work quite right. But this DOES:
    http://pastebin.com/pMH5dQLd

    Notes on highlights:
    – Lines 1 to 3 have been added to include a message to non-logged-in users.
    – is_user_logged_in conditional added to line 5 AND php endif added at the end (nested “if” statements… great stuff!)

    Have fun! :-)

    Thanks. The pastebin code did the trick. You can add the code to any section of your buddypress site and customize it to your liking.

    All the best,

    Shane.


    Hans
    Participant

    @hanss

    @pcwriter: Thnx dude! Your sollution helped me a lot!

    If I want the rest of my pages protected also, should I only use this trick on:
    – activity-loop.php
    – blogs-loop.php (nevermind this one, I don’t use blogs from users)
    – groups-loop.php
    – members-loop.php
    or do I have to protect more files?


    rossagrant
    Participant

    @rossagrant

    @pcwriter

    Love your design of the signup page! I use S2 Member too. How did you design the table with the subscription options. I only have one membership level but I’d like to lay it out in a table like you have done. Any ideas?

    @pcwriter the link http://pastebin.com/mpizkJXq does not working


    zanzaboonda
    Participant

    @zanzaboonda

    @pcwriter

    Okay, I feel like a schmuck but I can’t seem to get this to work! I am using the MyBuddyPress child theme of the default, and whether I copy/paste all the code into a file called forums-loop.php and put it in the child theme folder or if I enter the code before the loop in the BuddyPress default theme files, nothing happens. :(

    Am I doing something wrong? I’m so confused and I really need this to work.

    I tried the s2Members plugin and it worked okay but I had some issues with it. Does anyone have any suggestions for me? I would be so happy if you do.

    Thanks and best wishes,
    Kristen

    Here’s what you do:

    Install s2member, and then in s2member settings go to General Options > URI Access Restrictions. If you add /groups/ as a URI fragment, all URLs with /groups/ will be restricted to logged in users. If you add /groups/create/ then anyone can see groups but only logged in users can create new ones, etc. You can do the same thing with /activity/ and /forums/.

    I wrote up a really detailed article about integrating s2member and BuddyPress over here: http://www.buddyboss.com/how-to-set-up-recurring-billing-subscriptions-in-buddypress/


    zanzaboonda
    Participant

    @zanzaboonda

    Honestly I don’t think s2member is an option for me as it seems to conflict with another one of my plugins. :(

    Has anyone been able to resolve this yet? Pretty please?

    I’ve been experimenting with some code to make into a plugin but it doesn’t seem to be working – I get lovely fatal error.

    Parse error: syntax error, unexpected $end in /home/content/65/3511365/html/anthempages/wp-content/plugins/BP Privacy Redirect/bp_privacy_redirect.php on line 71

    If anyone is a php guru maybe you could see what I’m doing wrong? Here’s what I have:

    `<?php

    function members_logged_in_only()
    { global $bp;
    if(is_user_logged_in() && $SERVER{‘REQUEST_URI’}==’/activity/’){
    /*user is logged in*/
    }else{
    wp_redirect(get_option(‘siteurl’) . ‘/welcome’);
    }

    function members_logged_in_only()
    { global $bp;
    if(is_user_logged_in() && $SERVER{‘REQUEST_URI’}==’/members/’){
    /*user is logged in*/
    }else{
    wp_redirect(get_option(‘siteurl’) . ‘/welcome’);
    }

    function groups_logged_in_only()
    { global $bp;
    if(is_user_logged_in() && $SERVER{‘REQUEST_URI’}==’/groups/’){
    /*user is logged in*/
    }else{
    wp_redirect(get_option(‘siteurl’) . ‘/welcome’);
    }

    function forums_logged_in_only()
    { global $bp;
    if(is_user_logged_in() && $SERVER{‘REQUEST_URI’}==’/forums/’){
    /*user is logged in*/
    }else{
    wp_redirect(get_option(‘siteurl’) . ‘/welcome’);
    };

    ?>`

    If we can get this working I would be so happy to put it out there as a plugin for everyone. But could someone please help?

    Thanks and best wishes,
    Kristen


    Ben
    Participant

    @bgiddings

    I think @pcwriter‘s code is the way to go – it’s just a question of putting it in the right files according to what you want to block. EG I wanted to block access to member profiles if user is not logged in, but I wanted them to see all the rest of the content on my site. So I copied the following files to my child theme:

    members – single – home.php
    members – single – member-header.php

    Then in home.php I added the “is user logged in” check as shown highlighted here: http://pastebin.com/EyhRuwCq

    This stopped the main profile content from appearing if the user is not logged in. You could stop there, but I wanted to remove extra data from the profile header and leave a message to the un-logged in user. So in header-message.php I added the log-in check as highlighted here: http://pastebin.com/mpxbkcCe

    This cuts out all content in the header apart from the gravatar, the member name and a polite message. You can see it here: http://www.thebookboard.com/members/bookboard/

    I’m not a coder, so I make no guarantees that this will work in all circumstances, but it works for me. Hope it helps others


    pcwriter
    Participant

    @pcwriter

    @bgiddings

    Yup, it works fine. I like simple solutions.
    I’m still playing with s2member, and learning about the amazing amount of customization it allows. For example, I’ve set up a membership/upgrade page where the displayed content changes according to logged-in status and subscription level. The same can be done for any page, post, category, tag, Buddypress component, etc.

    Hello,
    I’ve been working all weekend on this one and I just can’t seem to find an answer.

    *//PROBLEM: Users that have registered but have NOT activated their accounts show on the Group Members page (…/[bpressdirectory]/groups/[groupname]/members/). This occurs due to my BuddyPress Auto Group Join plugin (link below). How can I hide the not-yet-activated members from appearing on the Group Members page?

    **Failed attempt #1 (members-loop.php):

    `

      … [BUDDYPRESS CODE]

    `

    **Failed attempt #2 (members-loop.php):
    `

      … [BUDDYPRESS CODE]

    `

    Any idea where I went wrong?

    WordPress 3.0.4
    BuddyPress 1.2.7

    Plugins:
    – S2Member (http://www.primothemes.com/post/product/s2member-membership-plugin-with-paypal/)
    – BuddyPress Auto Group Join (http://twodeuces.com/wordpress-plugins/buddypress-auto-group-join) – This

    HI all, am struggling a bit.

    Have set up a community where registered users (level 0) can access specific content. They should be able to update their profile but should not be able to view members directory. Members directory should be accessible from level 1 and up.

    Am using S2member to restrict access to specific URI’s. This works fine (am able to restrict access to appropriate levels when using the website navigation) with one small snag if somebody would guess the buddypress members directory page at http://www.mysite.com/members this is open to all levels!

    adding URI restriction /members to level 1 makes the profile page not accessible for level 0 (has members in the URI). Not what I want.

    Is it possible to rename members directory only?
    Is it possible to restrict specific members directory page (which .php page is called to get this list?)
    Is there another solution to prevent level 0 participants to access the members directory?

    Not a php wizard, so preferably plugin or something ….


    pcwriter
    Participant

    @pcwriter

    @gvdsleen

    Once BP1.3 is released, this issue should be resolved as it will use WP pages for components. You will then be able to use s2member’s page access restrictions for components like Members. In the meantime, you can protect any component directory from unauthorized member levels by editing its index.php template.

    Add the following just after the opening `

    ` tag:

    Then add this just before the corresponding closing `

    ` tag:

    `
    You could add a message here for users who do not have the right access level.
    `

    See the “s2member” > “API/Scripting” section for more examples of how to customize the restriction or display of specific content.

Viewing 25 replies - 1 through 25 (of 29 total)
  • The topic ‘How to make pages like Groups, Forums, members and updates only accessible to members?’ is closed to new replies.
Skip to toolbar