Skip Navigation

[Resolved] Réinitialisation du mot de passe imposée par WordPress lors de la 1ère connexion

This support ticket is created 3 years, 5 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 9 replies, has 3 voices.

Last updated by frederiqueC 3 years, 5 months ago.

Assisted by: Waqar.

Author
Posts
#2146553

Bonjour,
Comme vous voyez je suis française, je ne parviens pas à empêcher la réinitialisation du mot de passe par wordpress lors de la première connexion d'un membre. Je fais en sorte que le mot de passe soit généré par Toolset mais WordPress demande de le modifier dans l'interface wordpress. Ce qui me gêne.
Comment peut-on interdire cette réinitialisation ou modifier l'interface de cette réinitialisation afin de ne pas voir le logo wordpress s'afficher?
Cordialement

#2146677

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Our supporter who speaks French is not currently available but will return on Sunday.

Let us know if you would like to wait for him to become available, or please update here with your question in English if you want help before then.

#2146765

Hi Nigel,
here is the translation of my message.

I am having trouble preventing wordpress from resetting password when a member logs in for the first time. I am making the password generated by Toolset but WordPress is asking for the modifier in the wordpress interface. What bother me.
How can we prohibit this reset or modify the interface of this reset so as not to see the wordpress logo displayed?

Then, in the user form for community registration, I would like to make the fields "last name" and "first name" mandatory.
How do I go about it?

Sorry if the translation is wrong. I use google translation.

Thank you for your reply

#2147471

Hi,

Thank you for sharing these details.

From your other ticket, I understand that the password reset issue is sorted now.
( ref: https://toolset.com/forums/topic/password-reset-imposed-by-wordpress-during-the-1st-connection/#post-2147443 )

Since, there is no built-in option available to make the first and the last name fields required, you'll need to add some custom code for this:
( ref: https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate )


add_filter('cred_form_validate','first_last_name_validation',10,2);
function first_last_name_validation($error_fields, $form_data)
{
	//field data are field values and errors
	list($fields,$errors)=$error_fields;
	//validate if specific form
	if ($form_data['id']==12345)
	{
		//check if first_name field value is empty
		if (empty($fields['first_name']['value']))
		{
			//set error message for first_name field
			$errors['first_name']='First name is required';
		}
		//check if last_name field value is empty
		if (empty($fields['last_name']['value']))
		{
			//set error message for last_name field
			$errors['last_name']='Last name is required';
		}
	}
	return array($fields,$errors);
}

Note: Please replace '12345' with the actual ID of your user form.

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 the active theme's "functions.php" file.

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

regards,
Waqar

#2147587

I have tried everything (custom content is not possible from the Toolset plugin) (adding js code via the functions.php file) but it does not work or makes the site buggy.
I think I'm stuck at the functions.php file. I use the ocean wp theme because it is constructor.
What should I do ?

#2147677

Thanks for writing back.

Can you please share temporary admin login details, so that I can see how this custom code has been added to the theme?

Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.

Please also share the link to the page where this user form is added.

#2148211

Hello,
I realized that I added some PHP code in JS editors. I left it for the moment so that you can see my contributions (even unnecessary). Of course, this is not efficient and I still don't know how to edit custom code in the toolset plugin.
Thanks for your help.

#2149269

Thank you for sharing the admin access.

The PHP code, that I shared in my last message won't work from the "JS editor".

I've removed that PHP code from the form's "JS editor" and added this custom script:


jQuery( document ).ready(function() {
jQuery("input[name=first_name]").prop('required',true);
jQuery("input[name=last_name]").prop('required',true);
});

This script will make sure that the form can't be submitted without entering the first and last name.

As for the Toolset's custom code feature, it is not working on your website, because the security plugin seems to have set the "DISALLOW_FILE_EDIT" and "DISALLOW_FILE_MODS" constants to 'true'.

To use that feature, you can edit the website's "wp-config.php" file and make sure that the "DISALLOW_FILE_EDIT" and "DISALLOW_FILE_MODS" constants are set to "false".
https://wordpress.org/support/article/editing-wp-config-php/

#2149475

OK
Understood !
I put that my problem is solved.
Thank you for your help.

#2149477

My issue is resolved now. Thank you!