Compatibility
LearnDash
Restrict Content Pro
Updated
In order to make the ‘User Lost Password – For User’ notification within BNFW work correctly with Restrict Content Pro, you’ll need to add the following code to your functions.php file in your theme.
You’ll then need to use %passwordresetlink%
instead of the default BNFW [password_reset_link]
shortcode in the notification.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | // Registering Your Email Tag function bnfw_rcp_email_template_tags( $email_tags ) { $email_tags[] = array( 'tag' => 'passwordresetlink', 'description' => __( 'Description of my custom tag.' ), 'function' => 'bnfw_rcp_my_custom_tag_callback_function' ); return $email_tags; } add_filter( 'rcp_email_template_tags', 'bnfw_rcp_email_template_tags' ); // Creating Your Callback Function function bnfw_rcp_my_custom_tag_callback_function( $user_id = 0, $payment_id = 0 ) { // Return RCP Password Reset Link return esc_url_raw( bnfw_retrieve_password_message( $message, $key, $user_login, $user_data ) ); } // Re-create RCP Password Reset Link function bnfw_retrieve_password_message( $message, $key, $user_login, $user_data ) { $user_data = get_user_by( 'email', trim( $_POST['rcp_user_login'] ) ); $user_login = $user_data->user_login; $key = get_password_reset_key( $user_data ); $message = esc_url_raw( add_query_arg( array( 'rcp_action' => 'lostpassword_reset', 'key' => $key, 'login' => rawurlencode( $user_login ) ), $_POST['rcp_redirect'] ) ) . "\r\n"; return $message; } add_filter( 'retrieve_password_message', 'bnfw_retrieve_password_message', 10, 4 ); |