CB Activity new use for spots display

10 months 1 week ago - 10 months 1 week ago #327204 by activha
Replied by activha on topic CB Activity new use for spots display
Oupsss sorry that was var5 instead of var4, working fine for Stream Asset = [cb:parse function="asset" class="var5" /] :huh:

But [var1_asset] does not work in an external single activity page called by the link above

If I want to simplify things in an auto action and use an external file with an include, what lines should I add to retrieve the substitutions in the external files ? do you have a dummy file or dummy plugin to start with ?

Please Log in to join the conversation.

10 months 1 week ago #327205 by krileon
Replied by krileon on topic CB Activity new use for spots display

But [var1_asset] does not work in an external single activity page called by the link above

How are you determining it's not working? That absolutely should be working. The activity object is in var1 and it absolutely as a public accessible asset property.

If I want to simplify things in an auto action and use an external file with an include, what lines should I add to retrieve the substitutions in the external files ? do you have a dummy file or dummy plugin to start with ?

PHP code actions provide $autoaction, $user, $variables, and $input. All can be used inside your include.

$autoaction = the auto action table object
$user = user object
$variables = array of trigger variables (keys will be var1, var2, etc..)
$input = registry object with GET/POST/REQUEST variables for accessing input data

The action object itself isn't passed through and that's where the ->string substitution function lives. So there's not an easy way to access the substitutions right now. Will review adding support for $action so you've access to the action itself and could call $action->string function.

forge.joomlapolis.com/issues/8783


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.

10 months 1 week ago #327206 by activha
Replied by activha on topic CB Activity new use for spots display
Try with Code auto action and trigger activity_onAfterDisplayActivityStream with no conditions and return output.
Simple PHP code
echo '<h1>test echo non modal</h1> : [var1_user_id] -  [var1_asset] - [cb:parse function="asset" class="var5" /]';
print '<pre>' . htmlspecialchars(print_r($variables, true)) . '</pre>';

On a single activity page called by devel.activ-ha.com/component/comprofiler/pluginclass/cbactivity?action=activity&id=5592&Itemid=7333
displays :
test echo non modal
: [var1_username] - [var1_user_id] - [var1_asset] - hotspot.5592.event.26
Array
(
    [trigger] => activity_onAfterDisplayActivityStream
    [loop_key] => 
    [loop] => 
    [var1] => Array
        (
            [5592] => CB\Plugin\Activity\Table\ActivityTable Object
                (
                    [id] => 5592
                    [user_id] => 1444
                    [asset] => hotspot.5592.event.26
                    [global] => 0
                    [title] => TITRE
                    [message] => Super ce truc pour recommander une boîte !!!
                    [system] => 0
                    [published] => 1
                    [pinned] => 0
                    [date] => 2021-11-23 23:12:13
                    [params] => {"modified":"2021-11-23 23:11:04","reports":"","theme":"3","action":{"id":"11","message":"Soci\u00e9t\u00e9 test","emote":"1"},"location":{"id":"1","place":"vers lyon","address":"45.70199457373175,4.746567404214587"},"links":[{"type":"","internal":"","embedded":"","selected":""}],"asset":"","gallery":"114|*|115|*|116","defaults":{"menu":"-1","edit":"-1","date":"2021-11-23 17:07:28","actions":"-1","locations":"-1","links":"-1","tags":"-1","tags_asset":"","tags_user":"","likes":"-1","likes_asset":"","likes_user":"","comments":"-1","comments_asset":"","comments_user":""}}
                    [_params:protected] => CBLib\Registry\Registry Object
                        (
                            [defaultGetType:protected] => 
                            [storage:protected] => 
                            [_tbl] => 
                            [params:protected] => Array
                                (
                                    [modified] => 2021-11-23 23:11:04
                                    [reports] => 
                                    [theme] => 3
                                    [action] => Array
                                        (
                                            [id] => 11
                                            [message] => Société test
                                            [emote] => 1
                                        )

                                    [location] => Array
                                        (
                                            [id] => 1
                                            [place] => vers lyon
                                            [address] => 45.70199457373175,4.746567404214587
                                        )

                                    [links] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [type] => 
                                                    [internal] => 
                                                    [embedded] => 
                                                    [selected] => 
                                                )

                                        )

                                    [asset] => 
                                    [gallery] => 114|*|115|*|116
                                    [defaults] => Array
                                        (
                                            [menu] => -1
                                            [edit] => -1
                                            [date] => 2021-11-23 17:07:28
                                            [actions] => -1
                                            [locations] => -1
                                            [links] => -1
                                            [tags] => -1
                                            [tags_asset] => 
                                            [tags_user] => 
                                            [likes] => -1
                                            [likes_asset] => 
                                            [likes_user] => 
                                            [comments] => -1
                                            [comments_asset] => 
                                            [comments_user] => 
                                        )

                                )

                            [parent:protected] => 
                            [namespaces:protected] => Array
.......

I get the same result on the local dev server and on the online devel server.

Will review adding support for $action so you've access to the action itself and could call $action->string function.

Are you mentioning CB Activity actions ?
if no how can I access CB Activity action id registered for the activity ? will [var1_action->id] work ?

Please Log in to join the conversation.

10 months 1 week ago #327207 by krileon
Replied by krileon on topic CB Activity new use for spots display

I get the same result on the local dev server and on the online devel server.

Ah sorry. var1 is an array of rows so yes var1_asset will not work. It can only be accesses as an array.

Are you mentioning CB Activity actions ?
if no how can I access CB Activity action id registered for the activity ? will [var1_action->id] work ?

You can access the auto action object with $autoaction, but you cannot access the $action yet. So you can just use $autoaction->id if you want the auto action id, but you can't access the ->string substitution function yet since that's a part of $action which is not available right now, but will be soon in a new release.


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.

10 months 1 week ago #327208 by activha
Replied by activha on topic CB Activity new use for spots display

var1 is an array of rows so yes var1_asset will not work.


Meaning you cannot condition the auto action on var1 ?
or substitute in the code ?

you cannot access the $action yet

Is this the CB activity action that you mention ?
I try to condition the auto action on the CB activity action id

Please Log in to join the conversation.

10 months 1 week ago - 10 months 1 week ago #327209 by krileon
Replied by krileon on topic CB Activity new use for spots display

Meaning you cannot condition the auto action on var1 ?
or substitute in the code ?

var1 is $rows. It's an array of activity. If you need behavior on each individual activity entry use onDisplayStreamActivity, which has the following variables available to it. As is you're acting on the display of a STREAM and not an ACTIVITY.

$_PLUGINS->trigger( 'activity_onDisplayStreamActivity', array( &$row, &$title, &$date, &$message, &$insert, &$footer, &$menu, $stream, $output ) ) );

Is this the CB activity action that you mention ?

No. It's a variable that will be available to the Code action type. I'm not sure how else to explain this. When using a Code action type and Method is set to PHP you can use $autoaction, $user, $variables, and $input variables directly in your PHP code. None of those are the ACTION itself. I am going to add $action so you can run ACTION functions. Specifically ->string, which is the function for parsing the substitutions of an ACTION. I'm explaining this because you directly asked earlier how to use substitutions in an included file.

I try to condition the auto action on the CB activity action id

Condition where? In your PHP? Use $autoaction->id.


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.

Moderators: beatnantkrileon
Time to create page: 0.217 seconds

Facebook Twitter LinkedIn