Forums

Theme My Login
[resolved] Theme My Login: Use "Welcome" Message as a Link (3 posts)

  1. lauracdd
    Member
    Posted 10 months ago #

    Hi,

    How can I make the "Welcome, Username" message into a link to the user's profile? I've been looking at this section in class-theme-my-login-template.php:

    * Returns action title
    	 *
    	 * @since 6.0
    	 * @access public
    	 *
    	 * @param string $action The action to retrieve. Defaults to current action.
    	 * @return string Title of $action
    	 */
    	function get_title( $action = '' ) {
    
    		if ( is_user_logged_in() ) {
    			$user = wp_get_current_user();
    			$title = sprintf( __( 'Welcome, %s', 'theme-my-login' ), $user->display_name );
    		} else {
    			switch ( $action ) {
    				case 'register':
    					$title = __( 'Register', 'theme-my-login' );
    					break;
    				case 'lostpassword':
    				case 'retrievepassword':
    				case 'resetpass':
    				case 'rp':
    					$title = __( 'Lost Password', 'theme-my-login' );
    					break;
    				}
    		}
    		return apply_filters( 'tml_title', $title, $action );
    	}

    and I use the permalink /profile/ for the user profiles.

    Thanks in advance for your help!

    http://wordpress.org/extend/plugins/theme-my-login/

  2. Jeff Farthing
    Member
    Plugin Author

    Posted 10 months ago #

    Create wp-content/plugins/theme-my-login-custom.php and add the following:

    <?php
    
    function tml_title( $title, $action ) {
    	if ( is_user_logged_in() )
    		$title = '<a href="' . home_url( '/profile' ) . '">' . $title . '</a>';
    	return $title;
    }
    add_filter( 'tml_title', 'tml_title', 10, 2 );
  3. lauracdd
    Member
    Posted 10 months ago #

    Fabulous! Thank you.

Reply

You must log in to post.

About this Plugin

About this Topic