Skip to Content Skip to Menu

SOLVED: What is the way to get gj_custom field values in a GJ template file?

  • NFA
  • NFA
  • OFFLINE
  • Posts: 84
  • Thanks: 15
  • Karma: 0
2 years 7 months ago - 2 years 7 months ago #329133 by NFA
Hi,

We are used to making use of our own introduced Groupjive gj_custom fields in our custom GroupJive template files. For that, we added an extra field to the #__groupjive_groups table, which we fill and maintain from CB with CB Auto Actions.

We use this gj_custom field for example in, the ./components/com_comprofiler/plugin/user/plug_cbgroupjive/templates/Noa/group.php file

In the past we added
Code:
/** @var string */ public $gj_custom = null;
to the ./components/com_comprofiler/plugin/libraries/CB/Plugin/GroupJive/Table/GroupTable.php. Then we could simply get it everywhere with
Code:
. $row->get(gj_custom) .

But after a CB + GJ update, this (declaration) file(location) GroupTable.php is gone. Can you tell us what the best way is to get this done in these PHP template files, these days?

With kind regards, Noa
Last edit: 2 years 7 months 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 7 months ago #329139 by krileon
That's the legacy plugin library files location. We used to copy a plugins library files to that location, but it's not necessary to do that anymore. You'll find that file at its original location below.

/components/com_comprofiler/plugin/user/plug_cbgroupjive/library/Table/GroupTable.php

You shouldn't need to modify it through. You can store custom fields into the "params" column automatically. This will avoid having to modify core code. When using CB Auto Actions to output your custom field just be sure its scoped to params. Example as follows.

FROM:
Code:
<input type="text" name="gj_custom" class="form-control" />
TO:
Code:
<input type="text" name="params[gj_custom]" class="form-control" />

You can then access it using the below.

Code:
$myCustomValue = $row->params()->get( 'gj_custom' );

The gj_onBeforeDisplayGroupEdit trigger can be used to add the custom fields with params scope.


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: NFA

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

  • NFA
  • NFA
  • OFFLINE
  • Posts: 84
  • Thanks: 15
  • Karma: 0
2 years 7 months ago - 2 years 7 months ago #329142 by NFA
Wow, Krileon, that is the way to go. Thank you so much!!!
Last edit: 2 years 7 months ago by NFA.
The following user(s) said Thank You: krileon

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

  • NFA
  • NFA
  • OFFLINE
  • Posts: 84
  • Thanks: 15
  • Karma: 0
2 years 7 months ago - 2 years 7 months ago #329149 by NFA
Using the params is really a great solution for my kind of custom GJ fields!

It only brings me to just one other question (sorry). What is the best way to add and/or modify such a (new) GroupJive parameter with a CB Auto Action?

I mean, what type of CB Auto Action, and what kind of code (inside that CB Auto Action) should be use to change only one GroupJive parameter on a targeted group?

Using SQL in CB Auto Actions to change the (complete) content of any database field is no problem. But, I don't know the (SQL or other) way for only changing just one parameter in the (#__groupjive_groups -> params) field.

Hope you can (also) help me with this,
Noa
Last edit: 2 years 7 months 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 7 months ago #329151 by krileon
You don't need to handle the storage at all. GJ handles storage of additional parameters automatically so unsure what you're asking. Are you wanting to change the value outside of group edit and save?


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.

  • NFA
  • NFA
  • OFFLINE
  • Posts: 84
  • Thanks: 15
  • Karma: 0
2 years 7 months ago - 2 years 7 months ago #329154 by NFA
Yes, I want to change it outside GroupJive edit, but inside Community Builder. My users creating and changing their GroupJive group settings by changing cb_customfields. They don't know, but CB Auto Action do that for them on the background ;-) So they only have to maintain their CB profile.

So for example onAfterUserRegistraion or onAfterUserUpdate in CB, I want, depending on the change of some cb_customfields to add or change a value in their GroupJive Group param.
Last edit: 2 years 7 months ago by NFA.

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

Moderators: beatnantkrileon
Powered by Kunena Forum