This topic has 5 replies, 5 voices, and was last updated 8 years by Chillibabe.
-
Author
-
December 10, 2014 at 18:44 #38458LauraModerator
SINCE Sweetdate Version 2.8 the profile tabs are handled from WP ADMIN – Sweetdate – BP Profile Tabs.
The codes below can also be used if you want to do it programmatically.Hello, this is an explained guide to create custom tabs in functions.php ,because when changing field group names, the code doesnt find them, so it doesnt shows it. You need the custom code to create it with your own names.
FROM ADMIN PANEL
1. Go to Sweetdate > BP Profile Tabs
2. Enable the Group of Fields you want.
3. Edit the Label.
4. Choose the Style
5. Save.
Check out Attachments.WITH CUSTOM CODES
For that just add this code to your functions.php in your child theme:
Please read the comments inside of the code for more explanations.COPY CODE//Profile tabs add_action('after_setup_theme','kleo_my_custom_tabs'); function kleo_my_custom_tabs() { global $bp_tabs; $bp_tabs = array(); /* This is the code you need to use as a base for each profile tab, the display changes if you use Regular type or Cite tab, cite is a quote, bigger style for a lot of text, while regular is small When wanting to change the style, change it at type and class , citetab , regulartab You can start to copy the custom code from here */ $bp_tabs['CUSTOMGROUP'] = array( 'type' => 'regular', 'name' => __('CUSTOMGROUP', 'kleo_framework'), 'group' => 'CUSTOMGROUP', 'class' => 'regulartab' ); /* To here, the above code is what you need to copy and paste to make new tabs. The order of the tabs changes as it is in the code. */ $bp_tabs['Beskriv dig selv'] = array( 'type' => 'regular', 'name' => __('Beskriv dig selv', 'kleo_framework'), 'group' => 'Beskriv dig selv', 'class' => 'regulartab' ); /* rtMedia tab - only if plugin installed */ if (class_exists('RTMedia')) { $bp_tabs['rtmedia'] = array( 'type' => 'rt_media', 'name' => __('Photos', 'kleo_framework'), 'class' => 'mySlider' ); } /* Bp-Album tab - only if plugin installed */ elseif (function_exists('bpa_init')) { $bp_tabs['bp-album'] = array( 'type' => 'bp_album', 'name' => __('My photos', 'kleo_framework'), 'class' => 'mySlider' ); } }
You need to use the custom tab i added, for each of them, remember both the name should be the exact name as the group in user fields.
A quick list of what i explained in the code:
1. Custom field base code (Add before } and after );
COPY CODE$bp_tabs['CUSTOMGROUP'] = array( 'type' => 'regular', 'name' => __('CUSTOMGROUP', 'kleo_framework'), 'group' => 'CUSTOMGROUP', 'class' => 'regulartab' );
2. The names should be the same as the are in Users > Profile Fields ( name=> doesnt really need to be the same, but better put it.)
3. Styles, (in Attachment 1) You can easy change how the tabs will look by changing “type” and “class”:
Tab Style 1 :COPY CODE$bp_tabs['CUSTOMGROUP'] = array( 'type' => 'regular', 'name' => __('CUSTOMGROUP', 'kleo_framework'), 'group' => 'CUSTOMGROUP', 'class' => 'regulartab' );
Tab Style 2 :
COPY CODE$bp_tabs['CUSTOMGROUP'] = array( 'type' => 'cite', 'name' => __('CUSTOMGROUP', 'kleo_framework'), 'group' => 'CUSTOMGROUP', 'class' => 'citetab' );
4. Order of the tabs, it can be changed as it is in the code, if tab “Base” is up and “Style” is down, in the code, it will look like that in the website, but “Base” first, then next “Style”
Laura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
Attachments:
You must be logged in to view attached files.January 18, 2015 at 14:21 #42506veggistParticipantI have tried using this now, in my puctions.php in child theme, using the frase “DIETT” insted of “CUSTOMGROUP”, but I got no option for “DIETT” in my form.
Here´s what in my functions.php now:
<?php
/**
* @package WordPress
* @subpackage Sweetdate
* @author SeventhQueen <themesupport@seventhqueen.com>
* @since Sweetdate 1.0
*//**
* Sweetdate Child Theme Functions
* Add extra code or replace existing functions
*/
add_action( ‘admin_init’, ‘redirect_non_admin_users’ );
/**
* Redirect non-admin users to home page
*
* This function is attached to the ‘admin_init’ action hook.
*/
function redirect_non_admin_users() {
if ( ! current_user_can( ‘manage_options’ ) && ‘/wp-admin/admin-ajax.php’ != $_SERVER[‘PHP_SELF’] ) {
wp_redirect( home_url() );
exit;
}
}
//Profile tabsadd_action(‘after_setup_theme’,’kleo_my_custom_tabs’);
function kleo_my_custom_tabs()
{
global $bp_tabs;
$bp_tabs = array();
/* This is the code you need to use as a base for each profile tab, the display changes if you use
Regular type or Cite tab, cite is a quote, bigger style for a lot of text, while regular is small
When wanting to change the style, change it at type and class , citetab , regulartab
You can start to copy the custom code from here */
$bp_tabs[‘DITETT’] = array(
‘type’ => ‘regular’,
‘name’ => __(‘DITETT’, ‘kleo_framework’),
‘group’ => ‘DIETT’,
‘class’ => ‘regulartab’
);
/* To here, the above code is what you need to copy and paste to make new tabs.
The order of the tabs changes as it is in the code. *//* rtMedia tab – only if plugin installed */
if (class_exists(‘RTMedia’))
{
$bp_tabs[‘rtmedia’] = array(
‘type’ => ‘rt_media’,
‘name’ => __(‘Photos’, ‘kleo_framework’),
‘class’ => ‘mySlider’
);
}/* Bp-Album tab – only if plugin installed */
elseif (function_exists(‘bpa_init’)) {
$bp_tabs[‘bp-album’] = array(
‘type’ => ‘bp_album’,
‘name’ => __(‘My photos’, ‘kleo_framework’),
‘class’ => ‘mySlider’
);
}}
?>
And I attached a screenshot of my Buddypress settings page to show how it is now.
What am I doing wrong?Attachments:
You must be logged in to view attached files.February 26, 2015 at 12:25 #47703abidjan-lovesParticipantHello, i trying to add Bp-Album tab without success 🙂
may be i miss sometihng using this code …
Can you help me.
Regards,August 10, 2015 at 22:19 #72486kurtisblowParticipantIt’s not working for me in version 2.8.4. I tried everything, also added the code from top in the child theme functions.php but still no success. I thought it should be possible now just to adjust the BP Profile Tabs? On my profile site I can only see my primary profile field, all other fields are not shown. I made some screenshots:
Best Regards:
SebastianAttachments:
You must be logged in to view attached files.August 11, 2015 at 09:21 #72536kurtisblowParticipantI got it, was too simple, I just forgot to add informations in the other profil sections, tought that should not be necessary to just see the menu buttons.
May 19, 2016 at 03:07 #122342ChillibabeParticipantHi Laura,
I seem to be having a BP Profile tab issue. I enabled the profile tabs but they do not show up on the website except for the default one, About Me. I tried to refresh the page severally with no success. Kindly assist me. Thank you. -
AuthorPosts
You must be logged in to reply to this topic.