Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

CB Auto Actions - Activity - Integration - documentation ?

11 years 4 months ago #228461 by pepperstreet
Just watched Nant's presentation " Implementation without coding using Community Builder framework tools " and also the written tutorial " Adding your own events to activity stream "

Nice little and crucial infos. Really appreciate any bit of knowledge and help. But its still a cumbersome task to get this kind of infos.

The presentation is a starting point, and the slides and short sample use cases are great. Are you gonna publish the slides on Joomlapolis or SlideShare or in any other format/location?

Currently, there seems to be no real documentation.

For example - Activity tutorial:
My dumb question: Where do those var-name-prefixes come from? How should I know what to enter in the value input fields? I am aware of the actual field names and substitution syntax... but what is var1_* var3_* ?!? And why those particular numbers? Any documentation is badly needed.

I also try to get infos about Integration:
- How to create an Auto-Actions plugin?
- How to integrate a 3rdparty extension into CB Activity stream?

Some rough answers are found in the forum. But that does not give a real good picture. Here one question, there a code snippet and suggestion... I am sure, the original developer is used to everything and knows all coherences and relations... but for people like me... there is no guide.

Looking forward to more documentation, tutorials and articles!

Please Log in or Create an account to join the conversation.

  • nant
  • nant
  • OFFLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
11 years 4 months ago #228468 by nant

pepperstreet wrote: Just watched Nant's presentation " Implementation without coding using Community Builder framework tools " and also the written tutorial " Adding your own events to activity stream "

Nice little and crucial infos. Really appreciate any bit of knowledge and help. But its still a cumbersome task to get this kind of infos.


Glad you like the presentation - actually it was very well accepted and I got lots of feedback.

The presentation is a starting point, and the slides and short sample use cases are great. Are you gonna publish the slides on Joomlapolis or SlideShare or in any other format/location?


I have already published the slides on our slideshares page:

www.slideshare.net/cbteam

Currently, there seems to be no real documentation.


There is the CB API documentation found in the Free download area.
There are also CB API usage tutorials in the tutorials section:
www.joomlapolis.com/support/tutorials/120-api-usage
[/quote]

For example - Activity tutorial:
My dumb question: Where do those var-name-prefixes come from? How should I know what to enter in the value input fields? I am aware of the actual field names and substitution syntax... but what is var1_* var3_* ?!? And why those particular numbers? Any documentation is badly needed.

I also try to get infos about Integration:
- How to create an Auto-Actions plugin?
- How to integrate a 3rdparty extension into CB Activity stream?

Some rough answers are found in the forum. But that does not give a real good picture. Here one question, there a code snippet and suggestion... I am sure, the original developer is used to everything and knows all coherences and relations... but for people like me... there is no guide.

Looking forward to more documentation, tutorials and articles!


I am sure that Kyle will be responding here also.

My feedback for the moment regarding the var1, var2, etc. question (I also had this question in the past). Such variables depend on the trigger being used.

See this tutorial:
www.joomlapolis.com/support/tutorials/120-api-usage/18358-using-cb-triggers

Basically var1,2,etc depends on the trigger being used because they represent the trigger objects that are being generated.
The following user(s) said Thank You: pepperstreet

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48464
  • Thanks: 8280
  • Karma: 1443
11 years 4 months ago #228493 by krileon

For example - Activity tutorial:
My dumb question: Where do those var-name-prefixes come from? How should I know what to enter in the value input fields? I am aware of the actual field names and substitution syntax... but what is var1_* var3_* ?!? And why those particular numbers? Any documentation is badly needed.

Each trigger sends variables with it. CB Auto Action has no idea what those variables are going to be called. So instead it names those variables 1 through 10 so they can be accessed. The variables are then parsed, cleaned, and turned into substitution accessible strings. There already is documentation for core triggers below.

www.joomlapolis.com/support/tutorials/120-api-usage/18358-using-cb-triggers

For plugins you need to explore the plugin, find where the trigger is, understand the usage, and use its variables as needed. Alternative is to simply guess. There is really no better alternative except to document these triggers, which I will be doing. The tutorial above will be updated with plugin triggers whenever I've the time available.

- How to create an Auto-Actions plugin?

You can add new models to CB Auto Actions fairly easily. It uses dropdown support so you literally and create a new model and drop it into the models folder. I suggest reviewing existing models below to see how to create your own.

components/com_comprofiler/plugin/user/plug_cbautoactions/models/

- How to integrate a 3rdparty extension into CB Activity stream?

You've 4 options. First option; If the extension fires a CB trigger then you can simple use CB Auto Actions to do this. Second option; direct database insert from with your 3rd party extension. Third option; fire the CB trigger that adds new CB activity. Forth option; use data layer API to insert a new entry. Examples as follows.

CB Trigger (this assumes CB API is loaded and plugins loaded):
Code:
$_PLUGINS->trigger( 'activity_addActivity', array( 42, 'profile', 'field', '3' ) );

The above executes the below (this tells you what variables are available):
Code:
public function addActivity( $userId, $type, $user = null, $subtype = null, $item = null, $from = null, $to = null, $title = null, $message = null, $icon = null, $class = null, $date = null ) {

Datalayer (this assumes CB API is loaded and plugins loaded):
Code:
$activity = new cbactivityActivity( $_CB_database ); $activity->set( 'user_id', (int) $user->get( 'id' ) ); $activity->set( 'type', 'cbblogs' ); $activity->set( 'item', (int) $article->id ); $activity->set( 'title', 'posted a blog entry' ); $activity->set( 'icon', 'font' ); $activity->set( 'date', cbactivityClass::getUTCDate() ); $activity->store();

Basically the only reason to use direct database insert is if you don't want to load in CB API.


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

Please Log in or Create an account to join the conversation.

11 years 4 months ago - 11 years 4 months ago #228659 by pepperstreet
Many thanks for your summary. Again, I am stuck with all the infos. Regarding the 4 methods and Activity Stream...
What is best practice, if a 3rdparty component offers this kind of Events system:
COBALT CCK - Plugin Events

1. Can you give a hint if this Event System is of any help? What integration method is to prefer?
2. Cobalt supports basic CB integration (Avatar, Profile-link, Online-Status). Would it make sense to load CB API with this global option? Or does it have a big impact on the site? (memory? performance?)
3. Sorry, what do you mean by "First option; If the extension fires a CB trigger then you can simple use CB Auto Actions to do this"? Why and how should another extension use CB triggers?
4. Basic understanding: If I use CB and Activity on a site... the CB API is loaded on all pages that display CB infos, right?! So, if i would need CB data or trigger... i have to load the API in Cobalt/or template ?

Thanks in advance.
Last edit: 11 years 4 months ago by pepperstreet.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48464
  • Thanks: 8280
  • Karma: 1443
11 years 4 months ago #228708 by krileon

What is best practice, if a 3rdparty component offers this kind of Events system:

There is no best practice. All the methods work. All the methods are supported. Use whichever fits your needs best. The query usage is the most lightweight as the extension doesn't have to load in CB API. The trigger usage is the most safe as if the plugin isn't installed it just won't do anything (no missing function errors or anything), but requires CB API. The data layer API is most direct and flexible as well as affords usage of object class functions, but requires CB API and a check to ensure CB Activity exists before using it. They all have their strengths and weaknesses.

1. Can you give a hint if this Event System is of any help?

No, I didn't create the extension nor have any experience with it.

What integration method is to prefer?

Please see my above reply.

2. Cobalt supports basic CB integration (Avatar, Profile-link, Online-Status). Would it make sense to load CB API with this global option? Or does it have a big impact on the site? (memory? performance?)

I have no idea, again I did not develop that extension. CB API has a memory footprint just like any extension so it depends entirely on if your server can handle CB being loaded at the same time as your other extensions. CB has a relatively small footprint though so it should be fine.

3. Sorry, what do you mean by "First option; If the extension fires a CB trigger then you can simple use CB Auto Actions to do this"? Why and how should another extension use CB triggers?

The extension would need to load CB API and fire a CB trigger using $_PLUGIN->trigger. If it does then that trigger can be acted on using CB Auto Actions. This is entirely up to the extension developer, but is extremely unlikely they'd implement this as it creates a CB dependency (relies on CB or the trigger would do nothing).

4. Basic understanding: If I use CB and Activity on a site... the CB API is loaded on all pages that display CB infos, right?! So, if i would need CB data or trigger... i have to load the API in Cobalt/or template ?

No, it's not loaded on every page. CB only loads wherever it's used. If you've the CB Activity module on every page then CB is loaded on every page for example. How you implement is entirely up to you and isn't something I can help you decide.


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

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum