Skip to:
Content
Pages
Categories
Search
Top
Bottom

Private Community with Public WordPress


  • sushi78
    Participant

    @sushi78

    HiHo,

    I am a newbie and I am trying to fix a structrual problem since days without luck 🙁
    I am running WordPress 3.5.1 and BuddyPress 1.6.4 and I would like to have the following setting:

    1) Everything posted in WordPress (static pages, blog posts) should be viewable by everyone.
    2) Everthing from BuddyPress (Activity streams, forums, groups, member profiles) should be readable only by members.

    I already found “Private BuddyPress” but it seems not running within my setting, as it does not appear in Settings -> Privacy.

    So any suggestions how to set it up like this?

    Thanks in advance,
    Sushi

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

  • bp-help
    Participant

    @bphelp

    create a file named bp-custom.php that you will then place in yoursite/wp-content/plugins folder after you paste the following code in it:
    `

    `
    Just change the /register in the line :
    wp_redirect( get_option(‘siteurl’) . ‘/register’ );
    to the page you want the logged out user to be directed too!
    I found this somewhere on the net so props to whomever coded it!


    bp-help
    Participant

    @bphelp

    the above reply stripped out the code so hopefully this will print out!
    `

    `


    bp-help
    Participant

    @bphelp

    It stripped the code again. Just place this between opening and closing php tags in the bp-custom.php file:
    `
    function bp_guest_redirect() {
    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 ) ) {
    // enter the slug or component conditional here
    if(!is_user_logged_in()) { // not logged in user
    wp_redirect( get_option(‘siteurl’) . ‘/register’ );
    } // user will be redirect to any link to want
    }
    }
    add_filter(‘get_header’,’bp_guest_redirect’,1);
    `


    Kevin M. Schafer
    Participant

    @km-schafer-1

    @bphelp I tried this and when I refreshed my site, all of your code appears below the admin bar on my site — above my header.

    I created a new page and named it “new page here.”

    Here’s your code with my info:

    function bp_guest_redirect() {

    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 ) ) { // enter the slug or component conditional here if(!is_user_logged_in()) { // not logged in user wp_redirect( get_option(‘siteurl’) . ‘/new-page-here’ ); } // user will be redirect to any link to want } } add_filter(‘get_header’,’bp_guest_redirect’,1);

    Am I to insert my URL as well? I tried with and without changing it and that didn’t work either.

    Kevin


    Kevin M. Schafer
    Participant

    @km-schafer-1

    @bphelp I missed my greater than sign in starting out the page. Now your code doesn’t show, but when I log out, i get an error across the top of the screen instead:

    Warning: Cannot modify header information – headers already sent by (output started at /home/*****/public_html/inlandcoder/wp-content/themes/frisco-for-buddypress/members/index.php:12) in /home/*****/public_html/inlandcoder/wp-includes/pluggable.php on line 876


    bp-help
    Participant

    @bphelp

    did you add the code to the bp-custom.php you create in yoursite/wp-content/plugins? did you remember to add the code between opening and closing php tags and save the file? I have it working flawless on wp 3.5.1 and bp 1.7 beta 1. for example this line:
    wp_redirect( get_option(‘siteurl’) . ‘/register’ );
    redirects to register page
    you could for example change it to something like this:
    wp_redirect( get_option(‘siteurl’) . ‘/sample-page’ );
    that would redirect to the sample page.


    bp-help
    Participant

    @bphelp

    That sounds more like your theme is shooting off errors. Try activating the bp-default theme and see what happens. also make sure there is no extra lines before or after the opening and closing php tags in the bp-custom.php


    Kevin M. Schafer
    Participant

    @km-schafer-1

    @bphelp I do believe I have it now. Yes, my butchered theme that I’m learning on was sending off errors. I enabled the BP-Default Theme and we’re good. I have the BP navigation tabs going to the Sample Page.

    I knew you had it right, but I didn’t understand and I didn’t know my theme was causing errors. I use this site for practicing, then I implement the changes that work back to my new site: http://www.gumpolen.com

    Thanks,

    Kevin

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Private Community with Public WordPress’ is closed to new replies.
Skip to toolbar