Search code examples
phpurlloggingjoomlauserid

Joomla/PHP logging out if ID not in URL


So I have looked into the problem but it doesn't seem to have a solution in the Joomla forums.

logging out automatically

Keeps logging out

The issue I am getting is narrowed down to the URL. If the var &ID= is set in the URL it is okay, if not it logs out. In both cases I am doing a $_SESSION dump, and it confirms that the $user->id is set to 0. Don't know why it is logging out.

Any solutions are welcome, this is a problem that has been avoided for some time.


Solution

  • Solution. I can only say for certain that this is the likely solution, but it should be helpful to people looking at this post.

    There is a compatibility issue between legacy templates (1.0) in Joomla 1.5.x and the JUtility method getToken().

    This is used in the login form apparently. So find it in the file and replace:

        <input type="hidden" name="<?php echo JUtility::getToken(); ?>" value="1" />
    

    with:

        <input type="hidden" name="<?php echo JHTML::_( 'form.token' ); ?>" value="1" />
    

    This is not the issue I was seeing, my issue was with the login, but with a registration component that makes much use of the JUtility::getToken() Class::method. I know that it is this as uninstalling the component solves the issue. However since I haven't tested any solutions within the component, I will not say absolutely that this is the solution.

    Hope the post helps.
    Thanks to those who answered.