Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 5 years ago

#34356 closed enhancement (wontfix)

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

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

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 11 years ago.
First Patch

Download all attachments as: .zip

Change History (6)

@aubreypwd
11 years ago

First Patch

#1 @aubreypwd
11 years ago

  • Keywords has-patch added

Some related tickets:

#5296 - "Login" used in place of "Log In" (Grammar error)
#1088 - login verb phrase and noun conflict

Last edited 11 years ago by SergeyBiryukov (previous) (diff)

#2 @swissspidy
11 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
11 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
11 years ago

  • Resolutioninvalid
  • Status newclosed

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
11 years ago

  • Milestone Awaiting Review
  • Resolution invalidwontfix
Note: See TracTickets for help on using tickets.