This topic has 5 replies, 2 voices, and was last updated 11 years by SQadmin.

  • Author
  • #4574
     adam
    Participant

    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!!!!!

    #4599
     SQadmin
    Keymaster

    Hi @adam,
    That is interesting and I have created the code you have to enter in your sweetdate-child/functions.php

    COPY 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=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 solution
    #4628
     adam
    Participant

    You’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” ?

    #4672
     SQadmin
    Keymaster

    Great. 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 solution
    #4773
     adam
    Participant

    Sorry – 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!

    #4860
     SQadmin
    Keymaster

    Try with them in the first function:

    COPY CODE
    
    add_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
Viewing 6 posts - 1 through 6 (of 6 total)

The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?