Skip to:
Content
Pages
Categories
Search
Top
Bottom

Creating Custom Config-File does not work!

  • I am very frustrated, i did not get it to work, that registration and othe sites are allowed. I placed “mm-buddypress-private-community-config.php” in a folder called “buddypress-private-community-config” with the following content:

    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_URIS = Array(‘/register’);
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_TO_URL = site_url()

    When I do so, the site shows me these two lines over the header graphic. When I click fe. the Register-Link, it shows me a white blank page with these two lines and the error:

    Warning: Cannot modify header information – headers already sent by (output started at /homepages/XX/XXXXXXX/htdocs/community/wp-content/plugins/buddypress-private-community-config/mm-buddypress-private-community-config.php:2) in /homepages/XX/XXXXXXX/htdocs/community/wp-includes/pluggable.php on line 890

    Can someone give me some informations why I did not get it to work and maybe give me the right lines I have to enter in the config-File, that I can finally get this to work. I am trying on this since a week!

Viewing 23 replies - 1 through 23 (of 23 total)
  • Avatar of nipponmonkey
    NipponMonkey
    Member

    @nipponmonkey

    Here is how you can check that the config file is working, just make a config file with this line:

    `
    <?php
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_HOOK = ‘new_redir_to’;
    `

    If you try to access a private page, you should be redirected to the home page of your BP site and you’ll see the “new_redir_to” in the URL. e.g. “www.example.com/?new_redir_to=/some/private/page”.

    If you’re running your BP community not from the root domain, then you’ll have to make more changes to the config file too. It looks like your WP/BP might be run from a subdirectory, “community”. If so, then you’ll need to change some more settings:

    `
    <?php
    // TESTING
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_HOOK = ‘new_redir_to’;
    // If you’re running a blog from /community, try:
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_URIS = Array(‘/community’);
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_TO_URL = site_url()
    `

    One of the above snippets should work for testing everything is working OK.

    If it’s working fine, now you might like to try changing the restrictions to your community:

    `
    <?php
    // RESTRICT TO REGISTER PAGE ONLY: WP/BP running from root domain
    // You can add more URIs to give more access to you site. This will restrict logged out users to the register page only.
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_URIS = Array(
    ‘/register’, // Allow access to the registration form
    ‘/activate?key=*’ // Allow access to the account activation URIs. The wildcard character * allows all activation codes to be accepted as valid URIs.
    );
    // Make redirect to register page. Only the register page will be available to logged out users.
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_TO_URL = site_url() . “/register”;
    `

    If you’re running your community from example.com/community/, then try this:

    `
    <?php
    // RESTRICT TO REGISTER PAGE ONLY: WP/BP running from subdirectory “community”
    // You can add more URIs to give more access to you site. This will restrict logged out users to the register page only.
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_URIS = Array(
    ‘/community/register’, // Allow access to the registration form
    ‘/community/activate?key=*’ // Allow access to the account activation URIs. The wildcard character * allows all activation codes to be accepted as valid URIs.
    );
    // Make redirect to register page. Only the register page will be available to logged out users.
    // “/community” doesn’t need to be added here as it is included in the site_url() function.
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_TO_URL = site_url() . “/register”;
    `

    That’s all you should have to do.

    As for your bug, “output started at /homepages/XX/XXXXXXX/htdocs/community/wp-content/plugins/buddypress-private-community-config/mm-buddypress-private-community-config.php:2″

    There shouldn’t be any output on this line, or in the config file at all. The only thing I can think of that could be causing this bug, is that maybe you’re missing the <?php tag before the code?

    Thank you very much for your informations. It’s right, that the site is running from the directory community, but in the Domain Redirect it is set, that it automatically opens the community folder, so it works with the first solution:

    <?php
    // RESTRICT TO REGISTER PAGE ONLY: WP/BP running from root domain
    // You can add more URIs to give more access to you site. This will restrict logged out users to the register page only.
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_URIS = Array(
    ‘/register’, // Allow access to the registration form
    ‘/activate?key=*’ // Allow access to the account activation URIs. The wildcard character * allows all activation codes to be accepted as valid URIs.
    );
    // Make redirect to register page. Only the register page will be available to logged out users.
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_TO_URL = site_url() . “/register”;

    The thing is now that it automatically opens the Register-Page. When a non-registered user opens the site, there should be the Start-Page and the sites “/register”, “/impressum”, “/news” & “/uber” should be allowed. Logged-Out-Users should be redirected to the Start-Page. Is it possible that you can give me the code for that. Would be very very nice…

    Avatar of nipponmonkey
    NipponMonkey
    Member

    @nipponmonkey

    Yeah, can configure it however you like. Its very flexible. If you want logged out users to be redirected to a start page, just set that page as the $REDIRECT_TO_URL instead of the register page.

    `
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_TO_URL = site_url() . “/start-page”;
    `

    If your start page isn’t part of your WP/BP site then you can also set it to another URL or different domain, e.g.

    `
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_TO_URL = “http://example.com/start-page”;
    `

    To allow access to logged out user to certain public pages, just add them to the $ALLOWED_URIS list:

    `
    <?php
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_URIS = Array(
    ‘/register’, // Allow access to the registration form
    ‘/activate?key=*’, // Allow access to the account activation URIs. The wildcard character * allows all activation codes to be accepted as valid URIs.
    ‘/start-page’,
    ‘/impressum’,
    ‘/impressum/*’, // adding “/*” the end allows access to “example.com/impressum/blog-post/”, etc…, not just example.com/impressum/. Remember, ‘/impressum/*’ on its own doesn’t allow access to “example.com/impressum” because of the extra ‘/’ at the end!
    ‘/news’,
    ‘/news/*’, // if you don’t want to give full access to ‘/news/*’ then delete this line!
    ‘/uber’,
    ‘/uber/*’ // * only works at the end of the URI, e.g. the * in this URI does nothing ‘/uber/*2010/09/26′
    );
    `

    Remember, that if your $REDIRECT_TO_URL is set to a page on your WP/BP site (e.g. site_url(‘start_page’);), then this page must be given public access by adding the URI to the above list, (e.g. $ALLOWED_URIS = array(‘/start_page’, ‘/other-public-page’,….);). Otherwise you’ll get an infinite redirect loop.

    If you find this useful and you get it working correct on your site, I’d appreciate it if you could review the plugin for me and give it a rating. It’s taken a kickin’ recently…

    Some things still dont want to work. The problem is that I set a static site to start site, so this site has the permalink “http://www.domain.de/”. The Site for the newest articles was set by me to News, which only is an empty static site, where the articles I write will be loaded. I do not get the News & Startpage public.

    I tried it with the follwing:
    ‘<?php
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_URIS = Array(
    ‘http://wwww.domain.de/’,
    ‘/register’,
    ‘/activate?key=*’,
    ‘/impressum’,
    ‘/uber’,
    ‘news/*’
    );
    // Make redirect to register page. Only the register page will be available to logged out users.
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_TO_URL = “http://www.domain.de/”;’

    Avatar of nipponmonkey
    NipponMonkey
    Member

    @nipponmonkey

    OK, you have some errors in your code, try this:

    `
    <?php
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_URIS = Array(
    // ‘http://wwww.domain.de/’, // NOTE: NOT NEEDED, only WP/BP URIs on your site should be added here.
    // ”, // NOTE: ADD THIS TO GIVE ACCESS TO YOUR DOMAIN ROOT. ” represents the root domain.
    ‘/register’,
    ‘/activate?key=*’,
    ‘/impressum’,
    ‘/uber’,
    // ‘news/*’ // NOTE: THIS IS MISSING THE START ‘/’ ALL URIs MUST START WITH A ‘/’.
    ‘/news’, // Use these instead.
    ‘/news/*’
    );
    // Make redirect to register page. Only the register page will be available to logged out users.
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_TO_URL = “http://www.domain.de/”;
    `

    See the notes in the FAQs ‘How can I override the default settings?’ for examples of allowed/valid $ALLOWED_URI’s.

    Still not working. Can you have a look on my page mousefriends.de? I will disable the Plugin so that you can see it a little bit better and maybe you find the issue…

    Avatar of nipponmonkey
    NipponMonkey
    Member

    @nipponmonkey

    What’s not working, what’s happening?

    Are some of your public pages working correctly and some not? Or are all of your public pages not working correctly??

    I’ve just taken a look at your site and I found that your “News” items have URLs like:
    ‘http://www.mousefriends.de/archives/1′

    And the Archives for news like this:
    ‘http://www.mousefriends.de/archives/category/news’

    If you want these public you have to add these URIs to the the list:
    ‘/archives/*’,
    ‘/archives/category/news’

    But because ‘/archives/*’ is very general, this might make pages you want to be private, public.

    If this is your problem, then you might like to change your permalinks setting to a custom setting like this:
    ‘/%category%/%postname%/’

    on mousefriends.de/wp-admin/options-permalink.php

    REF: http://codex.wordpress.org/File:wordpress-permalinks-structure.gif
    AND: http://codex.wordpress.org/Using_Permalinks

    This should change your posts from ‘/archives/1′ to something like ‘/news/willkommen-bei-den-mousefriends’

    This new permalink would already be public in the configuration of the plugin you have, as it starts with ‘/news/*’ instead of ‘/archives/X’.

    Also, this custom permalink setting is a lot more SEO friendly and looks prettier too.

    I hope this helps…

    Yes I got it. The News Feed is working now. “News” is the only category I have, so I can use ” ‘/archives/*’ “!

    Thank you for your patience with me. The last thing that does not work ist the redirect to the startpage. The startpage is a static site called startseite. I set this static site in the settings to be the startpage, so WordPress shows this site with the Permalink “http://www.mousefriends.de/” ! As I wrote some posts above it does not work with
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_TO_URL = “http://www.mousefriends.de/”;
    because of an infinite redirect loop I think.
    Can you have a last look on my page again to help me. I will disable the plugin again for a better look on it.

    Avatar of nipponmonkey
    NipponMonkey
    Member

    @nipponmonkey

    Like I said in a previous post, to allow public access to “http://www.mousefriends.de/”, you just have to added ” to the list of allowed urls. That should stop the infinite redirect loop.

    `
    <?php
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_URIS = Array(
    ”,
    ‘/register’,
    ‘/activate?key=*’,
    ‘/impressum’,
    ‘/uber’,
    ‘/news’,
    ‘/news/*’,
    ‘/archives/*’
    // etc…
    );
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_TO_URL = “http://www.mousefriends.de/”;
    `

    Hello nipponmonkey…I made a server change, the site is on the following place: “www.mousenetwork.de/mousefriends/”, but it exists the domain mousefriends.de which switches directly to the site folder. In the WP config I entered the adress http://www.mousenetwork.de/mousefriends/! I still do not get it that Buddypress Private Community shows me the startpage and not the register page, when going to the site. I only want that the register-Page is shown when a user clicks a link which is not allowed. Can you please help, its so complicated for me…

    Avatar of nipponmonkey
    NipponMonkey
    Member

    @nipponmonkey

    I’ve just checked out your domain: http://www.mousenetwork.de/mousefriends/

    It’s redirecting to the register page now, so it looks like you’ve solved this problem.

    I think all you had to do was change the redirect to url to your register page.

    Also, the other pages seem to be working fine too, I can view the News, Uber, etc… but redirected back to the register page when I try to visit Groups, Members, etc…

    Everything seems to be working fine now… Let me know if you have any more problems…

    I had to deactive the plugin for now, because it only worked with http://www.mousenetwork.de/mousefriends/, but not with http://www.mousefriends.de ! Then I got a redirect error….I dont know why, because in the domain config I made the redirect to http://www.mousenetwork.de/mousefriends/!

    Avatar of nipponmonkey
    NipponMonkey
    Member

    @nipponmonkey

    I don’t understand your WP/BP set-up. Why are you running the site from 2 locations? Do you have WP/BP installed twice???

    One config file won’t work for both http://www.mousefriends.de & http://www.mousenetwork.de/mousefriends/, you’d need to set-up two config files for each installation of WP/BP.

    Because these URLs are different, the config files for each would have to be configured slightly differently.

    Anyway, your http://www.mousenetwork.de/mousefriends/ installation was working fine, so you didn’t have to change anything there.

    On http://www.mousenetwork.de/, I assume this is a different installation of WP/BP, all you would have to do is tweak this installation’s config file, to get everything working OK.

    If you could give more information about the difference between your http://www.mousenetwork.de/ community and your http://www.mousenetwork.de/mousefriends/ community and how you’re running them (on two different WP/BP installations???), then I might be able to help more.

    No, I only installed 1 instance of WP/BP! mousenetwork.de is the Main-Domain I have where 2-3 different web project should be hosted in the near future in different folders Only mousefriends.de is a Buddypress Site. The other 2 only should be normal blogs in different folders, fe. Site 2 & Site 3 will come into the folders site2 & site3, where the future domains site2.de & site3.de will redirect to mousenetwork.de/site2 & mousenetwork.de/site3 !

    mousefriends.de currently redirects to mousenetwork.de/mousefriends/ ! When I ran the the Private Community Plugin the problem is that i have to enter mousenetwork.de/mousefriends/ in the browser that it works, but when I enter mousefriends.de I get an redirect loop from the plugin.

    So now I am little bit helpless…

    Avatar of nipponmonkey
    NipponMonkey
    Member

    @nipponmonkey

    OK, I get what you’re doing now…

    Well, if you want to be able to access the site from both mousefriends.de & mousenetwork.de/mousefriends/ then you need to add more allowed URIs to your config file.

    This is because your mousenetwork.de/mousefriends/ site (which was working fine with the plugin) is in a sub-folder, so all of your allowed URIs in the config file will have the ‘/mousefriends/…’ base. When you try to access the site through “mousefriends.de”, the allowed URIs are now all wrong because of the ‘/mousefriends/…’ base, which isn’t needed from your “mousefriends.de” domain.

    To fix this, you can copy all of your allowed URIs that you have in your mousenetwork.de/mousefriends config file and reproduce them in the same list without the ‘/mousefriends’ base. Now when you should be able to access the site through mousefriends.de as well as mousenetwork.de/mousefriends, the new URIs should work fine.

    `
    <?php
    // E.g.
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_URIS = Array(
    ‘/uber’, // FOR “mousefriends.de/uber”
    ‘/mousefriends/uber’, // FOR “mousenetwork.de/mousefriends/uber”
    // etc…
    );
    `

    I hope this works for you…

    Allright, it seems that this works now, but I don’t want that a site visitor directly sees the Register Page. I want that he sees the start page. The problem is that in my WordPress reading settings I set a static article for the startpage called Startseite and an empty static article called News for the Blog! The static article has now the permalink “http://www.mousenetwork.de/mousefriends” because of the settings. How can I realize that a visitor first sees this startpage and only sees the register page, when he clicks a permitted link?

    Avatar of nipponmonkey
    NipponMonkey
    Member

    @nipponmonkey

    Well, you’ll have to change the redirect URL to the homepage, and add the URIs to your homepages to the list of allowed URIs.

    `
    <?php
    // E.g.
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_URIS = Array(
    ”, // FOR “mousefriends.de/” homepage
    ‘/mousefriends’, // FOR “mousenetwork.de/mousefriends/” homepage
    // etc…
    );

    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_TO_URL = site_url(‘register’); // Register page

    // Could change the redirect URL to your homepage…
    //MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_TO_URL = site_url(); // Homepage
    // OR
    //MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_TO_URL = ‘http://www.mousenetwork.de/mousefriends/’; // Homepage
    `

    It doesn’t matter what you have displayed as your homepage, it could be a static WP page or your blog or anything else – it doesn’t make a difference to the plugin. You just need to make sure you give access to the homepage in the list of allowed URIs.

    If you keep the redirect url as your register page, then when the user loads your homepage, they’ll see your homepage. But when they try to load a private page (when not logged in), they’ll be redirected to your register page. I think that is what you’re after.

    I hope this helps.

    I had a similar problem, even after following steps above, I found that the activation link that gets sent to a user would not work, returning something like:

    Warning: Cannot modify header information – headers already sent by (output started at /xxxxx/wp-content/plugins/buddypress/bp-themes/bp-default/registration/activate.php:3) in /xxxxx/wp-includes/pluggable.php on line 897

    I figured some page URL was trying to be called but blocked by the BuddyPress Private Community config file. So I ran Firebug and using the Net tab I determined that the url /activate was also being called without the key parameter.

    So I changed the config to read:
    `
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_URIS = Array(”,’/’,’/register’,’/activate’,’/activate?key=*’,’/frontpage’);
    `

    This solved the problem for me. I guess this is a good general approach if you get errors from BuddyPress Private Community – see what URLs are actually being called, then unblock them.

    Hope this might help someone finding this page via Google like I did.

    Avatar of nipponmonkey
    NipponMonkey
    Member

    @nipponmonkey

    @alexbowyer, cheers.

    You’re exactly right in your method for debugging your site with this plugin. If things aren’t working as you think they should be, make sure all of the required URLs are unblocked in the config file.

    Avatar of Flora1234
    Flora1234
    Member

    @flora1234

    Hello Said

    I need clarification on what is BP Site. Do you mean buddypress or do you mean buddypress private community because if people are using your plugin, i am sure it would relate to the main community file which is buddypress. please clarify what is BP site.

    I am trying to open the page gateway of my website but i understand that i have to do the ::$WP_SUB_FOLDER=’bp’. would bp mean the original buddypress plugin or would it be buddypress private community… sorry i am a bit confused.

    I think you should show us a raw example with about 3 variables in each categories for the other variables you set up and which line needs the activation key star.

    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$WP_SUB_FOLDER = ‘?’;

    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_TO_URL = site_url(‘welcome’);

    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_URIS = Array(‘/welcome’, ‘/classified-page’, ‘/register-2′);

    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_WIDGET_IDS = Array(‘widget-65_wp125′, ‘widget-67_bp_core_recently_active_widgets-3′, ‘widget-69_events_list_widget-3′, ‘widget-70s5_icfader-3′, ‘widget-71_tag_cloud-3′, ‘widget-72_text-3′, ‘widget-73_latest_activity’);

    please help

    If your community is not in the root of your domain or subdomain, then you must make a config file. You must set the ::$WP_SUB_FOLDER variable to the directory of your community. E.g. for http://www.my-domain.com/bp/(BP SITE), ::$WP_SUB_FOLDER=’bp’. For http://www.my-domain.com/charity/community/(BP SITE), ::$WP_SUB_FOLDER=’charity/community’. WARNING, please make sure you save the config file in the correct place

    Avatar of Flora1234
    Flora1234
    Member

    @flora1234

    incidently would it be this?

    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$WP_SUB_FOLDER = ‘buddypress’;
    buddypress is a community and it would be a subfolder after the plugin?

    Avatar of Flora1234
    Flora1234
    Member

    @flora1234

    sorry this is for nipponmonkey

    Avatar of CARLOPOSO77
    CARLOPOSO77
    Member

    @carloposo77

    Hi nipponmonkey,
    thought about writing to you because I think the plugiin is just what I need and want it to work for my site.

    I have the same problem: “Warning: Cannot modify header information – headers already sent by…” whenever I try to access to a protected page. Everything works fine if I type a page that doesn’t exist.

    My installation: WP 3.2.1, BP 1.5, BuddyBoss 2.0.1
    Site in a third level domain, e.g. “xxx.yyy.com”

    My config file:

    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$MODE = MM_BUDDYPRESS_PRIVATE_COMMUNITY::MODE_BLOCK_ALL_AND_ALLOW_SOME_URIS;
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_URIS = Array(”, ‘/’, ‘/registrati’); // “registrati” is the register page
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_TO_URL = “http://xxx.yyy.com/registrati”;
    MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_HOOK = ‘my_redir_to’;

    Can you help?
    Thank you!
    Carlos

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

You must be logged in to reply to this topic.