Skip to content

Posts from the ‘BuddPress’ Category

7
May

Integrate a blank BuddyBar into bbPress

First add this line of code to your bb-config.php

require_once(dirname(__FILE__) . '/../wp-load.php'); (PS my forums is set up in a forums directory in the root of my site.
You may need to change the path to your wp-load.php file)

Next create a functions.php file for your theme if not already there. Then add this line of code to the functions.php file.

add_action( 'bb_foot', 'bp_core_admin_bar');

Now create your menus and add them to the bar.

PS because the buddypress plugin is not activated on a forum, it will load the buddybar with nothing in it. If you are going to copy the default buddypress functions then make sure to change the function name or you will get and error.

Alternatively you could try include the bp-core-adminbar.php file inside buddypress/bp-core if you do not want a blank bar.

Popularity: 1% [?]

3
Mar

Disable your BuddyBar

Somtimes you do not want the buddybar to display on your site. You can hide it with css but WordPress will still process all the info for it.

Add the following line to your functions.php file to disable the BuddyBar

define ('BP_DISABLE_ADMIN_BAR', false);

Popularity: 2% [?]

19
Feb

Change Xprofile Data

Update your Profile Field information for BuddyPress

xprofile_set_field_data( $field_name', $usert_id, $value);

This will not work for check boxes. Below is code that should help, check boxes need to be serialized data.

$value = maybe_serialize( [An Array of your values] );

 xprofile_set_field_data( $field_name, $user_set_id, $value);

Popularity: 2% [?]

17
Feb

Define you BuddyPress Slugs

Add these lines of code to your wp-config.php file to rename the slugs of the buddypress components ( these are for the members slug and the groups slug )

define( 'BP_GROUPS_SLUG', 'companies' );
define( 'BP_MEMBERS_SLUG', 'volunteers' );

Popularity: 2% [?]

19
Jan

WordPress/BuddyPress – Meta title tag not working

If your buddypress child theme or customized parent theme does not work properly, in otherwords does you title tag output “[Blogname] – Blog” then use the code below to remedy the error.

Whats happening is if you use bp_title_tag() is will output the default string as seen above. If you lean towards using the WordPress conditional tags to test the pages, WordPress will see the BuddyPress pages as normal static pages.

Using bp_get_title_tag we can test to see if its a WordPress page or a BuddyPress page and use the appropriate title tag.

<title><?php
if ( is_home() ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; bloginfo('description'); }
elseif ( is_search() ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; _e('Search Results'); }
elseif ( is_author() ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; _e('Author Archives'); }
elseif ( is_single() ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; wp_title(''); } 

// Entering the buddypress tags
elseif ( is_page() ) { 

 $page_title = rtrim(ltrim(bp_get_page_title()));

 if ( $page_title == "[INSETRT YOUR WP_TITLE HERE] &#8212; Blog" ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; wp_title('');}
 else{ bp_page_title(); }
}
elseif ( is_category() ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; _e('Archive'); echo '&nbsp;|&nbsp;'; single_cat_title(); }
elseif ( is_month() ) {  bloginfo('name'); echo '&nbsp;|&nbsp;'; _e('Archive'); echo '&nbsp;|&nbsp;'; the_time('F'); }
elseif (function_exists('is_tag')) { if ( is_tag() ) { bloginfo('name'); echo '&nbsp;|&nbsp;'; _e('Tag Archive'); echo '&nbsp;|&nbsp;';  single_tag_title("", true); } }
else {  } ?></title>

Popularity: 10% [?]

12
Oct

Trouble with the Site Members Loop?

I have been having some trouble with the site members loop. Originally i had the template as normal, i simply changed the “type” variable to active for the widget loop. But what was heppening was the widget was being paginated aswell and only displaying the users that were on the Member-Directory column. ( Basically the widget was using the directories loop for information.)

The easiest way to overcome this error is to copy the widget code and place it in a file of its own, then simply call the file. I did that and got my loops to work independently.

Another thing to help would be to set the members directory loop to call all “alphabetical” users and not just the “active”, whats the point of having two loops calling recently active users.

Members Directory Files

members-loop.php

index.php

active-members.php

Popularity: 2% [?]

7
Oct

Conversion Thank You page for BuddyPress Registration

I recently had to create a second step “Thank you” page for a client so they could add their Conversion Tracking code to it. Most people will simply add the tracking code to the registration page and set the URLs in your Conversion Tracking software.

Some tracking software programs have trouble when it comes to using the same url for the start and the conversion goal.  Here’s what i did to create a “Thank You” page.

  • Open up your theme folder and copy the register.php template
  • Rename it to thank-you.php (or anything you want really)
  • Next open up thank-you.php and paste the following into it right at the top (line 1) to create a static page template.
<?php /* Template Name: Thank You Template*/ ?>
  • Log into your backend and create a static page called “Thank-you” and select the “Thank Your Template” from the list.
  • Next open up the register.php and insert the following line straight after the call for the register form. This uses javascript to change the action of the form to send to the thank-you page.
<script type="text/javascript"> var changer = document.getElementById('setupform'); changer.action = 'http://yoursite.org.za/thank-you';</script>
  • Lastly to make sure no one visits this page except during the registration process add the following lines of code just below the <body> tag

I have attached the two file register.php and thank-you.php so you can see how i did it.

Popularity: 2% [?]

1
Oct

Get just the logged in user url for BuddyPress

There are two functions here,

the first one will return the user url for a specified ID

function bp_core_get_justuserlink( $user_id, $no_anchor = false, $just_link = true, $deprecated = false, $with_s = false ) {
 global $userdata;
 $ud = get_userdata($user_id);
 if ( !$ud )
 return false;
 if ( function_exists('bp_fetch_user_fullname') ) {
 $display_name = bp_core_get_user_displayname( $user_id );
 if ( $with_s )
 $display_name = sprintf( __( "%s's", 'buddypress' ), $display_name );
 } else {
 $display_name = $ud->display_name;
 }
 if ( $no_anchor )
 return $display_name;
 if ( !$url = bp_core_get_userurl($user_id) )
 return false;

 if ( $just_link )
 return $url;
 return $url;
}

The second function will use the first, but get the url of the currently logged in user.

function bp_get_loggedinuser_link() {
 global $bp;

 if ( $link = bp_core_get_justuserlink( $bp->loggedin_user->id ) ) {
 return $link;
 }
 }

Popularity: 2% [?]

1
Oct

Get just the link for the current logged in user

Any one who need to the the link for the current user. eg /member/admin or /member/warwick
Paste this code into the function.php for the theme and call it.


function bp_get_loggedinuser_link() {
 global $bp;
 if ( $link = bp_core_get_userlink( $bp->loggedin_user->id ) ) {
 return apply_filters( 'bp_loggedinuser_link', $link );
 }
 }

Popularity: 1% [?]

1
Oct

Easily add conversion code to the registration process

Use this to add Google Adwords conversion script to your BuddyPress Install

google_adwords is the name on the function printing the code.

add_action(’signup_finished’,'google_adwords’);

Popularity: 1% [?]