Skip to Content Skip to Menu

🌟 CB Editor Assistant 1.0.0 is here! Discover our new AI Joomla Plugin that wrote its story! (and this banner!)
Start at just $12.50/month* or 💸 save 30% with our 🛍️ Black Friday Intro Offer for your subscription's lifetime
🎉 Black Friday sale is here! Great savings on professional and developer memberships! Get 25% off now with code BLACK-FRIDAY-2024!

Custom auto action on after User Save

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
9 years 10 months ago #257594 by krileon
Replied by krileon on topic Custom auto action on after User Save

Basically, what I want to do is after a user has been registered and saved, there needs to be a call to a "function" that will create an invitation for a user and a bit more processing of other things.

You would just execute that function in your Code action with method set to PHP then.

I have a PHP function that I have created within a standalone file, xxxxxx.php located within a specific directory that I'd like to call using a CB Auto Actions plugin. I was thinking this would be the best place to call the function, because the only other way to do this would be to hack the Joomla or CB code to call my function after the user gets saved in Community Builder. Hope this makes more sense.

You don't need to hack anything. Just do a PHP require_once to the absolute path of your PHP file then execute your function as it'll be included into the scope. Example as follows.

Code:
global $_CB_framework; require_once( $_CB_framework->getCfg( 'absolute_path' ). '/PATH_TO_FILE_HERE' );

The above would do a require_once starting at Joomlas root. Assuming your file is in Joomlas file structure you'd just path to it and replace PATH_TO_FILE_HERE with the path. If it's outside of Joomla then you'd do a standard PHP require_once to its absolute path as needed.


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.

9 years 10 months ago - 9 years 10 months ago #257611 by roy.eschner
Replied by roy.eschner on topic Custom auto action on after User Save
Thanks, krileon, just what I was looking for! :)

If I'm using the "After User Confirm" trigger to perform the PHP (eval) method code, can I use the following syntax to retrieve a single id value from a non-CB table:
Code:
global $_CB_database; $query = "SELECT `id` FROM `#__myOtherTable` WHERE `fieldname` = '[cb_fieldname]' ORDER BY `id` DESC LIMIT 1"; // get CB user info $_CB_database->setQuery($query); $surveyList = $_CB_database->loadResult();

I can execute this code from the backend of the CB Auto Actions, but for some reason it's not triggering when a user confirms their email. I've tested it and it seems to fail when trying to retrieve the id shown above. I have this action set to "User" and not "Specific", not sure if that may have something to do with it. And the Custom ACL is set to everybody.

Cheers!
Last edit: 9 years 10 months ago by roy.eschner.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
9 years 10 months ago #257689 by krileon
Replied by krileon on topic Custom auto action on after User Save
Leave User as Automatic. In most cases you will not need to change this. Substitutions will work in your PHP code and the substitutions take place before the PHP processes. If you're trying to use substitutions in your included PHP then no that won't work; just add the PHP directly to the action.

Triggering an action directly fires the action immediately and in most cases not on a user. To properly test your action you need to fire the trigger it's dependent on. In your case you need to do test confirmations. Your code however is just a select query so I've no idea what you're expecting it to do.


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: roy.eschner

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

9 years 10 months ago #257741 by roy.eschner
Replied by roy.eschner on topic Custom auto action on after User Save
Leaving user as automatic solved the issue, krileon, thanks a lot!
Much appreciated:)
Roy

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

9 years 10 months ago - 9 years 10 months ago #257742 by roy.eschner
Replied by roy.eschner on topic Custom auto action on after User Save
Hi krileon,

I just have a quick question regarding using CB v2.04 with PHP version 5.3.29. I know CB 2.04 requires at least PHP 5.3.3, but currently we have a "test" site that has this kind of environment and I've installed the latest CB on this environment and all seems to be working. Is there anything that may not work if we do not upgrade our PHP version as doing the PHP upgrade on this server could be problematic for other things.

Thanks again,
Roy
Last edit: 9 years 10 months ago by roy.eschner.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
9 years 10 months ago - 9 years 10 months ago #257771 by krileon
Replied by krileon on topic Custom auto action on after User Save

I just have a quick question regarding using CB v2.04 with PHP version 5.3.29. I know CB 2.04 requires at least PHP 5.3.3, but currently we have a "test" site that has this kind of environment and I've installed the latest CB on this environment and all seems to be working. Is there anything that may not work if we do not upgrade our PHP version as doing the PHP upgrade on this server could be problematic for other things.

Honestly I don't recommend using anything less than PHP 5.4. The requirement is set based off the PHP functions used or PHP bugs. 5.3.29 is greater than 5.3.3 so you're fine. 5.3.29 though is the EOL of PHP 5.3 so it's the last PHP 5.3 release ever; see the below.

php.net/archive/2014.php#id2014-08-14-1


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.
Last edit: 9 years 10 months ago by krileon.

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

Moderators: beatnantkrileon
Powered by Kunena Forum