• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

BUG Where to put this code

mparkhouse

New member
Messages
1
Likes
0
Points
1
#1
I have the following code in a snippet. On my WordPress site, all users are members of an organization and they all have the same login/password. No one can change the password unless they are administrators. Unfortunately, I don't know how to disable the Change password option that comes up on the wp-login.php page. Next best thing is to notify the user that he can't change his password. I have a page, lost-password, that does this.

My problem is that this code is never executed. Where should I put it? Is there something special I need to do to make it active?

I'm on a multi-site WordPress site and I'm not the super admin. Also, I noticed that when I click on the Lost Password link it has the following url: https://txmg.org/wp-login.php?action=lostpassword. It's not running wp-login.php from my site (txmg.org/fbmg) but from txmg.org. Don't know if this has any effect on the code or not but thought I should point it out.

Although I've been a systems analyst for many years, this is the first time I've dealt with WordPress and php. Ignorance is not bliss. Any help would be greatly appreciated.

add_action( 'init', 'lostpassword_instructions' );

function lostpassword_instructions() {


global $pagenow;

if ( $pagenow == 'wp-login.php' &&
isset( $_REQUEST[ 'action' ] ) &&
$_REQUEST[ 'action' ] == 'lostpassword' &&
! isset( $_REQUEST[ 'skip' ] )
) {

exit( wp_redirect( ' https://txmg.org/fbmg/lost-password/' ) );

}

}