Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 3 years ago

#34356 closed enhancement (wontfix)

I should be able to change the Login/Logout text in wp_loginout()

Reported by: aubreypwd's profile aubreypwd Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: Login and Registration Keywords: has-patch close
Focuses: Cc:

Description

E.g.

<?php
function my_login_text( $text ) {
        return __( "My Login" );
}

add_filter( 'login_text', 'my_login_text' );

function my_logout_text( $text ) {
        return __( "My Logout" );
}

add_filter( 'logout_text', 'my_logout_text' );

Attachments (1)

5296.diff (1.3 KB) - added by aubreypwd 9 years ago.
First Patch

Download all attachments as: .zip

Change History (6)

@aubreypwd
9 years ago

First Patch

#1 @aubreypwd
9 years ago

  • Keywords has-patch added

Some related tickets:

https://core.trac.wordpress.org/ticket/5296 - "Login" used in place of "Log In" (Grammar error)
https://core.trac.wordpress.org/ticket/1088 - login verb phrase and noun conflict

Version 0, edited 9 years ago by aubreypwd (next)

#2 @swissspidy
9 years ago

There's already the loginout filter you can use to completely customize the link. There's also the universal gettext filter to override internationalized strings.

Since the function is so simple, just creating your own or using the loginout filter is much easier than adding two separate filters that only change the text. Core only uses the function in the Meta widget, so that'd be trivial.

#3 @johnbillion
9 years ago

  • Keywords close added

Out of interest, what do you *actually* want to change the text to in your use-case? (Note that "Login" is a noun, and "Logout" isn't a real word).

I don't think a filter here has much value.

#4 @aubreypwd
9 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Closing, valid points. @johnbillion, "Sign-in" in this particular case.

Was able to use:


function my_login_menu_customize( $link ) {

        if ( ! is_user_logged_in() ) {
                return sprintf( '<a href="%s">%s</a>', wp_login_url(), __( 'Sign-in' ) );
        } else {
                return sprintf( '<a href="%s">%s</a>', wp_logout_url(), __( 'Sign-out' ) );
        }

        return $link;
}
add_filter( 'loginout', 'my_login_menu_customize' );

#5 @johnbillion
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution changed from invalid to wontfix
Note: See TracTickets for help on using tickets.