bp-custom.php

bp-custom.php

Codex Home → BuddyPress Theme Development → bp-custom.php
bp-custom.php

You』ve probably heard a lot of talk about a bp-custom.php file on the BuddyPress forums or WordPress forums.
So what is it?
bp-custom.php is a file that resides in your WordPress 『plugins』 folder where you can add a bunch of custom code hacks and modifications to BuddyPress.
bp-custom.php is often compared to your theme』s functions.php file.
However, there are two primary differences between bp-custom.php and your theme』s functions.php.

First, bp-custom.php runs from the /wp-content/plugins/ folder and is therefore independent from your theme. This is useful for adding code snippets that are BuddyPress-specific. Also, this code will always load regardless of what theme you are using.
Secondly, bp-custom.php runs early in the BuddyPress-loading process. This allows you to override various settings in BuddyPress.

Choosing which file to place your code snippet in is largely a matter of choice. If you are packaging a BuddyPress theme, then you might want to consider using your theme』s functions.php instead. However, for the most part, you should use bp-custom.php.
Creating your file
bp-custom.php does not exist by default. If you don』t have a file located at /wp-content/plugins/bp-custom.php, go ahead and create a blank file with the following:

Next, save the file as 「bp-custom.php」 and verify that this file is located at /wp-content/plugins/.
Now, when you encounter a forum thread telling you to put a code snippet in bp-custom.php, you』ll know what to do!
Examples
Removing the links automatically created in a member』s profile
This can be done by adding the following function to the bp-custom.php file.
BP 1.2.9
function remove_xprofile_links() {
remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 50, 2 );
}
add_action( 'plugins_loaded', 'remove_xprofile_links' );
BP 1.5 +
function remove_xprofile_links() {
remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2 );
}
add_action( 'bp_init', 'remove_xprofile_links' );
Defining custom slugs
Developers may modify the default URL slugs for activity, forums, etc by adding a statement in the bp-custom.php file.
// change 'discuss' to whatever you want
define( 'BP_FORUMS_SLUG', 'discuss' );

See the customizing labels messages and urls article for more information on modifying slugs.

外掛相容性 – BP 1.5

外掛相容性 – BP 1.5

Codex Home → Legacy Docs → Archived Section: Plugin Development → Plugin Compatibility – BP 1.5
Plugin Compatibility – BP 1.5

Archived file. Good up to BP 1.5 version

This list is a community volunteer effort to check compatibility of the majority of publicly available BuddyPress plugins against BuddyPress 1.5. Even if a plugin is marked as not fully working, most plugins will eventually be updated by their authors, but please be patient. If you know of a plugin that works with BuddyPress 1.5, or doesn』t, please contribute to this forum discussion.
If you』re a plugin author, the BuddyPress Media plugin team has put together a wiki showing developers how to make their plugin compatible with BuddyPress 1.5.
PASS
FAIL
UNKNOWN

為您的 BuddyPress 論壇使用現有的 bbPress 安裝

為您的 BuddyPress 論壇使用現有的 bbPress 安裝

Codex Home → Legacy Docs → Archived Section: Getting Started → Using an existing bbPress installation for your BuddyPress Forums
Using an existing bbPress installation for your BuddyPress Forums

Archived file. Good only up to BP 1.5 version

***The following pertains to sites wanting to use an existing bbPress installation (v1.x) with BuddyPress***
*** NOTE: This is a very rare scenario!  You will not need to follow this guide unless you are running a bbPress 1.x install on your site! ***
If you choose to enable group forums on BuddyPress, you will have the option to 「Set up a new bbPress Installation」 or to 「Use an existing bbPress installation「.
What does this mean necessarily?
If you don』t have a standalone, existing version of bbPress 1.x installed somewhere, then all you have to do is click on 「Set up a new bbPress installation「. Stop reading this article! You』re done!
Now, if you have an existing bbPress 1.x install, you have a choice to make.
Set Up a New bbPress installation
Pros

Easy setup, no headaches

Cons

Creating a new set of bbPress tables in your database solely for BuddyPress forum usage. This means you』ll have two sets of bbPress tables.

Use an existing bbPress installation
Pros

Use your existing bbPress install, maintain one set of bbPress tables

Cons

You will have duplicate forum posts: One on the BuddyPress side, the other on your standalone bbPress install
By default, BuddyPress group forums and group forum posts, regardless of privacy setting, will be posted publicly on your existing bbPress installation (don』t worry though, if you still want to go ahead with this, a detailed tutorial to hide BuddyPress group forums from your existing bbPress install is listed right underneath)

***Regardless of which choice you make, by default, there will be two entry points for forums. Your existing bbPress install URL and the BuddyPress global forums URL (eg. http://testbp.org/forums).***
Still want to go ahead with using an existing installation? Go ahead and click on 「Use an existing bbPress installation」 and follow the steps.
Then, implement the following to ensure your BuddyPress group forums are not publicly displayed on your existing bbPress install.
1) Change the forum slug in BuddyPress (optional)
By default, BuddyPress forums can be accessed at:
hxxp://example.com/forums/
If your existing bbPress install is also installed in /forums/, you』ll want to rename BuddyPress』 forums slug to something else.
You can do this by adding the following line in your wp-config.php:
?1define( 'BP_FORUMS_SLUG', 'group-forums' );
In the example above, your BP forums can now be accessed at hxxp://example.com/group-forums/
2) Create a new forum category in standalone bbPress
By default, BuddyPress will create new forums in your existing bbPress install under forum id #1 . We do not want to do this. So we』re going to create a new forum category to house these new BuddyPress forums.

First, login to your existing bbPress admin area and click on 「Forums」.
Next, scroll down and create a new forum category. You can call this forum category 「Group Forums」 or whatever you want! Under 「Make this forum a category」, ensure that this is checked.
Note down the forum ID of the forum category you just created. (You can get the forum category ID by mousing over the 「Edit」 link and checking the 「id」 parameter.)

3) Tell BuddyPress to use this new forum category
In step #2, we created a new, forum category to house our BuddyPress group forums. Now we want to tell BuddyPress to use this new forum category.
This can be done by adding the following define to wp-config.php:
?1define ( 'BP_FORUMS_PARENT_FORUM_ID', $forum_id );
Change $forum_id to the forum ID from step #2. Now, all new BuddyPress group forums will be created in standalone bbPress under this new forum category.
3) Hide BuddyPress group forum data in standalone bbPress
Now, the last issue we have is hiding all BuddyPress group forum related data from access and view on your existing bbPress installation.
We』re going to be using _ck_』s Hidden Groups plugin to do this. Please install and activate the plugin on your existing bbPress install.
Next:

Open up the plugin (hidden-forums.php) in a text editor.
Comment out this line:
?1$hidden_forums['hidden_forums']=array(500,501,502); // hide these forums, list by comma seperated number

Underneath that line, add the following:
?12345678910$bp_hide_group_forum_category_id = $forum_id; $hidden_forums['hidden_forums']=array();$hidden_forums['hidden_forums'][] = $bp_hide_group_forum_category_id; $forums = get_forums();foreach ($forums as $forum) {    if ($forum->forum_parent == $bp_hide_group_forum_category_id)        $hidden_forums['hidden_forums'][] = $forum->forum_id;}

Change the $bp_hide_group_forum_category_id variable to the forum category ID you noted down in step #2.

And that should be it! By default, the admin can view every single forum post on your bbPress install, so try viewing your bbPress install when you』re logged out!
* Posted by r-a-y, July 16, 2010. This how-to was originally based on this forum post.

groups_get_groupmeta()

groups_get_groupmeta()

Codex Home → Developer Resources → Function Examples → groups_get_groupmeta()
groups_get_groupmeta()

Function to get custom group meta.
If you don』t pass a meta_key it returns ALL meta data associated with that group_id.
Returns String or Array of Meta Values.
Odd Behavior: If you pass no meta key to get all values and it has none, it returns a blank array. If you passed a key it returns a blank string.
groups_get_groupmeta( $group_id, $meta_key = '');
See also groups_update_groupmeta()
Source File
groups_get_groupmeta() is located in bp-groups/bp-groups-functions.php

故障排除

故障排除

Codex Home → Getting Started → Troubleshooting
Troubleshooting

Please read the following and if your problem cannot be resolved then feel free to post in the support forums. Make sure that you include important troubleshooting information.

Check error logs in server.
Switch to a WordPress Default Theme like the Twenty Fourteen or Twenty Thirteen themes, etc. to rule out possible issue/s caused by your theme.
Deactivate all plugins in your Plugins Activated panel except BuddyPress to see if that resolves the problem. Remember to deactivate plugins in the wp-content/mu-plugins folder as well as any custom /code in your wp-content/plugins/bp-custom.php in your server, if any. If the problem is resolved at any stage, reactivate plugins one at a time until you identify the plugin/s which caused the issuue.
If you cannot access your wp-admin/dashboard, you can reset the plugins folder via FTP or phpMyAdmin.
Clear server and/or browser caches.
Download a fresh copy of the latest WordPress and BuddyPress versions and re-upload to server.

For BP theme-related troubleshooting, go to https://buddypress.org/support/topic/basic-troubleshooting-tips/

模板包演練 – Twenty Ten

模板包演練 – Twenty Ten

Codex Home → Legacy Docs → Archived Section: Theme Development → Themes & the BuddyPress Template Pack → Template Pack Walkthrough – Twenty Ten
Template Pack Walkthrough – Twenty Ten

Archived file. Good only up to BP 1.6.5 version

BP TEMPLATE PACK 1.2 == BUDDYPRESS 1.5 == WORDPRESS 3.2.1

There are two ways to implement Step Three of the compatibility process:
– First Method: Superimposing the HTML structure of your WordPress theme onto 16 BP template files which were transferred into your WP theme folder during the compatibility process or
– Second Method: Creating the following files in your WordPress theme – header-buddypress.php, sidebar-buddypress.php and/or footer-buddypress.php
We』ll use the second method to make Twenty Ten compatible with BuddyPress. By the end of this article, you should have the basic child theme files required to make Twenty Ten compatible with BP 1.5 using the BP Template Pack plugin:

/bp-twentyten/

header-buddypress.php
sidebar-buddypress.php
style.css

Prelude: Create a Twenty Ten Child Theme
( If you already have your own Twenty Ten Child theme, skip this section and proceed to the Compatibility Process )
1. Create a new theme folder for your Twenty Ten child theme. For this example, the child theme is called BP Twenty Ten so we』ll name our theme folder bp-twentyten.
2. Create a style.css file and add it in the bp-twentyten folder with content below:
/*
Theme Name: BP Twenty Ten
Theme URI: https://codex.buddypress.org/
Description: Twenty Ten child theme for BuddyPress 1.5 Compatibility Process
Version: 1.0
Author: mercime
Author URI: https://codex.buddypress.org/
Template: twentyten
Tags: buddypress, two-column
*/
@import url( ../twentyten/style.css );
3. Upload the bp-twentyten folder with the style.css file within to your server to /wp-content/themes/
N.B. We』ll be creating and uploading more files later during the compatibility process. For now, these are the basic files required for the child theme to be activated so that we can proceed with the BP compatibility process.
Compatibility Process
1. After activating BuddyPress, go to dashboard Appearance > Themes and activate our child theme 「BP Twenty Ten」. At the top of the Themes panel, you』ll see a message with 3 different options to make your theme compatible with BuddyPress. Select update your existing WordPress theme

2. Clicking on the above link will bring you to the 「Install Plugins」 panel. Click on 「Install」 link under BuddyPress Template Pack plugin.

3. Click OK to install BuddyPress Template Pack plugin.

4. Activate BuddyPress Template Pack plugin.

5. Go to Appearance > BP Compatibility

6. Step One: Moving template files automatically. Click on Move Template Files

7. Templates moved successfully! Click on Continue to Step Three You only need to go through Step Two if there was a problem transferring the files.

Pages: 1 2 3

Backing Up Your Database and Files

Backing Up Your Database and Files

Codex Home → Getting Started → Frequently Asked Questions → Backing Up Your Database and Files
Backing Up Your Database and Files

Backing up your database and site files on a regular basis is one of the best practices to maintain your site. Backups of the database as well as the site』s folders and files in the server are essential to recover from a disaster such as hardware failure or if your site is compromised.
There are a number of approaches you may take to backup:
Hosting control panels
If your site』s hosting provides a control panel e.g Cpanel, Plesk, or Helm, then you should have backup available as a selectable option. Log in to your control panel, locate the item, review it』s options and enable it; generally it will backup both your site files and database and it will do this as a scheduled task which also rotates the backup i.e after a certain number of backups the task will then create the next set of backups and overwrite the first ones made, this way you have backups that will cover a certain period, typically this might be a week worth, so from any given day you should have backups that cover the previous six days.
With 『Rotating』 backups it』s worth bearing in mind that they dictate a window of opportunity in which you may recover or restore files in case of problems and as such, you need to keep a close eye on your site on a regular basis during the period your backup covers before being rotated. For example, if you have a problem on a Tuesday you have only Monday』s backup to revert to if you haven』t noticed the issue by the time next Monday comes around the good backup will be overwritten and you have lost the opportunity.
Manual Database backups
If you have a tool such as phpMyAdmin made available to you, you might choose to take a manual backup of a site』s database to download and store off site which is the recomended practice. Keeping backups in the same hardware they were taken from negates the usefulness of backups in the event of hardware failure.
A full database backup will pretty much help you recover your site in almost its entirety. For complete recovery, you』d also need to backup or download your site』s files and folders from the server. These static files includes uploaded media like images, PDFs, and other documents which you attached to your Posts/Pages.
The procedure for making a manual database backup has been well documented in the WordPress Codex: codex.wordpress.org/Backing_Up_Your_Database
WordPress Admin Dashboard / Backend Export
WordPress provides a means of exporting your posts, pages, comments, custom fields, categories, and tags.
Navigate to admin menu 『Tools > Export』 option and select all that you want to export. Save the exported file off site. Caveat: this is not a replacement for a full backup regimen, it only backups content which does not include database information on the site configuration. This method is best viewed as a quick means of restoring a few posts that may have been lost and can』t be recovered from the posts revisions table. Under the principle outlined below that one can』t be too safe, it is advisable to use this facility from time to time. **Note this method does NOT export your BuddyPress data, but only WordPress blog entries, comments and users
VaultPress
Update: VaultPress is owned by Automattic. As of Version 1.0+, it supports normal BuddyPress installations.
For complete peace of mind it may be worth considering the monthly subscription to the VaultPress service which continually monitors and backs up your site, files and database, and allows very simple restores in the event of a disaster. This provides a level of security and comfort worth every penny. See: VaultPress Features | VaultPress Plans
Backup often – be safe, not sorry
Generally there is no such thing as too many backups. It』s very easy to think that you have covered the process and are safe but it is good practice to keep multiple backups that cover the same data and keep them in different locations. If possible, download your site』s folder and files via s/ftp to your localhost machine, copy those files to a secondary devise such as usb drive, NAS drive, pen drive, etc. Do the same with your database backups … keep multiple copies of them on iifferent storage locations where possible.

開發者和設計師資訊 BP 1.5

開發者和設計師資訊 BP 1.5

Codex Home → Legacy Docs → Archived Section: Getting Started → Developer and Designer Information BP 1.5
Developer and Designer Information BP 1.5

Archived file. Good up to BP 1.5 version

As with any release developers and designers may need extra information so here is a collection of links around the new release.
BuddyPress 1.5.2 and WordPress 3.3
Use wp_enqueue_scripts, not wp_print_styles, to enqueue scripts and styles for the frontend
BuddyPress 1.5 and WordPress 3.2.1
Plugin update information : Boone B Gorges
Better Metadata wrappers : Boone B Gorges
Accessing User metadata : Boone B Gorges
Does your BuddyPress plugin or theme modify BP』s navigation menus? : Boone B Gorges
Maintain Backward Compatibility with an abstraction file: Boone B Gorges
Custom Post Types Comments and the Activity Stream in bp 1.5 : Boone B Gorges
Manually modifying single group navigation in BuddyPres 1.5 : Boone B Gorges
Fix your older plugin to be compatible with BP 1.5: BuddyPress Media Dev team
Theme information:
Member settings pages are blank
BuddyPress 1.5 comes with brand-new templates so you can style your member settings pages.   However, if you』re using an older child theme, you will need to copy over these templates to your WP theme.
To fix this problem, copy over the following folder:
?1/plugins/buddypress/bp-themes/bp-default/members/single/settings/
directly to your WP theme』s folder.
Member forum pages are blank
BuddyPress 1.5 ships with a brand new member sub-nav item called 「Forums」 where members can find the topics they have started or replied to.
Example:
http://testbp.org/members/johnjamesjacoby/forums
For this to function properly in older child themes, you』ll need to copy over the following files and folders:
?12/plugins/buddypress/bp-themes/bp-default/members/single/forums.php/plugins/buddypress/bp-themes/bp-default/members/single/forums/
directly to your WP theme』s folder.
You』ll also need to modify the following file in your WP theme:
?1/wp-content/themes/YOUR-THEME/members/single/home.php
Open up /members/single/home.php in your editor and after:
?12    
Add:
?12    
Activity entries are missing the 「Delete」 button
BuddyPress 1.5 changed the way the 「Delete」 button is rendered in activity entry items.
In older child themes, you will need to modify the activity entry template located in:
?1/wp-content/themes/YOUR-THEME/activity/entry.php
Open up entry.php and add the following snippet:
?1
Above or below:
?1
Now you can delete activity entries again!
Group avatar uploading doesn』t work
BuddyPress 1.5 changed a bit of code in the group creation template that broke compatibility with older themes.
For compatibility, you will need to modify the group creation template located in:
?1/wp-content/themes/YOUR-THEME/groups/create.php
Open up create.php and find the following snippet:
?1
And replace it with:
?1
You should now be able to upload group avatars again!
Avatar uploading doesn』t work on the registration page
In BuddyPress 1.5, the ability to upload an avatar was removed from the registration page.
In older child themes, you should remove a section of code in the registration template located in:
?1/wp-content/themes/YOUR-THEME/registration/register.php
Open up register.php and remove the following block of code:
?1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950              

        

         

                    

         

                        <input type="submit" name="upload" id="upload" value="" />                        <input type="hidden" name="signup_email" id="signup_email" value="" />            <input type="hidden" name="signup_username" id="signup_username" value="" />        

                            

         <img src="" id="avatar-to-crop" class="avatar" alt="" />         

            <img src="" id="avatar-crop-preview" class="avatar" alt="" />        

         <input type="submit" name="avatar-crop-submit" id="avatar-crop-submit" value="" />         <input type="hidden" name="signup_email" id="signup_email" value="" />        <input type="hidden" name="signup_username" id="signup_username" value="" />        <input type="hidden" name="signup_avatar_dir" id="signup_avatar_dir" value="" />         <input type="hidden" name="image_src" id="image_src" value="" />                                               
Stylesheet changes
BuddyPress Default uses a function to enqueue it』s stylesheets in BuddyPress 1.5. Our 「Building a Child Theme」 codex article has been updated for BP 1.5 and reflects the information posted below.
The function you want to be interested in is this:
?1234567891011121314151617181920if ( !function_exists( 'bp_dtheme_enqueue_styles' ) ) :/** * Enqueue theme CSS safely * * @see https://codex.wordpress.org/Function_Reference/wp_enqueue_style * @since 1.5 */function bp_dtheme_enqueue_styles() {    // Bump this when changes are made to bust cache    $version = '20110804';     // Default CSS    wp_enqueue_style( 'bp-default-main', get_template_directory_uri() . '/_inc/css/default.css', array(), $version );     // Right to left CSS    if ( is_rtl() )        wp_enqueue_style( 'bp-default-main-rtl',  get_template_directory_uri() . '/_inc/css/default-rtl.css', array( 'bp-default-main' ), $version );}add_action( 'wp_enqueue_scripts', 'bp_dtheme_enqueue_styles' );endif;
All you need to do is declare that in your child theme as it has a check to see if exists it will then use your function so no need to deregister.
In your functions.php declare the function like this:
?123456789101112function bp_dtheme_enqueue_styles() {    // Bump this when changes are made to bust cache    $version = '20110804';     // Default CSS    wp_enqueue_style( 'bp-default-main', get_template_directory_uri() . '/_inc/css/default.css', array(), $version );     // Right to left CSS    if ( is_rtl() )        wp_enqueue_style( 'bp-default-main-rtl',  get_template_directory_uri() . '/_inc/css/default-rtl.css', array( 'bp-default-main' ), $version );}add_action( 'wp_enqueue_scripts', 'bp_dtheme_enqueue_styles' );
If you want no styles enqueued you can just call it empty like this:
?12345
Alternatively if you anted to add in your own styles you can simply enqueue them after the default or even instead of the default.
You can also do the same for scripting and other functions in the BuddyPress Default』s functions.php.
BuddyPress Template Pack Tutorials for BP 1.5
Twenty Eleven theme – https://codex.buddypress.org/theme-development/theme-dev-bp-template-pack-walkthrough-twenty-eleven-bp-1-5/ by mercime
Twenty Ten Theme – https://codex.buddypress.org/theme-development/theme-dev-bp-template-pack-walkthrough-twenty-ten-bp-1-5/ by mercime

Persian – Farsi (fa_IR)

Persian – Farsi (fa_IR)

Codex Home → Languages and Translations → Persian – Farsi (fa_IR)
Persian – Farsi (fa_IR)

BuddyPress translations can be downloaded at bp-parsi.com while awaiting confirmation at the official translation repository at https://translate.wordpress.org/projects/buddypress/dev/fa/default
Download Persian translation

如何編輯群組後設資料教程

如何編輯群組後設資料教程

Codex Home → BuddyPress Plugin Development → How to Edit Group Meta Tutorial
How to Edit Group Meta Tutorial

This tutorial will show you how to add a custom field to the registration process as well as the admin->」edit details」 section. I will also show you how to print that out into the header and how to echo that data elsewhere.
We are going to do this as a standalone plugin but you could easily add this to your existing plugins or even your functions.php (without the plugin header data)
Firstly create a folder in your wp-contents/plugins folder. Call it whatever you want this plugin to be called. Lets call ours 「Favorite Color」 Then create a file inside. Mines called favorite_color.php Open that file up and start with:


<input id="favorite-color" type="text" name="favorite-color" value="" />

<?php
}

This outputs a label and input field that gets added to the already existing form during registration and editing. That』s why there is no input or other form data.
We created the id and name based upon  whatever we want to name the field. We then call our custom_field() function with that meta data to see if a value already exists. It wont return anything during the signup process but it will afterwards.
// This saves the custom group meta – props to Boone for the function
// Where $plain_fields = array.. you may add additional fields, eg
//  $plain_fields = array(
//      'field-one',
//      'field-two'
//  );
function group_header_fields_save( $group_id ) {
global $bp, $wpdb;
$plain_fields = array(
'favorite-color'
);
foreach( $plain_fields as $field ) {
$key = $field;
if ( isset( $_POST[$key] ) ) {
$value = $_POST[$key];
groups_update_groupmeta( $group_id, $field, $value );
}
}
}

This is a pretty hefty function. It takes the passed data and saves it into the group meta. The reason they use the array and the foreach statement is in the event you want to add multiple fields. It would be a pain to rewrite the code over and over. this way you simply add a comma and a new field name. It then checks to see if there is a post object with the same name. (which if coming from the registration or edit forms we hooked into earlier it will) It then updates the meta accordingly.
Now we hook our functions into BuddyPress:
add_filter( 'groups_custom_group_fields_editable', 'group_header_fields_markup' );
add_action( 'groups_group_details_edited', 'group_header_fields_save' );
add_action( 'groups_created_group',  'group_header_fields_save' );

The first fires any time there is editable fields in BuddyPress and adds our nice input form. The next two are added when any of that data is normally posted and saved.
At this point you should be able to test your plugin. Activate it from the plugin menu and then attempt to create a group. Your field should show up at the bottom. Enter all the data you have and then continue through the process. Once the group is created click admin and look at the edit screen. Your field should be here as well, populated with the data from the registration process.
This next function adds that info to the group header info:
// Show the custom field in the group header
function show_field_in_header( ) {
echo "

My favorite color is:" . custom_field('favorite-color') . "

";
}
add_action('bp_group_header_meta' , 'show_field_in_header') ;

this hooks into the header action and adds our code to the bottom.
Now you can get the group meta using simply groups_get_groupmeta and echo it out wherever you』d like. Just be sure to pass the group_ID or it wont return anything. You can do what I did and use bp_get_group_id() as long as you know you will be in a group loop. I may come back and add more on how to access that data but if you』ve made it this far you have all the tools you』ll need!
Full Code:


<input id="favorite-color" type="text" name="favorite-color" value="" />

<?php }
// This saves the custom group meta – props to Boone for the function
// Where $plain_fields = array.. you may add additional fields, eg
//  $plain_fields = array(
//      'field-one',
//      'field-two'
//  );
function group_header_fields_save( $group_id ) {
global $bp, $wpdb;
$plain_fields = array(
'favorite-color'
);
foreach( $plain_fields as $field ) {
$key = $field;
if ( isset( $_POST[$key] ) ) {
$value = $_POST[$key];
groups_update_groupmeta( $group_id, $field, $value );
}
}
}
add_filter( 'groups_custom_group_fields_editable', 'group_header_fields_markup' );
add_action( 'groups_group_details_edited', 'group_header_fields_save' );
add_action( 'groups_created_group',  'group_header_fields_save' );

// Show the custom field in the group header
function show_field_in_header( ) {
echo "

My favorite color is:" . custom_field('favorite-color') . "

";
}
add_action('bp_group_header_meta' , 'show_field_in_header') ;
}
add_action( 'bp_include', 'bp_group_meta_init' );
/* If you have code that does not need BuddyPress to run, then add it here. */
?>

Props to Charl Kruger for his post: http://charlkruger.com/2011/12/07/getting-started-with-buddypress-group-meta