× Joomla Facebook Connect support forum

Topic-icon Menu Routing Errors

11 years 3 months ago #29277 by chramb1
Menu Routing Errors was created by chramb1
There are two menu items available for facebook activity and settings.

index.php?option=com_jfbconnect&view=opengraph&layout=activity
index.php?option=com_jfbconnect&view=opengraph&layout=settings

When either of these two menu items are used, the proper controller is not being invoked. This results in the default JFBConnectController being called and not the proper JFBConnectControllerOpenGraph controller. As such, the wrong display() function is called. While this still ends up invoking the correct view, this means that calls to $view->setModel() are not made and the view fails as the models aren't populated.

In jfbconnect.php, you derive the controller using the "controller" query string argument which a Joomla menu item will never pass. You must use "view" for this purpose.

The fix is to change line 21 in jfbconnect.php to read as such:

$controller = JRequest::getCmd('controller', JRequest::getCmd('view', ''));

Since you use "controller" in your internal links, this will create a fallback condition whereby when controller is not found, it looks to see if view can be used. This will make the menu items work properly (and any others that you may create/use in the future).
The topic has been locked.
11 years 3 months ago #29279 by chramb1
Replied by chramb1 on topic Menu Routing Errors
Let's also take this a step further - since you create menu items using view/layout (as Joomla will do by default), your redirect settings in controllers really should match.

For example, on the open graph activity view/layout, there is a call to userdelete() which, after doing its job, does a setRedirect(). Unfortunately, this sets the redirect using the generic controller=opengraph query string.

While this works, it is NOT the same route for menu items. That means any site owner who sets up menu items will find, after deleting an open graph action, that the page displayed is an orphan. Module settings will not be respected and the URL will be different.

The setRedirect() in this case really needs to match what any menu item linked to this page would have. As such, the setRedirect() call really should look like this:

$this->setRedirect(JRoute::_('index.php?option=com_jfbconnect&view=opengraph&layout=activity', false));

This matches the properly-routed URL set by the menu and will return the user to the proper page, with the proper Itemid.
The topic has been locked.
Support Specialist
11 years 3 months ago #29284 by alzander
Replied by alzander on topic Menu Routing Errors
Christopher,
You're correct, we're doing it wrong. In 4 years of development, we've simply never had a front-end menu item.. so it's actually (crazy enough) still a little new to us. We'll be fixing this up in the upcoming bug-fix release for J1.5 and J2.5. When adding the front-end menu items for actions, we intentional let them show in the menu manager (instead of hiding them through the XML).. but then forgot to test the menu items.. obviously. Sorry about that!

We definitely appreciate the feedback. I also hope all these issues aren't getting you fed up and that JFBConnect is still getting you closer to where you want to be, and faster as well.

Thanks,
Alex
The topic has been locked.
11 years 3 months ago #29286 by chramb1
Replied by chramb1 on topic Menu Routing Errors

alzander wrote: We definitely appreciate the feedback. I also hope all these issues aren't getting you fed up and that JFBConnect is still getting you closer to where you want to be, and faster as well.


Totally put that out of your head. Your component is light years ahead of anyone else, and your support and attention to issues speaks volumes. It's a pleasure to work with you. I'm more than pleased to help out here on a bunch of these issues because I'm getting weeks worth of Facebook coding "for free" out of the purchase of the component (and, in reading your code, a good understanding of how it all works that's worth more than the $50 I'd pay for a book on the subject, if such a book even existed).

There's no question that I'm getting the bigger value side of this :-)
The topic has been locked.
Support Specialist
11 years 3 months ago #29289 by alzander
Replied by alzander on topic Menu Routing Errors
Glad to hear. We love the 'power users', like yourself, that really dig in, check, and extend things. Usually, that's a great thing for us and the users, but we like to check and make sure that we're reading the tone of the messages correctly. Never hurts to ask.

Our value is high from users like you as well as it's great having people looking over the code more in-depth and helping us to improve some admitted rough-edges.

Thanks!
Alex
The topic has been locked.