• Resolved pare81

    (@pare81)


    Hi Guys,
    Nice to see the version 2 of your plugin is out. Thanks for this.
    Could you please halp me with the snippet to extend the profile tabs?

    /* First we need to extend main profile tabs */
    
    add_filter('um_profile_tabs', 'add_custom_profile_tab', 1000 );
    function add_custom_profile_tab( $tabs ) {
    
    	$tabs['mycustomtab'] = array(
    		'name' => 'My custom tab',
    		'icon' => 'um-faicon-comments',
    	);
    		
    	return $tabs;
    		
    }
    
    /* Then we just have to add content to that tab using this action */
    
    add_action('um_profile_content_mycustomtab_default', 'um_profile_content_mycustomtab_default');
    function um_profile_content_mycustomtab_default( $args ) {
    	echo 'Hello world!';
    }

    This snippet from your developers guide dosn’t work anymore ??

    Thanks and regards
    Pare

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support mansurahamed

    (@mansurahamed)

    Hi @pare81,

    For UM 2.0 custom profile tabs there must be an additional code line inserted to $tabs array at add_custom_profile_tab function , ‘custom’ => true, . Example

    function add_custom_profile_tab( $tabs ) {
    
    	$tabs['mycustomtab'] = array(
        'name' => 'My custom tab',
        'icon' => 'um-faicon-comments',
        'custom' => true,
    );
    		
    	return $tabs;
    		
    }

    Thank you.

    Good to see that detail on creating custom tabs for the profile.

    Are we still stuck with ?profiletab=mycustomtab it seems trying any other name just doesn’t work. for example…

    $tabs[‘certification_status’] = array(…

    simply breaks. Ideas?

    Thanks!

    -Michael

    Plugin Support mansurahamed

    (@mansurahamed)

    Hi @mkstebbins ,

    Could you please share your code? It works for other names for sure. I must have a look at your code to see why it’s not working.

    Thanks.

    Sure, Thanks. I take the example code from github etc, and change what we hope are the relevant names as such. And now… it works ??

    The thread on Github suggested to change *all* occurrences of “mycustomtab” but it appears that um_ actions that contain that cannot change.

    /*   extend main profile tabs for certification_status */
    add_filter('um_profile_tabs', 'add_custom_profile_tab', 1000 );
    function add_custom_profile_tab( $tabs ) {
    	$tabs[certification_status] = array(
    		'name' => Certification Status,
    		'icon' => 'um-faicon-comments',
    	);
    			return $tabs;
    }
    
    /* Then add content to that tab   */
    add_action('um_profile_content_mycustomtab_default','um_profile_content_certification_status_default');
    function um_profile_content_certification_status_default( $args ) {
    	echo 'Hello Certification Status!';
    }
    Plugin Support mansurahamed

    (@mansurahamed)

    Hi @mkstebbins,

    You had some errors in code. Please try this,

    `add_filter(‘um_profile_tabs’, ‘add_custom_profile_tab’, 1000 );
    function add_custom_profile_tab( $tabs ) {
    $tabs[‘certification_status’] = array(
    ‘name’ => ‘Certification Status’,
    ‘icon’ => ‘um-faicon-comments’,
    ‘custom’ => true,
    );
    return $tabs;
    }

    /* Then add content to that tab */
    add_action(‘um_profile_content_certification_status_default’,’um_profile_content_certification_status_default’);
    function um_profile_content_certification_status_default( $args ) {
    echo ‘Hello Certification Status!’;
    }’

    Thank you.

    Thanks @mansurahamed. That did the trick.

    Key difference being that we rename the um_profile_content_mycustomtab_default action and also add the ‘custom’ => true,

    Thanks for the insights.

    -Michael

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘UM2.0 Profile Tabs’ is closed to new replies.