Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

disable admin moderation for emails ending with .edu?

  • ThePiston
  • ThePiston
  • OFFLINE
  • Posts: 334
  • Thanks: 26
  • Karma: 1
9 years 6 months ago #263089 by ThePiston
Would it be possible using Auto Actions to disable admin moderation for anyone signing up for membership (and using CBsubs) if someone has an email ending in .edu? In other words, anyone with .edu would not have to have their membership moderated - they would simply become members without approval from an admin.

Thanks

CB 2.3, CBsubs 4.3, PHP 7.1, J! 3.9.X

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
9 years 6 months ago #263133 by krileon
There's no action for it, but yes it's doable. You'd need to use a Code action with method set to PHP. Then construct a user object and approve/confirm the object. Example as follows.

Code:
$user = CBuser::getUserDataInstance( '[user_id]' ); $user->confirmUser( 1 ); $user->approveUser( 1 );

As for the .edu check you'd just use a conditional on the email field with regexp operator and make sure it ends in .edu. Example as follows.

Code:
/\.edu$/


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.

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

  • ThePiston
  • ThePiston
  • OFFLINE
  • Posts: 334
  • Thanks: 26
  • Karma: 1
8 years 7 months ago - 8 years 7 months ago #279801 by ThePiston
anyone care to try and solve this one? I would need to know on which trigger to use.

CB 2.3, CBsubs 4.3, PHP 7.1, J! 3.9.X
Last edit: 8 years 7 months ago by ThePiston.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
8 years 7 months ago #279831 by krileon
The onAfterUserRegistration trigger should work as it's fired before the activation emails are triggered. May need to use the below Code usage to ensure the reference user object is altered.

Action
Method: PHP
Code:
Code:
$vars['var1']->confirmUser( 1 ); $vars['var1']->approveUser( 1 );
Parameters
Reference Variables: Variable 1

If you don't want it to send any emails for the confirmation and approval then the below should also work.
Code:
$vars['var1']->confirmed = 1; $vars['var1']->approved = 1; $vars['var1']->store();


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.

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

  • ThePiston
  • ThePiston
  • OFFLINE
  • Posts: 334
  • Thanks: 26
  • Karma: 1
8 years 7 months ago - 8 years 7 months ago #279860 by ThePiston
For Condition would I just use

email DOES CONTAIN .edu ?

Also, should code return echo or one of the other options? thanks

CB 2.3, CBsubs 4.3, PHP 7.1, J! 3.9.X
Last edit: 8 years 7 months ago by ThePiston.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
8 years 7 months ago #279883 by krileon

For Condition would I just use

email DOES CONTAIN .edu ?

No, you'll want to be more specific with it. Example as follows.

Code:
[email] Is REGEXP /\.edu$/

Also, should code return echo or one of the other options? thanks

There's nothing to return so set it to Silent.


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.

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

Moderators: beatnantkrileon
Powered by Kunena Forum