Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Restricting access to logged in users via bp-custom.php

  • Profile photo of pdillon809
    pdillon809
    Participant

    @pdillon809

    Hi,

    I’m using Version 1.7-beta1 and wish to restrict access to the buddypress areas of a wordpress site to logged-in users.

    I’ve seen code to do this and tried placing it in bp-custom.php but have had no luck. Does anyone have any code that works with 1.7. I don’t need anything fancy, just redirect to register/login page if anyone tries to access buddypress pages.

    many thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • Profile photo of bp-help
    bp-help
    Participant

    @bphelp

    Yes I made a plugin that does that its been tested up to WP 3.5.1 and BP 1.7 beta 1. Its pretty simple so far, as its still in development. All you need to do is read the readme.txt for instructions about sitewide forums if that is what your using then activate it. Here is the link:
    https://github.com/bphelp/private_community_for_bp

    Profile photo of pdillon809
    pdillon809
    Participant

    @pdillon809

    Thanks @bphelp

    This sounds like exactly what I’m looking for.

    I must have done something wrong, though, as I can still access Buddypress whilst logged out.

    I downloaded the zip from your repository, installed and activated. Are there more steps?

    I’m at bp.youpix.org if you need to check.

    -paul

    Profile photo of bp-help
    bp-help
    Participant

    @bphelp

    In lines 14 through 17 in loader.php delete the code and replace with this:
    `
    function private_community_for_bp_init() {
    require( dirname( __FILE__ ) . ‘/private-community-for-bp.php’ );
    }
    add_action( ‘bp_include’, ‘private_community_for_bp_init’ );
    `
    I made an error an I will update the repository on github.
    Sorry!

    Profile photo of bp-help
    bp-help
    Participant

    @bphelp

    Fixed the repository here:
    https://github.com/bphelp/private_community_for_bp
    Should work fine now, sorry for the error from before I just overlooked a detail. Hope it works for you!

    Profile photo of bp-help
    bp-help
    Participant

    @bphelp

    @pdillon809 Please let me know if the update takes care of it. I appreciate your feedback! Thanks!

    Profile photo of pdillon809
    pdillon809
    Participant

    @pdillon809

    Yes, this appears to have fixed the issue and is exactly what I’m looking for. Totally cool!

    Many thanks.

    Profile photo of bp-help
    bp-help
    Participant

    @bphelp

    @pdillon809 Your welcome and glad I could help! :-)
    Can you mark this as “Resolved?” In case other people need help with the same issue? Thanks!

    Profile photo of jhulianni
    jhulianni
    Participant

    @jhulianni

    Help me, please.

    function nonreg_visitor_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 ) || bp_is_profile_component() ) {
    /* enter the component name to be blocked to visitors in the above line */
    if(!is_user_logged_in()) { //just a visitor and not logged in
    wp_redirect( get_option(‘siteurl’) . ‘/register’ );
    }

    Error in aplications in forums!

    Warning: Cannot modify header information – headers already sent by (output started at /home/content/36/10763236/html/wp-content/themes/OneCommunity/forums/index.php:12) in /home/content/36/10763236/html/wp-includes/pluggable.php on line 876

    Help me! Thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] Restricting access to logged in users via bp-custom.php’ is closed to new replies.
Skip to toolbar