Support » Plugin: Theme My Login » Adding custom link dashboard doesn’t work

  • Resolved comsud

    (@comsud)


    Hi there,

    I’m trying to add custom link to the dashboard like this :

    
    function filter_tml_widget_user_links( $links ) {
    	$user = wp_get_current_user();
    
    	$role = reset( $user->roles );
    	if ( empty( $role ) ) {
    		$role = 'subscriber';
    	}
    	if ( is_super_admin() ) {
    		$role = 'administrator';
    	}
    
    	// These links are for authors, editors and admins
    	if ( in_array( $role, array( 'author', 'editor', 'administrator' ) ) ) {
    		$links = array(
    			'dashboard' => array(
    				'title' => __( 'Dashboard' ),
    				'url'   => admin_url(),
    			),
    			'profile'   => array(
    				'title' => __( 'Profile' ),
    				'url'   => admin_url( 'profile.php' ),
    			),
    			'logout'    => array(
    				'title' => __( 'Log Out' ),
    				'url'   => wp_logout_url(),
    			),
    			'test'       => array(
    				'title' => 'Test',
    				'url' => home_url( '/test' ),
    			),
    		);
    
    	// These are for all other roles
    	} else {
    		$links = array(
    			'foo'       => array(
    				'title' => 'Foo',
    				'url' => home_url( '/foo' ),
    			),
    			'profile'   => array(
    				'title' => __( 'Profile' ),
    				'url'   => admin_url( 'profile.php' ),
    			),
    			'logout'    => array(
    				'title' => __( 'Log Out' ),
    				'url'   => wp_logout_url(),
    			),
    		);
    	}
    
    	return $links;
    }
    add_filter( 'tml_widget_user_links', 'filter_tml_widget_user_links' );
    

    But nothing is happening

    Is there something I’m doing wrong ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Just for say that I already trying to disabled all plugins and changing theme. Problem still here. Nothing happend.

    Plugin Author Jeff Farthing

    (@jfarthing84)

    The Dashboard links have a different filter applied called tml_dashboard_links.

    comsud

    (@comsud)

    Yes thanks!
    I found it by delving into the plugin !

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.