• Resolved holdusback

    (@holdusback)


    Hey there,

    I use you’re plugin to add NEW user to my website.

    So I send them a mail with **lostpasswordurl** To let the user choose a password.

    But I’ve saw that the reset password has a timestamp :

    The key expire 24h after I added the .csv with the new user.

    My question :

    How I can customize the expire time from 24h to 1week ?

    Want this to let them have some time to see my mail and, choose a password.

    Thanks for you’re awesome & usefull plugin !

    Have a good weekend.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Javier Carazo

    (@carazo)

    @holdusback,

    Good evening, this is not really a functinality of this plugin.

    This is a WordPress core functinality and I have been looking for it but I have not found too much.

    If someone know something about it, please help us.

    Thread Starter holdusback

    (@holdusback)

    Thanks for you’re quick answer.

    All I’ve found is this :

    https://wordpress.stackexchange.com/questions/296846/change-default-recovery-link-expiration-time?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

    But for now, I have more than 1K user with a reset pass link expired…

    Dont really know how to deal with this

    Plugin Author Javier Carazo

    (@carazo)

    @holdusback,

    As I have seen in the code, you can use this one now.

    Because the check is done making a sum of the sending key date plus this data.

    So this will be ok for you.

    Look for this one in the core:

    /**
    	 * Filters the expiration time of password reset keys.
    	 *
    	 * @since 4.3.0
    	 *
    	 * @param int $expiration The expiration time in seconds.
    	 */
    	$expiration_duration = apply_filters( 'password_reset_expiration', DAY_IN_SECONDS );
    
    	if ( false !== strpos( $row->user_activation_key, ':' ) ) {
    		list( $pass_request_time, $pass_key ) = explode( ':', $row->user_activation_key, 2 );
    		$expiration_time = $pass_request_time + $expiration_duration;
    	} else {
    		$pass_key = $row->user_activation_key;
    		$expiration_time = false;
    	}
    Thread Starter holdusback

    (@holdusback)

    Sorry but I dont really understand …

    I have to look for this code in the core file of wordpress ?

    Do I have to change something in the core code of wordpress ? …

    A big thanks for you’re support.

    EDIT : Im leaving the office for now… will check this topic on monday morning !

    Anyway a big thanks for you’re anwser,

    Have a good week end !

    • This reply was modified 8 years, 1 month ago by holdusback.
    Plugin Author Javier Carazo

    (@carazo)

    No, you have to create a plugin or include it into your functions.php

    add_filter( 'password_reset_expiration', function( $expiration ) {
        return MONTH_IN_SECONDS;
    });
    

    Thanks to you, remember to give us a little donation or leave a good review for this plugin ๐Ÿ˜‰

    Thread Starter holdusback

    (@holdusback)

    Hello there,

    Ok, I’ll add it in my function.php.

    But I dont understand what the var “MONTH_IN_SECONDS” is ?

    How can I specifies a time ? (like a week)

    Rated u 5 stars !

    Plugin Author Javier Carazo

    (@carazo)

    Thank you ๐Ÿ™‚

    So it would be something like:

    7 * 24 * 3600

    Number of days * hours * seconds in an hour.

    Thread Starter holdusback

    (@holdusback)

    So it would do :
    7 * 24 * 3600 = 604800

    604800 is 25200 days :s ?

    I only want something like 1 week or 2 …

    Plugin Author Javier Carazo

    (@carazo)

    604800 in seconds is a week

    Two weeks would be 2 weeks * 7 days/week * 24 hours/day * 3600 seconds/hour

    Thread Starter holdusback

    (@holdusback)

    Oh it was in sec okay.

    Ok so I’ve putted 2592000 (one month).

    The timestamp in the database is the time that the reset password was created (not the time it will be expired) So, everything is okay !

    The user I’ve inserted 1 week ago have those reset password link work again.

    A big thanks for you’re support !

    Plugin Author Javier Carazo

    (@carazo)

    ๐Ÿ™‚

    thanks for your review, any little donation would be really highly appreciated.

    Plugin Author Javier Carazo

    (@carazo)

    If you need something more with WordPress or WooCommerce we are available ๐Ÿ˜‰

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Change expire key timestamp ?’ is closed to new replies.