Skip to Content Skip to Menu

CB Activity API usage update

  • krileon
  • krileon
  • ONLINE
  • Posts: 48536
  • Thanks: 8290
  • Karma: 1445
10 months 1 week ago #336538 by krileon
Replied by krileon on topic CB Activity API usage update
Looking into this further it seams like you're basically needing a business directory with discussions. Have you consider using an extension specialized in this? There's several great extensions below that could be extended by CB Activity to add commenting or generate activity for listings.

extensions.joomla.org/extension/j-businessdirectory/
extensions.joomla.org/extension/jreviews/

There's quite a few on the JED that are Joomla 5 compatible.

extensions.joomla.org/instant-search/?jed_live%5Bquery%5D=directory&jed_live%5BrefinementList%5D%5Bversions%5D%5B0%5D=51&jed_live%5BrefinementList%5D%5Bversions%5D%5B1%5D=50


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 or Create an account to join the conversation.

  • activha
  • activha
  • ONLINE
  • Posts: 2334
  • Thanks: 117
  • Karma: 13
10 months 1 week ago #336545 by activha
Replied by activha on topic CB Activity API usage update
Thanks for your proposal. I already reviewed these extensions a couple of years ago but we have very specific requirements and none of them would fit.

What we have now with CB Activity 5 works perfectly fine and I just would like to adapt it to CB activity 6 so that we keep the same (at least for now and we may code a specific component in 2025)

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48536
  • Thanks: 8290
  • Karma: 1445
10 months 1 week ago #336546 by krileon
Replied by krileon on topic CB Activity API usage update

I already reviewed these extensions a couple of years ago but we have very specific requirements and none of them would fit.

That very much means you should hire a freelance developer to build out an extension that does fit your needs. It would likely be easier to modify a business directory extension than CB Activity in this case.

Forcing CB Activity to be something it isn't is going to keep causing problems like this. We can't possibly take into account all your custom code when it comes to releasing new CB Activity versions so you're going to have a lot to maintain. You'll see more breaks when we switch to event objects, but after that should see far less since we can add backwards compatibility in event objects which we can't do with this big ol' variable arrays.

At any rate hopefully the example above helps you adapt your custom implementation. Doing this in auto actions and not in a custom extension or custom CB plugin outside of an IDE is going to make this a real pain as you've no autocomplete, typehints, phpdoc, and nothing to go on since we do document our code which you can't see (and never will see) in CB Auto Actions. So you might ant to move your code to PHP files and include them and be sure to open your Joomla install in an IDE to make things easier.


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 or Create an account to join the conversation.

  • activha
  • activha
  • ONLINE
  • Posts: 2334
  • Thanks: 117
  • Karma: 13
10 months 1 week ago #336567 by activha
Replied by activha on topic CB Activity API usage update
Yes I understand and we'll definitely move to an outside extension by the end of the year.
But for now I'm too busy with our artificial intelligence MoniA (plugin for joomla/wordpress also ;-) )

Thanks for your explanation as I was able to correct most of things to adapt to CB 6

I still have an issue with the router autoactions conflicting with CB 6 routing though. Tried to change the orders of the plugin but no success.

Use of the new routing of CB 6 with /post/id seems fine but I'd like to prepend our param title to the id if that's feasible ? 

I had for the autoaction router :
Code:
if ( ( $variables['var2'] !== 'cbactivity' ) || ( ! $variables['var4'] ) || ( ! isset( $variables['var4']['action'] ) ) ) {     return; } $queryAction                    =    ( $variables['var4']['action'] ?? '' ); if ( $queryAction !== 'activity' ) {     return; } $queryFunc                        =    ( $variables['var4']['func'] ?? 'show' ); if ( $queryFunc !== 'show' ) {     return; } $queryId                        =    (int) ( $variables['var4']['id'] ?? 0 ); if ( ! $queryId ) {     return; } $activity = new \CB\Plugin\Activity\Table\ActivityTable(); $activity->load($queryId); if ( ! $activity->getInt( 'id', 0 ) ) {     return; } $params = $activity->params() ; $params['activ'] = htmlspecialchars_decode($params['activ']); $title =  !empty($params['activ']) ? JFilterOutput::stringURLSafe($params['activ']) .'-' : null; $variables['var3'][]    =    $title.$queryId; unset( $variables['var4']['action'] ); unset( $variables['var4']['func'] ); unset( $variables['var4']['id'] );

So ideally if we could retrieve $params if it exists and replace the post id by $title.$queryId that would be great 

Is this doable now ?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48536
  • Thanks: 8290
  • Karma: 1445
10 months 1 week ago #336574 by krileon
Replied by krileon on topic CB Activity API usage update
The query parameters don't exist anymore once the URL has been processed by CB Activity. You'd have to try to depend on $segments and $vars array. The below attempts to do this and in quick initial testing seams to work.

Global
Triggers: onBuildRoute
Type: Code
User: Self
Access: Everybody
Conditions
Condition 1
Field: Custom > Value
Custom Value: [var2]
Operator: Equal To
Value: cbactivity
Condition 2
Field: Custom > Value
Custom Value: [var3_0]
Operator: Equal To
Value: post
Action
Method: PHP
Code:
Code:
$variables['var3'][1] = $variables['var3'][1] . '-CUSTOM_TITLE_HERE';
Parameters
Reference Variables: Variable 3

That might work. At the very least it will append to the ID of the URL, but it may not reverse. Another option is to just add an extra segment onto the URL that won't be used. Example as follows.

Code:
Code:
$variables['var3'][] = 'CUSTOM_TITLE_HERE';

That would result in URLs like /post/123/CUSTOM_TITLE_HERE instead of /post/123-CUSTOM_TITLE_HERE.


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 or Create an account to join the conversation.

  • activha
  • activha
  • ONLINE
  • Posts: 2334
  • Thanks: 117
  • Karma: 13
10 months 1 week ago #336580 by activha
Replied by activha on topic CB Activity API usage update
Excellent idea ! thanks a lot, works great this way :-)
And I can keep my parse route for the old urls, tested fine also.

I'll have a few other questions for organizing things as it changed a lot but this will do until we code something stronger.

1) Is it normal that the default font be Apple Color Emoji ? This adds lots of spaces between all words

2) How can I retrieved the url that I just build on the post area as the custom title is not appended ? that's important for our SEO

3) with the trigger onDisplayActivity, how can I check that I'm on a single post page ? With CB 5 I had a test value = 1 for return ( $variables->getInt( 'id' ) && $variables ? 1 : 0 ); but changing to return ( $variables->getInt( 'id' ) && $variables ? 1 : 0 ); does not work with CB 6

Thanks a lot

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

Moderators: beatnantkrileon
Powered by Kunena Forum