Skip Navigation

[Resolved] There is inconsistency about labels of login forms

This support ticket is created 3 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 5 replies, has 2 voices.

Last updated by kutay 3 years, 9 months ago.

Assisted by: Waqar.

Author
Posts
#1709459
Ekran Resmi 2020-07-17 05.47.10.png
Ekran Resmi 2020-07-17 05.46.54.png
Ekran Resmi 2020-07-17 05.46.07.png
Ekran Resmi 2020-07-17 05.44.06.png
Ekran Resmi 2020-07-17 05.43.58.png
Ekran Resmi 2020-07-17 05.43.48.png

Hi

It's little bit complicated, I hope I can explain the issue with help of screenshots. Please examine screenshots deeply, it doesn't matter that you can't speak Turkish, you know all the items and you can match the strings. Now let me start.

Login page that I created via Toolset semi English and semi Turkish. I only follow instructions that you shared, no other settings.

After short search I saw as you're explained to other customers that your login forms' labels are same as WordPress native login forms' labels (I'm using plural because I count "forgot password" form as also login form additionally). Whatever, with this information I checked wp-login.php file then I realized there is no "Username or Email" label. Instead of this, there is "Username or Email Address" and it's translated already and works in wp-login page. Besides - it's strange - password and submit is translated in Turkish on toolset login form same as WordPress login page

When I'm look at lost password page that I created with toolset, submit button is English (unlike the toolset login form). But WordPress native one is Turkish as it's supposed to be in frontend, in .po language file . And when I'm changing value of related part in wp-login.pgp file it adapts itself on WordPress native lost password page but it doesn't adapt itself in toolset lost password page. This means they're not coming same place as you mentioned lots of support ticket.

Am I wrong?
Can you help me? Because this with this examination, I don't have any idea to fix the labels.

Ciao
Kutay

#1709869

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

Your observation is correct and although the Toolset's login, forgotten password, and password reset forms are constructed using the same functionality as WordPress, the involved text labels are not controlled by WordPress.

These forms use their own default values, which are filterable, as needed.

1. For the login form ( [wpv-login-form] ), you can use the filter "login_form_defaults":

Example:


function login_form_defaults_custom( $defaults ) {

	$defaults = array(
		'echo'				=> true,
		'redirect'			=> ( is_ssl() ? '<em><u>hidden link</u></em>' : '<em><u>hidden link</u></em>' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
		'redirect_fail'		=> '',
		'form_id'			=> 'loginform',
		'label_username'	=> __( 'Username or Email', 'wpv-views' ),
		'label_password'	=> __( 'Password' ),
		'label_remember'	=> __( 'Remember Me' ),
		'label_log_in'		=> __( 'Log In' ),
		'id_username'		=> 'user_login',
		'id_password'		=> 'user_pass',
		'id_remember'		=> 'rememberme',
		'id_submit'			=> 'wp-submit',
		'remember'			=> true,
		'value_username'	=> isset( $_REQUEST['username'] ) ? $_REQUEST['username'] : '',
		'value_remember'	=> false,
	);

	return $defaults;
}
add_filter( 'login_form_defaults', 'login_form_defaults_custom' );

2.. For the forgotten password form ( [wpv-forgot-password-form] ), you can use the filter "forgot_password_form_defaults":

Example:


function forgot_password_form_defaults_custom( $defaults ) {

	$defaults = array(
		'redirect'			=> ( is_ssl() ? '<em><u>hidden link</u></em>' : '<em><u>hidden link</u></em>' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
		'redirect_fail'		=> ( is_ssl() ? '<em><u>hidden link</u></em>' : '<em><u>hidden link</u></em>' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
		'reset_password'	=> '',
		'form_id'			=> 'forgotpasswordform',
		'label_username'	=> __( 'Username or Email', 'wpv-views' ),
		'id_username'		=> 'user_login',
		'label_submit'		=> __( 'Get New Password', 'wpv-views' ),
		'id_submit'			=> 'wp-submit',
		'value_username'	=> isset( $_REQUEST['username'] ) ? $_REQUEST['username'] : '',
	);
	
	return $defaults;
}
add_filter( 'forgot_password_form_defaults', 'forgot_password_form_defaults_custom' );

3. For the password reset form ( [wpv-reset-password-form] ), you can use the filter "reset_password_form_defaults":

Example:


function reset_password_form_defaults_custom( $defaults ) {

	$defaults = array(
		'redirect'			=> ( is_ssl() ? '<em><u>hidden link</u></em>' : '<em><u>hidden link</u></em>' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
		'redirect_fail'		=> ( is_ssl() ? '<em><u>hidden link</u></em>' : '<em><u>hidden link</u></em>' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
		'form_id'			=> 'resetpasswordform',
		'label_pass1'		=> __( 'New password', 'wpv-views' ),
		'id_pass1'			=> 'pass1',
		'label_pass2'		=> __( 'Repeat new password', 'wpv-views' ),
		'id_pass2'			=> 'pass2',
		'label_submit'		=> __( 'Reset Password', 'wpv-views' ),
		'id_submit'			=> 'wp-submit',
		'rp_login'			=> '',
		'rp_key'			=> ''
	);
	
	return $defaults;
}
add_filter( 'reset_password_form_defaults', 'reset_password_form_defaults_custom' );

The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through active theme's "functions.php" file. You can adjust the default text label values in them and then also have them translated through the .po language file.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1710301

Hi, thanks I tried on login form, it worked but on forgotten password and reset password codes didn't work.

And I just wonder what's directory of .po file that you mentioned because it looks like I will need it to edit.

my login form items was at first:
- Username or Email (English)
- Parola (Turkish) - means Password
- Giriş (Turkish) - means Submit or Login, depends place that used in

first i copied of your all php code for login form then changed just
'label_username' => __( 'e-Posta', 'wpv-views' ),
it worked.

Same codes contains
'label_password' => __( 'Password' ),
'label_log_in' => __( 'Log In' ),

at first I didn't change these label, just label_username. "Password" and "Log In" was in Turkish already in live view. Curiosity, then I changed

'label_log_in' => __( 'Log In' ), as 'label_log_in' => __( 'Giriş Yap' ), then cleared cache and reload page. Submit button is now "Giriş Yap". "Giriş Yap" and "Giriş" have same meanings in Turkish but different strings, do you see?

Then I changed back label value as 'label_log_in' => __( 'Log In' ), cleared cache then reload page. Submit button is "Log In", you see, not "Giriş" as first place.

Because of this I want to edit .po file and I need to see it works to have strong steps for future improvements that this site might need.

#1710357

Sorry my bad, it works on forgotten password form and reset password form, too. I forgot to activate custom code 🙂 Sorry

My other question still remains.

#1713407

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for sharing the update and glad that it worked.

For the translation file (.po), you can localize/translate these custom labels added through the filters, using the active theme's translation files.

After adding those code snippets in the active theme's "functions.php" file, when you'll update the theme's language file through an editor like "Poedit" ( hidden link ), those new labels/strings will be available for translation too.
( example screenshot: hidden link )

Here is a useful guide on using "Poedit" to translate a WordPress theme:
hidden link

regards,
Waqar

#1714929

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.