Hi, could you help us by sharing the function you’ve written that hooks into the authorizer_allow_login filter?
Hello,
Thank you for your response. I understand that the issue may not be related to the $allow_login variable. However, I would like to clarify how I can detect users who are in “pending” status within the Authorizer plugin.
I noticed the term “access_users_pending” in the code, but it doesn’t appear to be a standard WordPress hook. Could you please provide more details or guidance on how I can correctly detect users in “pending” status using Authorizer? Is there a specific hook or method that I should be using for this purpose?
Your assistance in this matter would be greatly appreciated.
Thank you.
My code in function.php :
// Ajoutez un hook sur l’action ‘authorizer_approval_pending’
add_action(‘authorizer_approval_pending’, ‘notify_admin_on_approval_pending’, 10, 2);
function notify_admin_on_approval_pending($user_id, $user_data) {
// Envoyez un e-mail d’approbation ou de notification à l’administrateur
$to = ‘olivier.cervellin@univ-lorraine.fr’; // Adresse e-mail de l’administrateur
$subject = ‘Demande d\’approbation de connexion’;
$message = ‘L\’utilisateur ‘ . $user_data[’email’] . ‘ a demandé une approbation de connexion.’;
wp_mail($to, $subject, $message);
}
But authorizer_approval_pending does’nt exist ?
Hi, there is already built-in functionality in Authorizer that will email users with a specified role whenever someone is added to the pending list. You can specify which role this is under the Authorizer -> Login Access tab.
Under “Who can log in” make sure “Only approved users” is checked.
Under “Which role should receive email notifications about pending users?”, select the role that you want to receive notifications.
You can fill out the rest of the fields to customize the messages that the end user receives when attempting to log in.
HI,
In fact I want to send an email to the site administrator each time a user has attempted to authenticate via CAS and is awaiting approval, as I am not in the pro version I program manually:
add_action(‘authorizer_user_register’, ‘send_notification_on_pending_users’, 10, 1);
// Function to send a notification to the administrator
function send_notification_on_pending_users($user_data)
{
// Send email to admin for waiting user
$to = ‘test@test.fr’; // Administrator email address
$subject = ‘New user waiting’;
$message = ‘The user’ . $user_data[’email’] . ‘is awaiting approval.’;
wp_mail($to, $subject, $message);
}
But the authorizer_user_register hook doesn’t exist in authorizer, so I don’t know which hook to use?
To clarify, when you say “pro version”, what are you referring to? There is no pro version of Authorizer, and the functionality to send an email to a role when there is a pending user is available by default, as long as you have configured WordPress to be able to properly send emails.
As previously mentioned, in the Login Access tab, just select the “Administrator” role under “Which role should receive email notifications about pending users?” and Authorizer will perform the functionality that you are attempting to write an action for.
If you have more than one user in the Administrator role (or equivalent), currently all of the users with this role will receive the email.
http://portal.cran.univ-lorraine.fr/Capture%20d%E2%80%99%C3%A9cran%202023-09-23%20160114.jpg
In the Login Access tab i select Administrator as in the linked image but no email is sent to me even though I am the site administrator, moreover in the part: What message should pending users see after attempting to log in? I can’t post a message I don’t have control as well as in the part: What message should blocked users see after attempting to log in? Is there an extension that is not compatible with my latest version of Authorizer?
Can you please confirm which version of Authorizer you have installed, and list any other plugins you also have installed?
I use Authorizer 3.6.3.1
I recieve notification e-mail, that is ok
But i can’t write anything in textarea : What message should pending users see after attempting to log in ? and in textarea : What message should blocked users see after attempting to log in ?
When you say you receive the notification email OK, do you mean that when a user signs up and is put in the pending list, you receive an email that is generated by Authorizer?
Also, can you please give us a list of the other plugins you have installed? This will help us to further troubleshoot the issue.
Hi, following up if you still need support with this issue, thanks!