• Resolved eliac7

    (@eliac7)


    Hello,

    I have managed to add a custom tab on the profile menu. At the moment, it is blank. I am trying to get the fields (or the whole form) from a profile form. Just “echo”ing the shortcode of the form doesn’t work. Have anyone managed to get the fields from a profile menu form?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter eliac7

    (@eliac7)

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @eliac7

    Could you please share your code here so we can review?

    Have you tried the following approach?
    echo do_shortcode("<insert shortcode here>");

    Regards,

    Thread Starter eliac7

    (@eliac7)

    Dear Champ,
    Thank you for your reply.

    So, I have created this profile form https://i.imgur.com/xpRhmvj.png (it’s in Greek) and as you can see it, has the shortcode with id 160.
    To add the custom tab on the profiles tab, used this code:

    function um_mycustomtab_add_tab( $tabs ) {
    
    	/* Etairika Stoixeia */
    
    	$tabs['etairika_stoixeia'] = array(
    		'name'            => 'Εταιρικ? Στοιχε?α',
    		'icon'            => 'um-faicon-book',
    		'custom'          => true
    	);
    
    	if ( !isset( UM()->options()->options['profile_tab_' . 'etairika_stoixeia'] ) ) {
    		UM()->options()->update( 'profile_tab_' . 'etairika_stoixeia', true );
    	}
    
    	return $tabs;
    }
    add_filter( 'um_profile_tabs', 'um_mycustomtab_add_tab', 1000 );
    
    /**
     * Render the tab 'Etairika Stoixeia'
     * @param array $args
     */
    function um_profile_content_etairika_stoixeia( $args ) {
        echo do_shortcode('[ultimatemember form_id="160"]	');
    add_action( 'um_profile_content_etairika_stoixeia', 'um_profile_content_etairika_stoixeia' );
    
    

    Where you can see, I “echo” the shortcode. However, this is the issue:

    View post on imgur.com

    It just repeats the whole profile and not just the fields on it. Any ideas?

    Thank you for your time.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @eliac7

    Sorry for the late response.

    Please try extracting this to your active theme:
    https://drive.google.com/file/d/1vRYa90dXBBmXV6I-dKR9eKPRmL11Gu2j/view?usp=sharing

    Once you’ve extracted it, go to the Profile Form settings of the shortcode that you use in the tab and then change the template to “Profile Tab”.

    Please see the screenshot:
    https://drive.google.com/file/d/1MRqtTqit6Kgch1t2QSkmx9HqBaBJxZfa/view?usp=sharing

    Feel free to re-open this thread by changing the topic status to “Not Resolved” so we can get back to you.

    Regards,

    Thread Starter eliac7

    (@eliac7)

    Dear Champ,
    Thanks for the response.

    Well, it does that https://i.imgur.com/MehLoPo.png . It breaks the header, any ideas? I did exactly what you said.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Profile Tab with Fields from a form’ is closed to new replies.