This is a nice use case example inspired by amir00251 (Professional member - thank you!).
The use case can be summarized as follows:
- The normal CB registration process of a website is set for automatic approval of new registration requests after email confirmation is completed. This is configured by setting the CB Configuration → Registration tab 'Require Admin Approval' and 'Require Email Confirmation' parameters to 'No' and 'Yes' respectfully.
- The website administrator wants to exceptionally place applicants that have confirmed their emails in a "pending approval by moderator" state, as if the 'Require Admin Approval' parameter was set to 'Yes' if the applicant had specified a certain value on a CB registration field. This class of applicants would not be immediately approved and would need to be manually approved by frontend CB moderators, using the CB Workflows module or by backend administrator from the CB User manager.
The CB Auto Actions plugin available for Professional members can be configured to enforce this exception by implementing the following actions:
- Use Query type action triggered by onAfterUserConfirm event (this happens after email confirmation has taken place after registration applicant has clicked on the confirmation link received in the confirmation email). The actual SQL query will change the 'approval' column for the applicant to '0' in the _comprofiler table and the 'block' column for applicant in the _users table to '1'. This action will conditionally be executed when a specific CB field condition criteria is met. The queries actions are:
UPDATE `#__comprofiler` SET `approved`= '0' WHERE `user_id` = '0'
UPDATE `#__users` SET `block`= '1' WHERE `id`= '0'
- Use Email type action triggered by onAfterUserConfirm event to send email to moderation team users that a new applicant needs their attention. Again this action is conditionaly configured based on same CB field condition criteria.
- Use Email type action with same trigger to send specific user an updated message that his account is being reviewed and will be activated (or rejected) as soon as possible.
The proposed solution has the following issues:
- User sees the default "Your account is now active. You may now log in!". You need to midfy this message to consider the fact that in some cases this is not entirely true. Maybe just add a note in parenthesis that:
(Under some circumstances your account might need further approval by our moderation team - should this be the case, you will receive an email message explaining the process)
- This extra note can be added to your _UE_USER_CONFIRMED language string in your language.php file.
- The user receives the welcoming message (configured in the CB Configuration -> Registration tab area) which should probably be als adjusted appropriately.
In order to illustrate the previous solution concept we will make the following assumptions:
- A single select check box field is created in CB Field Manager. The name of this CB field is 'cb_singlecheckbox' and we have plubished it to appear on our registration form.
- The condition criteria that needs to be satsfied in order for the CB Auto Actions to fire is that this single check box field is clicked (selected) during the registration process.
Note: You can easily adjust the implementation logic for other field types.
CB Auto Actions Summary
This is just a summary listing of the 4 CB Auto Actions implemented as part of the solution.
CB Auto Action SQL Pending Approval
SQL Auto Action to modify the _comprofiler table approve column of the user if the condition is true.
CB Auto Action SQL Block User
SQL Auto Action to modify the _user table block column of the user if the condition is true.
CB Auto Action Email to Notify Admin
Email Auto Action to send notification message to administrator that user has been blocked and actions needed - once again, if the condition is true.
CB Auto Action Email to Notify Pending User
Email Auto Action to send notification message to pending user that membership is still being processed - once again, if the condition is true.