This topic has 8 replies, 2 voices, and was last updated 10 years by Abe.

  • Author
  • #11407
     studiblog
    Participant

    Yes, i know there are 2 other topics with the same questions. I did all changes in the functions.php (child theme) but nothing happen. I have a profile field called “Lifestyle”
    I added the code to the END of my functions.php
    Thats my whole functions.php, do you see any issue why it does not work?

    COPY CODE
    
    <?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( "init", "kleo_blockusers_init" );
    function kleo_blockusers_init() {
        if ( is_admin() AND ! current_user_can( "administrator" ) AND
           ! ( defined( "DOING_AJAX" ) AND DOING_AJAX ) ) {
            wp_redirect( home_url() );
            exit;
        }
    }
    /* Filter the redirect url for login*/
    add_filter("login_redirect","kleo_redirect_to_profile",100,3);
     
    function kleo_redirect_to_profile($redirect_to_calculated,$redirect_url_specified,$user){
    /*if no redirect was specified,let us think ,user wants to be in wp-dashboard*/
        if(!is_super_admin($user->ID))
            return bp_core_get_user_domain($user->ID );
        else
            return $redirect_to_calculated; /*if site admin*/
    }
        // Filter wp_nav_menu() to add profile link
        add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' );
        function my_nav_menu_profile_link($menu) {      
                if (!is_user_logged_in())
                        return $menu;
                else {
                        $profilelink = '<li><a href="' . bp_loggedin_user_domain( '/' ) . '" rel="nofollow">' . __('Profile') . '</a></li>';
                        $menu = $menu . $profilelink;
                        return $menu;
                 }
        }
    add_action('user_register', 'kleo_pmpro_default_level');
    function kleo_pmpro_default_level($user_id) {
        pmpro_changeMembershipLevel(1,$user_id);
    }
    // redirect to registration page instead of membership levels page
    add_filter('kleo_pmpro_url_redirect', 'my_custom_redirect');
    
    function my_custom_redirect() {
    	if (is_user_logged_in()) {
    		return pmpro_url("levels");
    	} else {
    		return bp_get_signup_page();
    	}
    add_action('after_setup_theme','kleo_my_actions');
    
    function kleo_my_actions() 
    {
        global $bp_tabs;
    $bp_tabs['lifestyle'] = array(
    ‘type’ => ‘regular’,
    ‘name’ => __(‘Lifestyle’, ‘kleo_framework’),
    ‘group’ => ‘Lifestyle’,
    ‘class’ => ‘regulartab’
    );
    }
    }
    
    ?>
    
    #11550
     Abe
    Keymaster

    Hi, Make sure you don’t have any spaces and the end in the field name in Users – Profile fields
    and you are missing one line in the function. THis is correct

    COPY CODE
    
    // Add another tab
    add_action('after_setup_theme','kleo_my_actions');
    function kleo_my_actions() 
    {
    	global $bp_tabs;
    	$bp_tabs['lifestyle'] = array(
    		'type' => 'regular',
    		'name' => __('Lifestyle', 'kleo_framework'),
    		'group' => 'Lifestyle',
    		'class' => 'regulartab'
    	);
    	return $bp_tabs;
    }
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #11581
     studiblog
    Participant

    Thanks for your help, but the lifestyle tab does not appear.
    There are no spaces in the Field name in User-Profile fields.
    The “looking for” tab was shown but i delated this tab a week ago in User-Profile fields, because I don’t need it. I have no idea whats wrong.
    Do you want ftp access or backend access?
    By the way: I added the folder page-parts to my childtheme. Is there also regulary a functions.php in the page-parts folder? Because there is one in my folder with elements from the “normal” functions.php
    I am a bit confused how this could happen.

    #11694
     Abe
    Keymaster

    if you deleted the Looking for Group then there is no way it will appear 🙂
    Tabs are in fact Profile Groups
    there should be only one functions.php in your sweetdate-child folder and it should be empty or just have custom codes you add(nothing from the parent theme)

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #11711
     studiblog
    Participant

    hmpf… I did not know that I can not change Profile groups. I added a “looking for” group again, but nothing happened. I guess I delated some basic code with delating the “Looking for” group, so can you tell me which file i have to replace to restore the original “Looking for” group. I have backups…
    with the functions.php, that was a copy&paste mistake, now I have only one functions.php in my child theme. (the one you can see above)
    Thanks a lot

    #11896
     Abe
    Keymaster

    Yes you can change them but then you need to change which one you want to display as tabs next to profile using the code above. Make sure the new added field has the exact name as in the code

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #11897
     Abe
    Keymaster

    From Sweetdate – Buddypress you can do the import again of profile fields

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #11949
     studiblog
    Participant

    Ok thank, I imported the hole folder “bbpress” in sweetdate. This works, now I have the 3 basic profile groups again.
    https://www.dropbox.com/s/m4goxxw2vwgkkcd/Bildschirmfoto%202014-03-05%20um%2010.35.44.png

    Then I used the code you gave me in #11550, but the Lifestyle Tab does not appear.

    The code to change the order of the tabs (I want the About me tab first) in this thread does not work for me too: https://archived.seventhqueen.com/forums/topic/how-to-add-more-tabs-next-to-the-profile-image
    I used the code like in #1311.
    This is very weird.

    #12282
     Abe
    Keymaster

    Please make sure you have the child theme active… I really can’t tell what you are doing wrong. It is not that hard to change those codes if you have really basic PHP knowledge

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Add Profile tabs’ is closed to new replies.

Log in with your credentials

Forgot your details?