Skip to Content Skip to Menu

[SOLVED] Override for Admin Approval for a Particular Usergroup

  • michaedt
  • michaedt
  • OFFLINE
  • Posts: 63
  • Thanks: 11
  • Karma: 4
6 years 11 months ago - 6 years 11 months ago #298639 by michaedt
CB Configuration set with Admin approval set to "Yes".
Upon registration, users select one of three options in the field "membership type" (which we created): "Student", "Professor", or "Other"

"Professors" and "Students" must register for the site and provide proof that they attend one of our member institutions. We approve their membership after they confirm their email and we check their credentials.

"Other" members are allowed to search our database but they don't see other parts of the site reserved for students and professors. We don't want to moderate them since they will only have "registered" access (thus they won't belong to our "professor" or "student" groups).

We created "Usergoup" auto actions to automatically assign students, professors, and other to the correct usergroup. But we cannot automatically approve the "Other" users after they confirm their email. Is there a way to override admin approval for the ones that choose "Other" when registering but keeping admin approval in place for the other two groups?

Joomla 3.8.1
CB - 2.1.3
PHP 7.0.23
Last edit: 6 years 11 months ago by krileon. Reason: Added [SOLVED] tag to subject

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
6 years 11 months ago #298659 by krileon
You should be able to toggle their approval state from a code action using PHP. Example as follows.

Global
Triggers: onBeforeUserRegistration
Type: Code
User: Automatic
Access: Everybody
Conditions
1: [cb_membertype] Equal To Other
Action
Method: PHP
Code:
Code:
$variables['var1']->set( 'approved', 1 );
Parameters
Reference Variables: Variable 1

That should force the approved state to approved before they're even stored in the database. All the emails should act accordingly. If you're not using email confirmation then you'll likely need to use the below as well to unblock them.

Code:
$variables['var1']->set( 'block', 0 ); $variables['var1']->set( 'approved', 1 );

Note this is only for frontend registration as backend you'd just create them as approved already.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: michaedt

Please Log in or Create an account to join the conversation.

  • michaedt
  • michaedt
  • OFFLINE
  • Posts: 63
  • Thanks: 11
  • Karma: 4
6 years 11 months ago #298664 by michaedt
Thank you so much! Exactly what I needed. I'll let you know if I run into any problems.
The following user(s) said Thank You: krileon

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum