-
Author
-
October 18, 2013 at 00:05 #4574adamParticipant
Hi – I’ve been trying to figure this out on my own for days, but simply can’t figure it out.
Here is a profile tab that I created in functions.php:
global $bp_tabs;
$bp_tabs = array();$bp_tabs[‘Partner1’] = array(
‘type’ => ‘regular’,
‘name’ => apply_filters(‘kleo_extra_tab2’,__(‘Partner1’, ‘kleo_framework’)),
‘group’ => ‘Partner1’,
‘class’ => ‘regulartab’
);Now instead of having the name be ‘Partner 1’, I would like to have the name called from the user field data like this:
<?php bp_member_profile_data( ‘field=Partner 1: First Name’ )?> so that it will display whatever the user entered on registration under the Partner 1: First Name field.How can I edit the code to achieve this?
Thank you!!!!!
October 18, 2013 at 14:03 #4599SQadminKeymasterHi @adam,
That is interesting and I have created the code you have to enter in your sweetdate-child/functions.phpCOPY CODEadd_action('bp_after_member_header','kleo_my_custom_tab', 0); function kleo_my_custom_tab() { global $bp_tabs; $bp_tabs[] = array( 'type' => 'regular', 'name' => bp_get_member_profile_data( 'field=Test' ), 'group' => bp_get_member_profile_data( 'field=Test' ), 'class' => 'pagetab' ); } /* Add more */ add_action('after_setup_theme','kleo_my_tabs', 1); function kleo_my_tabs() { global $bp_tabs; //remove default tabs $bp_tabs = array(); //add here other tabs as the array examples }
You must remember that you need to replace my “Test” field with your own. And also the value that is inside that field must be a name of a Group of fields.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionOctober 18, 2013 at 22:17 #4628adamParticipantYou’re the BEST! This works perfectly. My only other question is how can I reorder the tabs now?
Here is my final code:
add_action(‘bp_after_member_header’,’kleo_my_custom_tab’, 0);
function kleo_my_custom_tab()
{
global $bp_tabs;$bp_tabs[] = array(
‘type’ => ‘regular’,
‘name’ => bp_get_member_profile_data( ‘field=Partner 1: First Name’ ),
‘group’ => ‘Partner1’,
‘class’ => ‘regulartab’
);$bp_tabs[] = array(
‘type’ => ‘regular’,
‘name’ => bp_get_member_profile_data( ‘field=Partner 2: First Name’ ),
‘group’ => ‘Partner2’,
‘class’ => ‘regulartab’
);
}
/* Add more */
add_action(‘after_setup_theme’,’kleo_my_tabs’, 1);
function kleo_my_tabs() {
global $bp_tabs;
//remove default tabs
$bp_tabs = array();//add here other tabs as the array examples
/* Change About me to About Us & Add Our Photos tab on profile */
$bp_tabs[‘base’] = array(
‘type’ => ‘regular’,
‘name’ => apply_filters(‘kleo_extra_tab2’,__(‘About Us’, ‘kleo_framework’)),
‘group’ => ‘About Us’,
‘class’ => ‘regulartab’
);/* rtMedia tab – only if plugin installed */
if (class_exists(‘RTMedia’))
{
$bp_tabs[‘rtmedia’] = array(
‘type’ => ‘rt_media’,
‘name’ => __(‘Our photos’, ‘kleo_framework’),
‘class’ => ‘mySlider’
);
}
/* Bp-Album tab – only if plugin installed */
elseif (function_exists(‘bpa_init’) AND sq_option(‘bp_album’, 1) == 1)
{
$bp_tabs[‘bp-album’] = array(
‘type’ => ‘bp_album’,
‘name’ => __(‘Our Photos’, ‘kleo_framework’),
‘class’ => ‘mySlider’
);
}The order of tabs is currently: “About Us”, “Our Photos”, Partner1 Name, Partner2 Name
How can I change this to: “About Us”, Partner 1 Name, Partner 2 Name, “Our Photos” ?October 19, 2013 at 23:45 #4672SQadminKeymasterGreat. Just reorder the defined arrays inside the kleo_my_tabs function
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionOctober 21, 2013 at 18:30 #4773adamParticipantSorry – I still can’t get the tabs to reorder. Seems like I am having difficulty because the arrays are in two different functions. Can you paste the code in the correct order based on what I provided above?
I’m trying to change the order of tabs to: “About Us”, Partner 1 Name, Partner 2 Name, “Our Photos”.
Thank you!
October 22, 2013 at 02:10 #4860SQadminKeymasterTry with them in the first function:
COPY CODEadd_action(‘bp_after_member_header’,'kleo_my_custom_tab’, 0); function kleo_my_custom_tab() { global $bp_tabs; $bp_tabs = array(); /* Change About me to About Us & Add Our Photos tab on profile */ $bp_tabs['base'] = array( ‘type’ => ‘regular’, ‘name’ => apply_filters(‘kleo_extra_tab2′,__(‘About Us’, ‘kleo_framework’)), ‘group’ => ‘About Us’, ‘class’ => ‘regulartab’ ); $bp_tabs[] = array( ‘type’ => ‘regular’, ‘name’ => bp_get_member_profile_data( ‘field=Partner 1: First Name’ ), ‘group’ => ‘Partner1′, ‘class’ => ‘regulartab’ ); $bp_tabs[] = array( ‘type’ => ‘regular’, ‘name’ => bp_get_member_profile_data( ‘field=Partner 2: First Name’ ), ‘group’ => ‘Partner2′, ‘class’ => ‘regulartab’ ); /* rtMedia tab – only if plugin installed */ if (class_exists(‘RTMedia’)) { $bp_tabs['rtmedia'] = array( ‘type’ => ‘rt_media’, ‘name’ => __(‘Our photos’, ‘kleo_framework’), ‘class’ => ‘mySlider’ ); } /* Bp-Album tab – only if plugin installed */ elseif (function_exists(‘bpa_init’) AND sq_option(‘bp_album’, 1) == 1) { $bp_tabs['bp-album'] = array( ‘type’ => ‘bp_album’, ‘name’ => __(‘Our Photos’, ‘kleo_framework’), ‘class’ => ‘mySlider’ ); }
Seems the code didn’t copied well. Do the changes in your existing code
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.