@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
@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
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);
`
the above reply stripped out the code so hopefully this will print out!
`
`
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!
to install the buddypress 1.7 plugin beta and it still not working.
@jimah for BP 1.7 beta 1, go to Settings > BuddyPress > Components and enable (check) Private Messaging and Save.
When navigating to the “Discussion Forums” WordPress-Page (BP Groups Forum used) only WordPress Admins see the threads for Private Group Forums they are members in. Normal Users only see the threads from Public Groups, but not from Private Groups they are members of.
is this a bug in 1.6.2?
Currently, my users and I cannot send private messages to others members on my site.
I have disabled all plugins, and it is still not working. I have reverted from my buddyboss theme to bp-default theme still the problem persist.
I even deleted the current buddypress plugin to install the buddypress 1.7 plugin beta and it still not working.
I need help with this. Please if you can spare a minute to advise me I will appreciate it.
Shalom
this is what i have for my bp-custom.php file:
`<?php
function restrict_access(){
global $bp, $bp_unfiltered_uri;
if (!is_user_logged_in() &&
(
BP_MEMBERS_SLUG == $bp_unfiltered_uri[0] ||
BP_GROUPS_SLUG == $bp->current_component ||
BP_BLOGS_SLUG == $bp->current_component ||
‘forums’ == $bp->current_component ||
is_page_template(‘website here’)
)
) {
bp_core_redirect( get_option(‘home’) . “/private/” );
}
}
add_action( ‘wp’, ‘restrict_access’, 3 );
?>`
@xsci This is a year old thread and discusses an issue relating to BP 1.5.1; BP is about to release version 1.7.
Please open a new thread, describe the issues you are having and what versions of BP / WP you are using and please test any issues you are having are not custom theme related by dropping back to the bp default theme
Greetings,
Has a patch been created for this yet? I’m not the programmer and would love an easier way to update this.
Cheers!
Teresa
for some reason my forums directory not showing up
i get this error(Sorry, there were no forum topics found.) i have lots of groups on my site and all of them are open not private, Also when i try to create a new topic I get There was an error when creating the topic, I did a fresh clean of buddypress and wordpress. It does it for all my sites.
Version:WordPress 3.5.1. – BuddyPress 1.6.4
Website: http://gossipmoms.info
Multisite
Why not just use groups as a “region”, make them all private
@sbrajesh Thank you for this one! 😉
But I have another question, imagine I wanna to put the messages box (compose, reply, etc) in the side bar on a profile page only. As I saw, each instance of the private message comes with a url, like
Compose …/compose
Reply …/reply etc.
Could you point me for a possible solution?
yeah, as always, tried tens of variations, not this one 🙂
works excellent, thank you again, Brajesh!
Hi James, Here is an example code
http://pastebin.com/WA2rBjvH
You are right about the url part 🙂
thanks Brajesh, recently wanted to write about it.
As I understand, we should use this function as a href, but how to write the parameters in, since for some reason I cannot get it working. thanks!
Ok, forum does not allow me to post the html code.
After including the above code, you can use this function bp_custom_get_send_private_message_link to get the appropriate url.
Here is a simple solution. You will need to add following lines to your theme’s functions.php or bp-custom.php
`
/**
*
* @param int $to_id the user id to whom we plan to send the message
* @param string $subject : if you want to specifuy a predefined subject
* @param string $message: any predefined message
* @return string: link for sending message
*/
function bp_custom_get_send_private_message_link($to_id,$subject=false,$message=false) {
//if user is not logged, do not prepare the link
if ( !is_user_logged_in() )
return false;
$compose_url=bp_loggedin_user_domain() . bp_get_messages_slug() . ‘/compose/?’;
if($to_id)
$compose_url.=(‘r=’ . bp_core_get_username( $to_id ));
if($subject)
$compose_url.=(‘&subject=’.$subject);
if($message)
$compose_url.=(“&content=”.$message);
return wp_nonce_url( $compose_url ) ;
}
//for auto populating message content
add_filter(‘bp_get_messages_content_value’,’bp_custom_message_content_value’);
function bp_custom_message_content_value($content){
if(!empty ($content))
return $content;
$content=$_REQUEST[‘content’];
return $content;
}
//for auto populating message subject
add_filter(‘bp_get_messages_subject_value’,’bp_custom_get_messages_subject_value’);
function bp_custom_get_messages_subject_value($subject){
if(!empty($subject))
return $subject;
$subject=$_REQUEST[‘subject’];
return $subject;
}
`
and then, you can use following in your code to send the user with id:2 a message as
`
<a href="”>Send Message to xyz
`
hope that helps.
Hi @James,
I’m also looking for a solution like this and haven’t found so far. I believe I’ll have to hard code it. If I come to a solution I’ll post here!
We are using groups_create_group() to programmatically create groups.
They show in the total group count, and can be accessed via their slug. They also appear to be ‘fully complete’ in the bp_groups table.
<em>However they don’t show in the group directory, and they don’t show in wp-admin</em> (although the pagination / total count suggests they are there, but when paging we just see empty tables).
Any thoughts?
Sample call we are using:
<code>
$args = array(
‘name’ => ‘my group name’,
‘description’ => ‘my group description’,
‘status’ => ‘private’,
‘slug’ => slugify( ‘my group name’ ),
‘enable_forum’ => 0,
‘date_created’ => bp_core_current_time()
);
$new_id = groups_create_group( $args );
</code>
WP 3.5.1
BP 1.6.3 and 1.6.4
BP default theme
For private groups:
groups/tester/admin/membership-requests/
The request appear, but no Accept / Reject buttons.
The action div is empty:
` avatar, link…
span class=”activity”>requested 9 seconds ago /span
div class=”action”
/div
`
Bug? Fix ?
thousands of private social networks within my site
Sure. Not everything’s out of the box so one can only be limited by skillsets and server.
Hi, I have Buddypress installed in my wordpress GEO Theme. My site is US nationwide which means people can post their place listing for every State and City. I would like to offer the option to the place listing owners to create a private social network for their place. So, it will more than likely be thousands of private social networks within my site. Is this possible with BuddyPress?