Redirecting to a module from a UDT

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
psy
Power Poster
Power Poster
Posts: 463
Joined: Sat Jan 22, 2005 11:19 am

Redirecting to a module from a UDT

Post by psy »

I needed to do a front end redirect to the detail page of one module (ListIt2 custom instance) from an Event associated with another module (SelfRegistration - event onUserRegistered).

As per usual, I tried the obvious which failed, eg DoAction, then scoured the API docs, in particular Redirect and RedirectForFrontEnd. Neither worked. I then searched the forum and found this post from years ago: http://forum.cmsmadesimple.org/viewtopi ... orfrontend

OK, so the API docs are a bit out of date (?). Anyhoo, put the new method in my UDT and yes, it redirected to my module BUT the module failed to load as none of the $_GET $params were recognised.

Seems that the create_url method automatically HTML encodes - including the '&' for parameters.

Coding:

Code: Select all

 $url = $myLI2module->create_url($id, 'detail', $goto, $params, false, true);
Resulting url:

Code: Select all

http://www.mysite.com/index.php?mact=ListIt2MyCustomInstance,cntnt01,detail,0&cntnt01item=17&cntnt01template_detail=my_detail_template&cntnt01returnid=59
I put in a workaround to replace the '&' with simply '&' and it worked.

The action.detail.php of ListIt2 simply checks for the existence of a particular parameter, ie:

Code: Select all

if (!isset($params['item'])) {
    die('missing parameter, this should not happen');
}
The 'item' param was definitely included in my $params array and appeared in the URL. Still got the message 'missing parameter, this should not happen'.

Question is did I do something wrong in the UDT coding or is it a bug in the CMSModule method?

Using:
CMSMS v1.11.10
SelfReg: v1.8.2
ListIt2: v1.4.1
Post Reply

Return to “The Lounge”