Skip to main content Skip to navigation Skip to footer

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.

// 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 );

Privacy Overview

This website uses cookies so that it can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to this website and helping employees to understand which sections of the website you find most interesting and useful.

Strictly Necessary Cookies

This website uses the Stripe Payment Processor. Cookies from Stripe are required in order for this website to provide eCommerce functions, such as to accept payments.

This website uses YouTube to host and display videos relating to the operation of this plugin and forms part of the documentation. Use of cookies from YouTube is required in order to fully document or explain elements of a product.

PHPSESSID - This cookie is native to PHP applications. The cookie is used to store and identify a users' unique session ID for the purpose of managing a user's session on the website. The cookie is a session cookies and is deleted when all the browser windows are closed.