1

I've a situation here. I've a specific user Group 'Admin', which has ability to change other user passwords. I want to make sure, that when this specific user group 'Admin' changes some user password (not user itself), the user recieves new password with loggin link. How can I do this? Do I need to make some kind of plugin or is it possible to achieve by configuration?

0

My approach would be to develop a custom user plugin. The core plugin user/joomla does this but only when creating a new user. The event onUserAfterSave($user, $isnew, $success, $msg) is triggered and the parameter $user will be populated with the user being edited values.

in your case, you want to send the email when password is changed from the backend by an administrator. This means that you need to fill the following conditions:

public function onUserAfterSave($user, $isnew, $success, $msg)
{
  $currentUserGroups = JFactory::getUser()->get('groups');
  $authorizedGroup = 7; //Default ID for the group administrator
  if (!$isnew //Not a new user
    && $user['password_clear'] //new password was set.
    && $this->app->isAdmin() // Only from the admin
    && in_array($authorizedGroup,$currentUserGroups) //User is authorized
  ) {
    //Send the email here.
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.