• Resolved itskev

    (@itskev)


    I found where the code is in the shortcodes.php and class-theme-my-login-widget.php to remove Dashboard and Edit My Profile links. Is there a way that I can add code to the theme-my-login-custom.php file to disable them and what would that be? I’m not a coder, per se, but I know how to remove the proper code. I just don’t want an update to those plugin files to overwrite the other files. Thanks!

    • This topic was modified 6 years ago by itskev.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    Thread Starter itskev

    (@itskev)

    Thanks Jeff. I saw that. I’m not sure how that helps me. Instructions say “In order to change the links that display here, consider the following code:”

    So I consider it. That’s it? It would be greatly helpful for the page to tell me more than just to consider it.

    I tried copying that code into a custom php file and removing some of it. Is that considering it? I don’t want to change the code of the two php file and have them written over from an update. This is the content in the custom php file. I removed the profile code from the all other roles.

    <?php
    
    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(
    			'profile'   => array(
    				'title' => __( 'Profile' ),
    				'url'   => admin_url( 'profile.php' ),
    			),
    			'logout'    => array(
    				'title' => __( 'Log Out' ),
    				'url'   => wp_logout_url(),
    			),
    		);
    
    	// These are for all other roles
    	} else {
    		$links = array(
    			'logout'    => array(
    				'title' => __( 'Log Out' ),
    				'url'   => wp_logout_url(),
    			),
    		);
    	}
    
    	return $links;
    }
    add_filter( 'tml_widget_user_links', 'filter_tml_widget_user_links' );
    Plugin Author Jeff Farthing

    (@jfarthing84)

    You’ll want to place the code in theme-my-login-custom.php.

    Thread Starter itskev

    (@itskev)

    Thanks Jeff. I did that, but it didn’t change anything when I took out part of it. I ended up taking it out of the two php files that governed it. I would rather use that custom php file but as of right now, it doesn’t work.

    Plugin Author Jeff Farthing

    (@jfarthing84)

    Can you confirm where you placed that file?

    Thread Starter itskev

    (@itskev)

    The file is located:
    wp-content/plugins/theme-my-login/theme-my-login-custom.php

    Thread Starter itskev

    (@itskev)

    Apparently, I am supposed to put this php file here:
    wp-content/plugins/

    And that was my issue.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Remove User Panel Links’ is closed to new replies.