BuddyPress: hook to add new profile fields and groups

Well seems like not many people are digging into BP so here is the solution I found. To add a new field group using BP hooks: // Create new Field Group $group_args = array( ‘name’ => ‘Social Networks’ ); $group_id = xprofile_insert_field_group( $group_args ); // group’s ID To add some fields to this new group: … Read more

BuddyPress: Adding a new tab in groups

There’s an example of this on the buddypress forums which is a good place to start looking for answers. http://buddypress.org/community/groups/creating-extending/forum/topic/can-someone-explain-how-to-add-tabs-to-the-profile-page/ For the sake of answering here though here goes: bp_core_new_subnav_item( array( ‘name’ => ‘My Group Page’, ‘slug’ => ‘my-group-page’, ‘parent_url’ => $bp->loggedin_user->domain . $bp->groups->slug . “https://wordpress.stackexchange.com/”, ‘parent_slug’ => $bp->groups->slug, ‘screen_function’ => ‘my_groups_page_function_to_show_screen’, ‘position’ => 40 … Read more

Add BuddyPress Profile Menu Item [closed]

Here’s an example of adding a menu items pointing to custom templates. If you want to link to existing BP elements, you’ll need to look up the appropriate action. Add this to functions.php: // Set up Cutsom BP navigation function my_setup_nav() { global $bp; bp_core_new_nav_item( array( ‘name’ => __( ‘Item One’, ‘buddypress’ ), ‘slug’ => … Read more

BuddyPress: Allow only one email domain to register

Finally, I found the solution. Here is the code if anyone has the same issue and want to refer it. Using Action function wf_validate_email_domain() { global $bp; $email = $bp->signup->email; $email_exploded = explode(‘@’, $email); // split on @ and return last value of array (the domain) $domain = array_pop($email_exploded); $email_domains = get_option(‘allowed_email_domains’); $allowed_email_domains = array_map(‘trim’, … Read more

How to get a buddypress user profile link and a certain user profile field for the current post author?

For an author’s profile link, use bp_core_get_user_domain( $user_id ) to get the URL, and bp_core_get_userlink( $user_id ) to get an HTML link element, including display name. For the xprofile data, use xprofile_get_field_data( $field, $user_id ) $field can be either the name of the field (like ‘Biography’) or the numerical field id.