CB Activity Create an entry with a special asset ref

4 years 1 month ago #316843 by activha

You can't insert the activity id into the asset. The id doesn't exist yet. You shouldn't be inserting an activity id into its own asset though. The asset is meant to depict the location


This was because we need this asset to be unique and be easily retrieved. What kind of id can I use for this ?

Ideally a user could have several wanted items with the same action id and we would like to target each of them independently with an independent activity stream

Likes should already be enabled so they can like that activity entry. Aside from that you'll need to be more specific about what you mean by special function.

For instance, lets say that a user has added several wanted items numbered wanted.1.action.12.profile.57 , wanted.2.action.12.profile.57 and wanted.3.action.12.profile.57

I'ld like to display a dropdown field of these three items, allow our user to select one of the three, and then display all the activities linked to this item.

As for the likes, I'd like to display all users who have liked the wanted item. And better, I'd like to store also non registered users email who may like this item if this could be feasible ?

Please Log in to join the conversation.

4 years 1 month ago #316853 by krileon

This was because we need this asset to be unique and be easily retrieved. What kind of id can I use for this ?

Ideally a user could have several wanted items with the same action id and we would like to target each of them independently with an independent activity stream

The identifier aspect of an Asset is meant to depict an object it is referencing. It can not reference itself.

wanted.A.action.12.profile.57
wanted.B.action.12.profile.57
wanted.C.action.12.profile.57

Where A, B, and C are manually and specifically supplied by you. To better understand Asset take a look at the following for example.

groupjive.group.10.gallery.photos.30325

This first specifies the activity is specific to GJ. Next it notes we're located in a group with an ID of 10. Now we note it's part of a gallery and that the gallery entry is a photo with an ID of 30325. No part of this references the activities own self. We're just forming a path of the where to the what. With this design in mind your asset including its own id doesn't make sense to CB Activity as an activity entry can't reference itself.

The only way that'd work is if you used activity_onAfterCreateStreamActivity and modified the activity and stored it a second time after it has been stored the first time, but I again do not recommend making an asset reference itself. If you insist on doing this then your 3 asset usages earlier will work fine on that trigger if you follow the set usages with a call to ->store. Example as follows.

$variables['var3']->set( 'asset', 'wanted.[var3_id].action.[var3_params_action_id].profile.[user_id]' );
$variables['var3']->store();

For instance, lets say that a user has added several wanted items numbered wanted.1.action.12.profile.57 , wanted.2.action.12.profile.57 and wanted.3.action.12.profile.57

That's perfectly fine, but you need to figure out where that 1, 2, and 3 are going to come from. There has to be a thing these are associated with.

I'ld like to display a dropdown field of these three items, allow our user to select one of the three, and then display all the activities linked to this item.

Best I can suggest is use the existing Filters functionality that lets them filter the stream down by asset or user.

As for the likes, I'd like to display all users who have liked the wanted item.

Display them where? The modal window displayed when clicking the likes text already displays everyone who has liked the activity entry. You can also display the same modal window view as a page by linking to it from a Joomla menu item if you like. I suppose you could also filter a userlist using an advanced filter against the likes database table.

And better, I'd like to store also non registered users email who may like this item if this could be feasible ?

There is no support for public likes. There are no plans for supporting public likes either at this time.


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.

4 years 1 month ago #316858 by activha
Thanks for your explanations.

I think that activity_onAfterCreateStreamActivity will work fine for the uses that I try.

For the autoaction I also tried to condition to [var3_params_action_id] not empty but it seems to fail. How can I access it in the autoaction condition ?

Next, is it possible in the same code autoaction to use the activity input (message, action , location) in order to create a new event in a defined group ?

Or should I chain another autoaction ? how would you do it ?

Please Log in to join the conversation.

4 years 1 month ago #316859 by krileon

For the autoaction I also tried to condition to [var3_params_action_id] not empty but it seems to fail. How can I access it in the autoaction condition ?

The nested params depth at this time only goes down 2 levels (will be customizable in the future) so it may not be accessible. It'd first parse into var3 then into params then it'd stop. So only [var3_params_action] would be reachable without PHP. Fortunately latest CB Auto Actions release has a new condition type Code to let you supply custom PHP to condition against and you'll likely have to use that, which the below should work.

return (int) $variables['var3']->params()->subTree( 'action' )->get( 'id' );

Next, is it possible in the same code autoaction to use the activity input (message, action , location) in order to create a new event in a defined group ?

What do you mean by new event? A GJ Event or do you mean create another activity entry?

Or should I chain another autoaction ? how would you do it ?

Auto action order is respected so you could just have 2 auto actions on the same trigger. You can also directly chain auto actions with the autoactions_onAction trigger, but you need to be careful and be sure to condition it otherwise you'll get stuck in an infinite loop. Its trigger variables are as follows.

$_PLUGINS->trigger( 'autoactions_onAction', array( &$content, &$autoaction, &$user, &$variables, &$substitutions ) );

You'll want to be sure to condition against [var1_id] to make sure you're chaining your previous auto action by its auto action 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.

4 years 1 month ago #316860 by activha
Thanks

What do you mean by new event? A GJ Event or do you mean create another activity entry?


Yes I was thinking at using this to create automatically a GJ Event in a special group. Then we could re set this event to a future user when he joins.

This is the workflow :
Our users join some events to participate to marketing campaigns (that was another post)

Some users would like new campaigns that they identify on the web, then they create a new activity entry with links, pictures and text (say new iPhone)

This new activity automatically create a GJ Event with a start date of today but no end date and the input from the activity message and activity location

We next try to identify the future owner of this campaign (say Apple) and convince them to join us for their marketing needs. Then we re allow the GJ Event to Apple for them to change the campaign to their wishes.

Then all our users can use this new marketing campaign and the initiating user will gain some bonus.

Hope it's clear enough

Please Log in to join the conversation.

4 years 1 month ago #316861 by krileon
You likely shouldn't need to chain auto actions, but just have 2 auto actions acting on the same trigger with same conditions. The auto actions will execute in the order they are placed in within CB Auto Actions. Your second auto action would then just create the GJ Event, which you will have to do with PHP or SQL as there's no auto action type for that.

Was there no Joomla marketing extension available that better provides the functionality you need for marketing campaigns? You're trying to force GJ Events and CB Activity to do something it was never designed to do, which could be a problem later down the road as both plugins 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.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.995 seconds

Facebook Twitter LinkedIn