Skip to Content Skip to Menu

AutoActions gj_OnAfterCreateGroup to add full HTML in about_content paramater?

  • NFA
  • NFA
  • OFFLINE
  • Posts: 84
  • Thanks: 15
  • Karma: 0
2 years 6 days ago - 2 years 6 days ago #331674 by NFA
Hi,

After a new group has been created (by another CB AutoAction), I want run a Auto Actions that add a default HTML content in the just created group about tab.

I think a CB Auto Action, type PHP, with trigger gj_OnAfterCreateGroup should have a code something like:
Code:
require_once( $_CB_framework->getCfg( 'absolute_path' ) . '/components/com_comprofiler/plugin/user/plug_cbgroupjive/cbgroupjive.class.php' ); $group = cbgjData::getGroups( array( array( 'grp_access', 'mod_lvl2' ), $user ), array( 'id', '=', (int) $grpid ), null, null, false ); $params = $group->getParams(); $content = '<p><h3>Hello world</h3>My <b>HTML</b> text</p>' ; $params->set( 'about_content', $content ); $group->storeParams( $params );

But it doesn't work :-( I think I still miss something in the AutoAction code above. For example, will $grpid and $user work on their own, or should I first set them with extra PHP code?

Any help would be very appreciated,
Noa
Last edit: 2 years 6 days ago by NFA.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
2 years 6 days ago #331675 by krileon
You don't need the require_once. You also don't need to build a group object as it already exists in var1 of that trigger and can be accessed with $variables. There is no ->getParams() it's just ->params(). Example as follows.

Code:
$group = $variables['var1']; $group->params()->set( 'about_content', 'ABOUT_CONTENT_HERE' ); $group->set( 'params', $group->params()->asJson() ); $group->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.

Moderators: beatnantkrileon
Powered by Kunena Forum