Is there a way to detect if a user is on the register page? I have been using "$context == 'main' " to detect if the user is on the home page and if he has left in order to determine which stylesheet to show, however "$context == 'main' " also seems to target the account registration page as well.
Is there something I can use to target only the home page or alternatively, something I can use to target the account registration page? I hope that made sense
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- PLai@plai
PLai - 0 likes
- Kevin Jardine@kevin
Kevin Jardine - 0 likes
- tcherokee@tcherokee
tcherokee - 0 likes
- Kevin Jardine@kevin
Kevin Jardine - 0 likes
- Khaled Afiouni@afiouni
Khaled Afiouni - 0 likes
- DhrupDeScoop@Dhrup2000
DhrupDeScoop - 0 likes
You must log in to post replies.The home page corresponds to 'pg/dashboard', so you can check the URL, I suppose. Alternatively, you can override the handler for the dashboard to sneak in your code. Something like this in a plugin xyz may work:
Putting
echo get_context();
in the registration page returns
register
so I think that's your answer.
:)
Thanks Kevin, learnt something new today :).
but when i put echo get_context(); on account/register.php, it returns
main
Weird... am I doing something wrong?
That's a bit weird. I put that code at the top of that page (Elgg 1.7) and that's what I get.
No idea why you are getting something different.
I imagine it's a server configuration thing.
It depends how you are accessing the register page... If through '/pg/register' get_context will return 'main' while if through '/account/register.php' get_contenxt() will return 'main' because context is set while handling the page request and not when accessing a view directly...
I am also interested in a solution if anybody has one :)
strpos($_SERVER["REQUEST_URI"],"/register.php")
?