William Buchanan
William Buchanan

Reputation: 3

User Is Logged Out When Generating PDF with DomPDF & Joomla 2.5

I have integrated DomPDF with a Joomla site that I am working on. I followed the Creating PDF Views article to achieve this and generating PDFs works well except that when the link is clicked and the PDF is generated from the component the user is logged out. I am using Joomla 2.5 & DomPDF 0.6.0 beta 3, the content for the PDF is generated from a custom component but right now it is just flat HTML and follows the instructions in the article for generating the view. I have looked at the code but can't seem to see where the problem is. Any help is greatly appreciated.

EDIT: The user does not get logged out if 'Remember Me' is checked on login. Also didn't mention that I am using Database as the setting for sessions.

Upvotes: 0

Views: 265

Answers (1)

Jobin
Jobin

Reputation: 8282

Check the custom component that clearing the user object or not.

Any where session_destroy() or unset($user) or any other Factory call to reset the user object.If you can't find such a statement then the make sure the problem with that PDF creation.

In no way you can't get solution then try this.

Before creating PDF section current logged user object id set to Cookie you mentioned that it was not clearing remember me option.

$user = &JFactory::getUser();
echo $user->id //current logged user id.

and the process PDF again put it back to user object like.

$user = &JFactory::getUser($user_id);//from cookie.

This is not a perfect fix but your problem will solve.

Hope this will help..

Upvotes: 1

Related Questions