How do I redirect my site vistors to the home page of my site after password reset

15 views Asked by At

I would like my site vistors to be redirected to the home page of my site after resetting their password. After researching this on the web, I thought I could accomplish this by inserting the code that is in the paste bin below at the end of my functions.php, within my active theme's folder. But I get the following error message when I visit my website.

Parse error: syntax error, unexpected end of file in /home/pyepez/public_html/wp-content/themes/Builder-Everett-Custom/functions.php on line 116

Warning: Cannot modify header information - headers already sent by (output started at /home/pyepez/public_html/wp-content/themes/Builder-Everett-Custom/functions.php:116) in /home/pyepez/public_html/wp-content/plugins/ithemes-exchange/lib/sessions/db_session_manager/class-db-session.php on line 153

Any suggestions as to what may be the problem? Please help,

Patrick Yepez

add_action( "password_reset", "rngs_password_reset", 10, 2 );

/**
 * Implement "password_reset" for RNGS
 *
 * After a password reset has been performed we want the Log in link to redirect the user to the home url.
 * When we see this action being run we know that we should be filtering "login_url" to add the redirect the home page.
 * We don't filter "login_url" any other time. 
 *
 * @param WP_User $user - the user object
 * @param string $new_pass - the new password
 *  
 */
function rngs_password_reset( $user, $new_pass ) {
  add_filter( "login_url", "rngs_login_url", 10, 2 );
}

/**
 *  Implement "login_url" filter for RNGS
 *
 * Redirect the user to the home page after logging in
 *
 * @TODO - make this an option field that controls where the logged in user goes
 * @TODO - dependent upon role?
 * 
 * @param string $login_url - the original login_url which is not expected to include "redirect_to" or "reauth"
 * @param string $redirect - expected to be null/blank
 */
function rngs_login_url( $login_url, $redirect ) {
  $home_redirect = home_url();
  $login_url = add_query_arg('redirect_to', urlencode( $home_redirect ), $login_url);
0

There are 0 answers