GroupJive Events custom fields

5 months 2 weeks ago #316454 by activha
Replied by activha on topic GroupJive Events custom fields
Got everything right !! thanks a lot :-)

Please Log in to join the conversation.

5 months 1 week ago - 5 months 1 week ago #316563 by activha
Replied by activha on topic GroupJive Events custom fields

Best way to add new inputs is probably through the template files then handle storage on gj_onAfterCreateEvent and gj_onAfterUpdateEvent to store them into the params column. As for displaying the custom fields you'd act on gj_onDisplayEvent.


Just a few questions :

1) where can I find the setting to select a special event home template ? I seached in categories, groups and events but could not find one.

Also we are automatically creating new groups attached to a special subscription plan. It would be great to be able to create these groups with this special event template if feasible.

2) when adding new tabs to groups, is it possible to attach some privacy setting or access/group setting and how ?

3) I tried to add this code with an auto action to add a field in event edit template
$value = new stdClass();
		$value->id = 'params';
		$value->value = $_POST['params'];

		$currentValues = json_decode($row->get('params'));
		//If no previous Value
		if(empty($currentValues) || !is_array($currentValues)) {
			$currentValues = array();
			$currentValues[] = $value;
		} else {
			foreach ($currentValues as $key => $oneValue) {
				if($oneValue->id == 'params') {
					$currentValues[$key] = $value;
				}
			}
		}

$row->set('params', json_encode($currentValues));
$row->setError( 'ERROR_MESSAGE_HERE' );
Also tried to change row by varsbut this does not seem to work, could you help ?
Thanks

Please Log in to join the conversation.

5 months 1 week ago #316566 by krileon
Replied by krileon on topic GroupJive Events custom fields

1) where can I find the setting to select a special event home template ? I seached in categories, groups and events but could not find one.

Also we are automatically creating new groups attached to a special subscription plan. It would be great to be able to create these groups with this special event template if feasible.

You can't change the template for CB GroupJive Events specifically. The template it loads is based off the template selection in CB GroupJive. So you'll need to make a GJ template then make a GJ Events template and select the GJ template within CB GroupJive > Parameters > General.

2) when adding new tabs to groups, is it possible to attach some privacy setting or access/group setting and how ?

I guess if you tried forcing that it'd be possible, but no there's no examples of using CB Privacy within GJ as access to GJ content is meant to be entirely based off access to the group.

3) I tried to add this code with an auto action to add a field in event edit template

Are you trying to store a new parameter? Storage isn't handled in the template. Easiest way to store a new parameter is handling it before the event stores and modifying the event by reference otherwise you can use the after triggers mentioned earlier and trigger your own storage (e.g. for external storage).

Global
Triggers: gj_onBeforeUpdateEvent, gj_onBeforeCreateEvent
Type: Code
User: Self
Access: Everybody
Action
Method: PHP
Code:
$variables['var1']->params()->set( 'PARAM_NAME', 'PARAM_VALUE' );

$variables['var1']->set( 'params', $variables['var1']->params()->asJson() );
Parameters
Reference Variables: Variable 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.

Please Log in to join the conversation.

5 months 1 week ago #316573 by activha
Replied by activha on topic GroupJive Events custom fields

Are you trying to store a new parameter?


Yes I need the user to select a value in a drop down list and store it in the event param field for further display.

Specifically a list of categories for the events

How would you do it ?

Please Log in to join the conversation.

5 months 1 week ago #316574 by krileon
Replied by krileon on topic GroupJive Events custom fields
The above can handle the storage. There's no trigger for adding new inputs to CB Events so you'd have to modify the event edit template file and add that yourself. With the above for example to grab a value from POST you'd use the below.

FROM:
$variables['var1']->params()->set( 'PARAM_NAME', 'PARAM_VALUE' );
TO:
$variables['var1']->params()->set( 'dropdown', '[post_dropdown]' );

This won't do any sanity checks though so you'll want to enable format functions under Parameters. You can then use the clean format function to sanitize the post data like the following.

$variables['var1']->params()->set( 'dropdown', '
[cb:parse function="clean" method="int"][post_dropdown][/cb:parse]' );

As for displaying it you should be able to use a Code action on gj_onDisplayEvent to display whatever you like, but it'll output to the footer of the event unless you move the output or add a custom trigger in the event template file.


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 to join the conversation.

5 months 1 week ago - 5 months 1 week ago #316576 by activha
Replied by activha on topic GroupJive Events custom fields

There's no trigger for adding new inputs to CB Events so you'd have to modify the event edit template file and add that yourself.


This is fine for the storage but modifiying the event edit template does not allow to show the stored value ? or am i wrong ?
Do I need also to change the component.cbgroupjiveevents ? or do you have another idea ?

For now I only added a select like :
<select id="drophscat" name="drophscat" class="form-control required" data-cbtooltip-tooltip="Entrez la catégorie"> <option value="10">Pros ou sociétés</option><option value="20">Particuliers</option></select>

which makes that the user has to reconfirm the category at each update.

Also it seems that [var1_params] does not substitute anything with the trigger gj_onDisplayEvent whatever settings I use ?
So I had to use
$cat = null;
$cats = json_decode($variables['var1']->params);
$cat = $cats->drophscat;
//print_r($cats);
if ($cat == '10') $value = "Professionnels";
if ($cat == '20') $value = "Particuliers";
if ($cat) echo '<div class="mr-2 text-info small">Cible de la campagne: <span class="font-weight-bolder">' . $value . '</span></div>';
Any solution to enhance ?

And finally can you tell me where to insert the event edit template because it does not seem to display when I put one in a new GJ template whatever path I try
plugin/user/plug_cbgroupjive/templates/new_template/event_edit.php
or  plugin/user/plug_cbgroupjive/templates/new_template/cbgroupjivesevent/event_edit.php
or plugin/user/plug_cbgroupjive/templates/new_template/cbgroupjivesevent/templates/event_edit.php
or plugin/user/plug_cbgroupjive/templates/new_template/cbgroupjivesevent/templates/default/event_edit.php

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.433 seconds

Facebook Twitter LinkedIn