× Joomla Facebook Connect support forum

Topic-icon Detect if on Homepage

Active Subscriptions:

None
14 years 1 week ago #23189 by Ivan
Detect if on Homepage was created by Ivan
Hi,

In components/com_jfbconnect/controllers/loginregister.php , how can i detect if the user is on the homepage?

I noticed there is a function in libraries/sourcecoast/openGraph.php

private function isHomepage()


How can i call this function in loginregister.php to detect if the user is on the homepage. I want to only redirect users if they are in the homepage when they are connecting.


Ivan
The topic has been locked.
Support Specialist
14 years 1 week ago #23198 by alzander
Replied by alzander on topic Detect if on Homepage
Ivan,
That function is marked as private, so it will be impossible to call it without changing it's scope to public.

In all honesty, that function is just 3 lines. I'd recommend you use that code directly where you need it. Unfortunately, if you're calling it from the loginregister.php file, you're guaranteed to get a false (since that's not your home page). I think you'd really want to add your code to the /components/com_jfbconnect/models/loginregister.php file in the getLoginRedirect function. In there, you can check the redirect parameter that's coming from the previous page (where the user clicked the button) against your home page and do what you need to do there.

Hope that helps get you started!
Alex
The topic has been locked.
Active Subscriptions:

None
14 years 1 week ago #23243 by Ivan
Replied by Ivan on topic Detect if on Homepage
OKay,

I tried the 3 lines of code thats in the library folder and had no luck getting the active menu item. I do get the default but return null on active menu item. I guess i need to get that parameter and see.
The topic has been locked.