CB Activity new use for spots display

1 month 2 weeks ago #327287 by krileon
Replied by krileon on topic CB Activity new use for spots display
Add/Remove the CSS class "hidden". Don't use jQuery .hide(). Beyond that I can't help you with your custom coding needs; as mentioned earlier you should hire someone to assist you if it's outside your coding abilities.

I have also some issues with params in CB Activity. In an auto action trying to condition [var1_params_CUSTOM] is empty works if [var1_params_activ] really exists but fails if it’s not in the params. I have also tried with greater than, egal to or REGEX

That's to be expected. It's a dynamic substitution when content may or may not exist. If that doesn't exist then CB Auto Actions just literally sees the string [var1_params_CUSTOM]. Only way to really work around that at the moment is check if it's literally equal to that using a regexp condition so it doesn't get substituted. Example as follows.

Field: Custom > Value
Custom Value: [var1_params_CUSTOM]
Operator: Is Not REGEXP
Value: /^\[var1_params_CUSTOM\]$/


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.

1 month 2 weeks ago #327323 by activha
Replied by activha on topic CB Activity new use for spots display
Thanks got it right !

Before stopping for tonight, I'm stuck on two things :

Using Activity_onAfterCreateStringActivity, I try to update the asset with the activity id created using
$variables['var3']->set( 'asset', 'profile.[var1_user_id].activation.[var1_id].event.[cb:userdata field="cb_marketevents" /]' );
with var3 as a reference.
Can you tell me what i do wrong here ?

And using the activity_onBeforeUpdateStringActivity and using the same code as activity_onBeforeCreateStringActivity
$variables['var3']->params()->set( 'activ', $input->getString( 'Activ' ) );
This only save the old activ input and not the new one
I retrieve the old input with value="[var1_params_activ]" on the display trigger activity_onDisplayStreamActivityEdit
Same question as I don't see where I fail here ?

Thanks for tonight :-)

Please Log in to join the conversation.

1 month 2 weeks ago #327331 by krileon
Replied by krileon on topic CB Activity new use for spots display

Can you tell me what i do wrong here ?

You're using the AFTER trigger. The activity has already been saved at that point. You need to use the BEFORE trigger or you need to call the ->store() function for var3 after making your changes.

This only save the old activ input and not the new one

I've no idea what you mean by that. That should save whatever input is named "Activ" from the form POST data. Right click and inspect the inputs HTML and be sure your HTML is correct. You can use the network tool in your browsers developer tools to check the POST data being sent is also correct. Below is the auto action you need for this to work in activity edit. It's similar to the first auto action I provided earlier but adjusts the variables used and handles button state and previous value.

Edit Activity Feature
Global
Triggers: activity_onDisplayStreamActivityEdit
Type: Code
User: Automatic
Access: Everybody
Action
Action 1
Method: PHP
Code:
// CODE TO CONFIGURE NEW FEATURE BUTTON

$buttonName				=	'streamInputCUSTOM';
$buttonTarget			=	'streamInputCUSTOMContainer';
$buttonDescription		=	'Check out this new custom button!';
$buttonIcon				=	'fa fa-heart';

$inputName				=	'custom';
$inputLabel				=	'LABEL';
$inputPlaceholder		=	'PLACEHOLDER';
$inputValue				=	$variables['var1']->params()->getString( $inputName );

// CODE TO RENDER NEW FEATURE BUTTON

$variables['var2']['left'][]	=	'<button type="button" class="btn ' . ( $inputValue ? 'btn-info streamToggleOpen' : 'btn-light border' ) . ' btn-sm streamToggle ' . htmlspecialchars( $buttonName ) . '" data-cbactivity-toggle-target=".' . htmlspecialchars( $buttonTarget ) . '" data-cbactivity-toggle-active-classes="btn-info" data-cbactivity-toggle-inactive-classes="btn-light border" data-cbtooltip-tooltip="' . htmlspecialchars( $buttonDescription ) . '" data-hascbtooltip="true" data-cbtooltip-position-my="bottom center" data-cbtooltip-position-at="top center" data-cbtooltip-classes="qtip-simple"><span class="' . htmlspecialchars( $buttonIcon ) . '"></span></button>';

$substitutions						=	$action->substitutions();
$substitutions['input_name']		=	htmlspecialchars( $inputName );
$substitutions['input_label']		=	$inputLabel;
$substitutions['input_placeholder']	=	htmlspecialchars( $inputPlaceholder );
$substitutions['input_class']		=	htmlspecialchars( $buttonTarget );
$substitutions['input_value']		=	htmlspecialchars( $inputValue );

$action->substitutions( $substitutions );
Action 2
Method: HTML
Code:
<div class="border-top d-flex cb_form_line streamItemInputGroup [input_class][cb:if input_value=""] hidden[/cb:if]">
	<div class="d-none d-sm-block col-form-label flex-shrink-1 p-2 border-right font-weight-bold streamItemInputGroupLabel">[input_label]</div>
	<div class="flex-grow-1 streamItemInputGroupInput">
		<input type="text" name="[input_name]" value="[input_value]" class="form-control shadow-none border-0 w-100 streamInput" placeholder="[input_placeholder]">
	</div>
</div>
Output
Display: return
Parameters
Reference Variables: Variable 2

You'll notice $inputName for easy changing of the inputs name and $inputValue for setting its value. Have tested the above working fine in conjunction with the other auto actions provided earlier. Make any adjustments you feel necessary, but I believe this is where things need to end. I've already stepped far outside the scope of our support to provide this. Any further coding you'll need to consider hiring a developer to help you.


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.

1 month 2 weeks ago - 1 month 2 weeks ago #327366 by activha
Replied by activha on topic CB Activity new use for spots display
Thanks again Kyle for all your help and patience on this, I can manage it from now

Just a side note :
I have noticed that when updating an activity and using the activity_onBeforeUpdateStreamActivity I can save the new or edited data with
$variables['var3']->params()->set( 'activ', htmlspecialchars($input->getString( 'activ' )) );
while I can only save the new data but not save the edited data with :
$variables['var3']->params()->set( 'activ', htmlspecialchars([post_activ]));

Don't know if it's normal but it got me headaches during the last two pages and explained my posts ;-)

One final thing:
When using activity_onAfterCreateStreamActivity or activity_onAfterUpdateStreamActivity, I cannot update the asset with :
$variables['var3']->set( 'asset', 'profile.[var3_user_id].activation.[var3_id].event.[cb:userdata field="cb_marketevents" /]' );
this was to get the new activation id in the asset but even the following fails :
$variables['var3']->set( 'asset', 'something_new' );
I used var3 as reference and no conditions nor output to make tests, but nothing is updated.
Can you tell me what is wrong ?

Please Log in to join the conversation.

1 month 1 week ago #327370 by krileon
Replied by krileon on topic CB Activity new use for spots display

while I can only save the new data but not save the edited data with :

That's because you don't have your substitution surrounded by quotes. Treat all substitutions as strings. Also do not apply htmlspecialchars there. Use the ->getString method as it applies string sanitization already.

When using activity_onAfterCreateStreamActivity or activity_onAfterUpdateStreamActivity, I cannot update the asset with :

You need to call ->store() function on var3 after changing the asset otherwise it's not going to save your change.


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

Please Log in to join the conversation.

2 weeks 6 days ago #327691 by activha
Replied by activha on topic CB Activity new use for spots display
Beginning to test the whole thing I have a question regarding assets :

When I make a new activity with different things, images, location, cb fields with our new button, I wrote a new autoaction to affect the asset to public like public.xxx.activations.xxx.event.xxx

This allows the newly created activation to be visible by the public, but its components (gallery items, locations etc) stay private and only visible to registered users.

Will this behavior change with CB 6 ? so that the items inherit the asset of the activity ?
Or did I miss something ?

Thanks

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.213 seconds

Facebook Twitter LinkedIn