Skip to:
Content
Pages
Categories
Search
Top
Bottom

Create private membership site with BuddyPress

  • Avatar of angslycke
    angslycke
    Participant

    @angslycke

    Hi!

    I run a private network based on WordPress and BuddyPress and am looking to customise the way new users register and login to the site. I’ve been searching and found various techniques to achieve this since there’s no built in option in BuddyPress to restrict new users from login until an administrator has verified and activated their account.

    Background: My site has two parts. Lots of pages and posts that are public and available to all users through Google. This is targeted towards search referals to get potential members to visit the site. The other part (the interactive BuddyPress functions such as Activity, Members, Groups, Forums etc.) are protected from public access using the plugin S2Member. To access these functions, you need to be a logged in member.

    This is the process I’m looking for:

    1. New user visits site, registers through the standard “New user” registration form which I have customised with a few custom profile fields.

    2. Details are saved and the user is presented with a message saying that “An administrator will now review your membership application and send you an e-mail once your account is activated.”

    3. An e-mail is sent to the administrator who then manually activates the user after verification of the information the user has filled out.

    4. An e-mail is sent to the new user welcoming them to the site and introducing them to the different functions.

    5. The user can now login and access all content.

    What I’m looking to do is to redirect the activation link e-mail that is sent to the new user to the administrator. I’ll then be using S2Member to restrict access to the interactive BuddyPress functions and manually change the user role to a level where the user can see the BuddyPress functions after verification.

    I’ll be posting my progress here and hopefully this will be a relatively easy way to create a private membership site. Any thoughts or mistakes in my plan so far?

Viewing 25 replies - 1 through 25 (of 25 total)
  • Avatar of Paul Gibbs
    Paul Gibbs
    Keymaster

    @djpaul

    The simplest approach may be to surpress the “click here to activate your account” emails, and use something like http://wordpress.org/extend/plugins/unconfirmed/ to manually activate them.

    Avatar of angslycke
    angslycke
    Participant

    @angslycke

    @djpaul: Yes, but I want to redirect the “activate your account” e-mails to the site admin instead of the user to let the admin know that a new user has registred. I’m trying to figure out the best way to do this. Obviously I don’t want to edit core files, so best practice should be to use a filter to replace the users e-mail address with the site admin e-mail address I guess?

    I found an old post regarding this here (from 2010):

    http://www.thoughtsofjs.com/moderate-new-user-registration-in-buddypress.html

    They’re editing core files there (bad!), but I found this in the comments as a function to achieve the above:
    `
    function filter_replace_with_moderator_email($user_email) {
    return get_site_option( “admin_email” );
    }
    add_filter(‘bp_core_activation_signup_user_notification_to’, ‘filter_replace_with_moderator_email’);
    `

    I added this to my themes custom functions.php-file but the e-mail is still sent to the user instead of the admin. Is there a change in BP 1.5 so that I need to change the hook in the filter? Does anyone know?

    Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    You are better off letting email go to user but remove the activation link. Create a function that hooks into member sign up to email you separately. I’m suggesting this because its better conversion for users to get the email.

    `function email_admin_user_signup() {
    //email admin code here
    }
    add_action(‘bp_core_signup_user’, ‘email_admin_user_signup’);`

    Avatar of Intervik
    Intervik
    Participant

    @intervik

    Hi, recently worked on a datingsite, and a school intranet for BP and scanned 6 month of Getting BP private. Have a lot of notes -and one popped up when reading this post:

    http://picklewagon.com/wordpress/new-user-approve/

    “When a user
    registers for the blog, the user gets created and then an email gets sent to
    the administrators of the site. An administrator then is expected to either
    approve or deny the registration request. An email is then sent to the user
    indicating whether they were approved or denied. If the user was approved,
    the email will include the login credentials. Until a user is approved, the
    user will not be able to login to the site.”

    Try this as a start – didnt remember if I have (Went trough TONS of solutions of reg process, but I saved this link so maybe its useful…), The fix might be to preserve the passwords somehow instead of autocreate them when aproved.

    / Maybe gonna share my solutions later for the BP datingsite – lot of privacy filters and hooks…

    Avatar of bglclub
    bglclub
    Participant

    @bglclub

    The problem with this scenario is the Buddypress sends asks the user for a password, then the user approval generates another. I have been beating my head trying to solve this same problem. I need users to resister without a password, then when they are approved, they get sent a generated password.

    Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    Avatar of gdavis0007
    gdavis0007
    Participant

    @gdavis0007

    Check out the plugin wp-members. I have been using it on a family site and it does exactly what you are looking to do. I only just tried it on BuddyPress (CBOX) tonight. It seemed to work ok.

    Avatar of k.gray
    k.gray
    Participant

    @kgray-1

    I am looking to do the same thing and installed WP-Members. I find that it allows me to moderate members signing up which is great, but even though I have it set to block all pages and posts from non-members they are still showing. I’m using the BP default theme.

    Anyone have suggestions?

    Here is the site – http://forums.saintelia.com/

    Avatar of Florence
    Florence
    Participant

    @floortjahh

    Ahh, I wanted to achieve something like this as well. Like you, I’m using S2members (which I absolutely love – lets you hide/text menu items, text, posts, pages, downloadable content ect based on user role).

    This is what I’ve done: For the registration process I’m using BAW invitation codes. Users need to register for a health course (using Event Espresso), and in the confirmation email they recieve an invitation code they can use to log in and access course materials.

    Avatar of billgates82
    billgates82
    Participant

    @billgates82

    hi to everybody;

    I have a BuddyPress Community that I’m building that’s based around a rather sensitive topic for my users and as such I need to make parts of the community totally private and not accessible by non logged in users.

    I would like guests to be redirected to a page/message that requests login/sign-up before proceeding to the following parts of my community:

    mysite.com/members
    mysite.com/activity
    mysite.com/groups/

    However, I like guests to be able to freely view public blog and public content.

    Is there a way to accomplish this?

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    @billgates82 you should always start a new post rather than tack onto an existing one that may seem to cover the same issue.

     

    As in the post above yours consider looking at the S2 member plugin.

    Avatar of bp-help
    bp-help
    Participant

    @bphelp

    Add this to bp-custom.php http://codex.buddypress.org/developer/customizing/bp-custom-php/
    and it will prevent non-logged in users from accessing BP pages.
    `
    /* Block BP Pages For Non-Logged In Visitors */
    function bp_block_pages() {
    global $bp;
    if ( bp_is_activity_component() || bp_is_groups_component() /*|| bbp_is_single_forum()*/ || bp_is_forums_component() || bp_is_blogs_component() || bp_is_page( BP_MEMBERS_SLUG ) ) {
    // add components to be blocked to non-logged in visitors
    if(!is_user_logged_in()) {
    wp_redirect( get_option(‘siteurl’) . ‘/register’ );
    } // Change /register to the page you want non-logged in visitors directed to
    }
    }
    add_filter(‘get_header’,’bp_block_pages’,1);
    /* End BP Blocked Pages */
    /* Remove RSS Feeds */
    function bp_remove_feeds() {
    remove_action( ‘bp_actions’, ‘bp_activity_action_sitewide_feed’, 3 );
    remove_action( ‘bp_actions’, ‘bp_activity_action_personal_feed’, 3 );
    remove_action( ‘bp_actions’, ‘bp_activity_action_friends_feed’, 3 );
    remove_action( ‘bp_actions’, ‘bp_activity_action_my_groups_feed’, 3 );
    remove_action( ‘bp_actions’, ‘bp_activity_action_mentions_feed’, 3 );
    remove_action( ‘bp_actions’, ‘bp_activity_action_favorites_feed’, 3 );
    remove_action( ‘groups_action_group_feed’, ‘groups_action_group_feed’, 3 );
    }
    add_action(‘init’, ‘bp_remove_feeds’);
    /* End Remove RSS Feeds */
    `

    Avatar of billgates82
    billgates82
    Participant

    @billgates82

    @bphelp thanks you very much mate ;) just that i need !!
    everybody suggest a plugin but its not necesary. adding code is the best solution.
    thanks again ;)
    kind regards

    Avatar of billgates82
    billgates82
    Participant

    @billgates82

    @hnla ok, I understand.

    Avatar of skibler
    skibler
    Participant

    @skibler

    Thanks bphelp, I used the code and have success except for in IE 8 the “Groups” and “Members” tabs are not working correctly – they are defaulting to the page I have set up for the redirect.

    This is only happening in IE. I have tested in Chrome, Firefox and Safari with success.

    Please help!

    Avatar of bp-help
    bp-help
    Participant

    @bphelp

    @ skibler I can’t replicate the issue. Try deleting the code used above and downloading the plugin zip here:

    https://github.com/bphelp/private_community_for_bp

    install like a plugin. Then change the line 27 in private-community-for-bp.php to where you wanna redirect too.

    Avatar of skibler
    skibler
    Participant

    @skibler

    Thanks, I have your plugin installed and activated. It is only blocking the “Members” page and not the “Activity” and “Groups” pages when logged out. Is there something else I need to modify in the PHP file to block those?

    Thanks!

    Avatar of bp-help
    bp-help
    Participant

    @bphelp

    @skibler Line 24 in private-community-for-bp.php shows all that gets blocked. I can’t replicate your issue in explorer, firefox, chrome, and safari. Do you have other plugins installed? What theme are you using?

    Avatar of bp-help
    bp-help
    Participant

    @bphelp

    @skibler Line 24 in private-community-for-bp.php shows all that gets blocked. I can’t replicate your issue in explorer, firefox, chrome, and safari. Do you have other plugins installed? What theme are you using?

    Avatar of studiomgr
    studiomgr
    Participant

    @studiomgr

    I have the same problem with all my pages being visible, even though I blocked them through wp-members settings. I tried installing this plugin, but I still have all pages visible – but now they have error messages. I have tried several plugins to no avail – wp-members was supposed to block pages, but that doesn’t work. I also used BP-registration options, but it doesn’t work well. I am looking at possibly trying the bp-custom.php fix suggested here: http://codex.buddypress.org/developer/customizing/bp-custom-php/. I am not a pro – just looking for the simplest way to create a membership site and block pages from users who are not members and logged in. Would appreciate any guidance! Thanks!

    Avatar of bp-help
    bp-help
    Participant

    @bphelp

    @studiomgr Have you tried this one yet:

    https://github.com/bphelp/private_community_for_bp

    It is only designed to block buddypress pages, I use it and it works good for me.

    Avatar of angslycke
    angslycke
    Participant

    @angslycke

    @modemlooper Revisiting this thread. I’m still looking to change the activation e-mail to go to the site admin instead, and even though this should be fairly easy I must be missing something. The code should be something like this, right?

    `
    function my_redirect_activation_email()
    {
    return get_site_option( ‘admin_email’ );
    }
    add_filter(‘bp_core_activation_signup_user_notification_to’, ‘my_redirect_activation_email’);
    `

    Added this to my custom-functions.php but can’t seem to get it to work, WordPress stills sends the e-mail with the activation link to the new user instead. Any ideas? Thanks!

    Avatar of angslycke
    angslycke
    Participant

    @angslycke

    After hours of frustration I realised that I was trying to change the wrong filter. The filter should be ‘bp_core_signup_send_validation_email_to’. Now works. Here’s the code:

    `
    function redirect_new_user_activation_email()
    {
    // Make sure to use a valid email. Test it with different addresses.
    return get_site_option( ‘admin_email’, ‘fallback@something.com’ );
    }

    add_filter( ‘bp_core_signup_send_validation_email_to’, ‘redirect_new_user_activation_email’);
    `

    The second e-mail address is a fallback address in case the admin_email isn’t specified. Let me know if this works for you!

    Avatar of angslycke
    angslycke
    Participant

    @angslycke

    I’ve upgraded to BuddyPress 1.7.2 in my staging area and the update went smooth. Most functions seem to work fine. However, when I tried registering a new user the above filter didn’t work. BuddyPress sent the standard activation e-mail to the new user’s e-mail instead of the admin e-mail (please read the first post in this thread to review the new member process I have).

    The function bp_core_signup_send_validation_email_to is in bp-members/bp-members-functions.php on line 1361 and I’ve verified that it’s unchanged since BuddyPress 1.6.4 which is what I’m running now. Does anyone know if there’s been any other change affecting this? Thanks!

    Avatar of Guillaume S.
    Guillaume
    Participant

    @guillaumes

    Hello Angslycke,

    I need to do the same… Any solution since ?

    Thanks !!

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

You must be logged in to reply to this topic.