CB Autoactions metadata code

1 year 7 months ago #330234 by activha
CB Autoactions metadata code was created by activha
Hello
I was trying to set metadata with a code autoaction and trigger activity_onDisplayStreamActivity and noticed that it's impossible to use var8 to access the user who posted the activity.
Specifically I tried to use [var8_user_name] or [var8_user_alias]  as I thought that it would be possible to access it this way (think you did it this way for groupjive ?)

Can you help me on this ? 
Shall I revert to a PHP code autoaction instead of metadata ?

Thanks a lot

Please Log in to join the conversation.

1 year 7 months ago #330241 by krileon
Replied by krileon on topic CB Autoactions metadata code
The variables for that trigger are as follows.
$_PLUGINS->trigger( 'activity_onDisplayStreamActivity', array( &$row, &$title, &$date, &$message, &$insert, &$footer, &$menu, $stream, $output ) ) );

var8 is $stream. That's an activity stream object. So it of course doesn't have user variables. Leaving User as Automatic will build a user object from $row, which is the activity entry. You should be able to just use [username], [name], etc.. as normally.


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 year 7 months ago #330243 by activha
Replied by activha on topic CB Autoactions metadata code
Thanks a lot !

I don't know why I was trying to complexity things, tried to output var_export($variables, true) and I saw the data in var8

Of course user automatic is much better as I had copied another autoaction with user self :-(

Thanks for your time ;-)

Please Log in to join the conversation.

1 year 7 months ago #330244 by activha
Replied by activha on topic CB Autoactions metadata code
Dont know if it can help someone but I ended up with :
    $document = JFactory::getDocument();

    $title       = '[name] a partagé une info ';
    $description  = '[cb:parse function="extract" length="60"][var1_message][/cb:parse]...';
    $source = '[var1_params_gallery]';
    $image = preg_split ('/\|/', $source);
    $picture = '[cb:config param="live_site" /]/index.php?option=com_comprofiler&view=pluginclass&plugin=cbgallery&action=item&func=preview&id='.$image[0].'&format=raw';
//todo condition picture if exist
    $document->setTitle($title);
    $document->setMetaData('robots', 'index, follow');
    $document->setMetaData('title', $title);
    $document->setMetaData('og:title', $title);
    $document->setMetaData('image', isset($picture) ? $picture : '');
    $document->setMetaData('og:image', isset($picture) ? $picture : '');
    $document->setMetaData('description', $description);
    $document->setMetaData('og:description', $description);
    $document->setMetaData('twitter:card', 'summary_large_image');
    $document->setMetaData('twitter:site', '@activha');

 
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

1 year 7 months ago #330250 by krileon
Replied by krileon on topic CB Autoactions metadata code
You shouldn't need to write PHP for that. The Code action has a Method option for Metadata for specifically outputting metadata. Format Functions can even be used to perform some simple operations like split using entirely substitutions.


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.213 seconds

Facebook Twitter LinkedIn