CB autoaction route triggers

1 year 5 months ago #331733 by krileon
Replied by krileon on topic CB autoaction route triggers
My example provided in my reply below works perfectly fine. It has been tested working.

www.joomlapolis.com/forum/developer-members-support/245175-cb-autoaction-route-triggers?start=18#331600

That error you're seeing appears to be caused by an issue in your onBuildRoute usage. Looks like you set $variables in it to a string?


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 5 months ago #331734 by activha
Replied by activha on topic CB autoaction route triggers
i tried with the exact same code that you mentioned copied pasted on our joomla 4.2 devel website and still get this error with your onBuildRoute code.
Mine works fine but I cannot get the Parse to reconstruct the url

Please Log in to join the conversation.

1 year 5 months ago #331737 by krileon
Replied by krileon on topic CB autoaction route triggers
The below is tested working as of this moment. It will do a basic simple rewrite of the URLs and reverse it. I cannot help you regarding your specific needs beyond this simple example.

Global
Triggers: onBuildRoute
Type: Code
User: Self
Access: Everybody
Action
Method: PHP
Code:
if ( ( $variables['var2'] !== 'cbactivity' ) || ( ! $variables['var4'] ) || ( ! isset( $variables['var4']['action'] ) ) ) {
	return;
}

$variables['var3'][]			=	$variables['var4']['action'];

unset( $variables['var4']['action'] );

if ( isset( $variables['var4']['func'] ) ) {
	$variables['var3'][]		=	$variables['var4']['func'];

	unset( $variables['var4']['func'] );

	if ( isset( $variables['var4']['id'] ) ) {
		$variables['var3'][]	=	$variables['var4']['id'];

		unset( $variables['var4']['id'] );
	}
}
Parameters
References: Variable 3 and Variable 4

Global
Triggers: onParseRoute
Type: Code
User: Self
Access: Everybody
Action
Method: PHP
Code:
if ( ( $variables['var2'] !== 'cbactivity' ) || ( ! $variables['var3'] ) ) {
	return;
}

if ( isset( $variables['var3'][0] ) ) {
	$variables['var4']['action'] = $variables['var3'][0];

	if ( isset( $variables['var3'][1] ) ) {
		$variables['var4']['func'] = $variables['var3'][1];

		if ( isset( $variables['var3'][2] ) ) {
			$variables['var4']['id'] = $variables['var3'][2];
		}
	}
}
Parameters
References: Variable 4


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 5 months ago #331740 by activha
Replied by activha on topic CB autoaction route triggers
OK the build code doesn't break now because you changed 
$action			=	$variables['var4']['action'];
to
$variables['var3'][]			=	$variables['var4']['action'];

But it does not work neither
the url displayed is :/MENU_ITEM/activity?id=ACTIVITY_ID instead of /MENU_ITEM/activity/ACTIVITY_ID as it should be

So I cannot test if the Parse code is working as of course it will retrieve the url with ?id=ACTIVITY_ID

My build code works fine to retrieve the activity object and build /MENU_ITEM/PARAM_TITLE_OF_MY_ACTIVITY_ACTIVITY_ID

This is the Parse code which does not seem to do anything though it seems correct.

Did you really get the route /MENU_ITEM/activity/ACTIVITY_ID with your code ? on joomla 4.2 ?
 

Please Log in to join the conversation.

1 year 5 months ago #331747 by krileon
Replied by krileon on topic CB autoaction route triggers
It rewrites URLs with the following structure for example.

&action=activity&func=show&id=123

It's just an example. It's not going to be all encompassing. The below would not fit the criteria of the example.

&action=activity&id=123

Notice the IF checks where they explicitly expect each of the query parameters. It checks for func and if that exists it checks for id. If func doesn't exist it won't check for 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.

1 year 5 months ago #331751 by activha
Replied by activha on topic CB autoaction route triggers
Yes I think I understand completely how it works.

But the issue seems to be that there is no func=show in CB Activity url
We display an activity by a menu item to the plugin which displays activity with a page limit to 1 . That's the only way we found to display a single activity.
This may be why the parsing function cannot reverse correctly the url ??

My build works correctly to issue an url /MENU_ITEM/TITLE_ACTIVITY_ID and as the first segment $segment[0] is the only one, my code should work to get the ACTIVITY_ID but it doesn't

And if I try to build something with your code and without the func, it fails also to reverse correctly.

Mind to check on your side without the func ?

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.222 seconds

Facebook Twitter LinkedIn