Advertisement
FEATURE REQ: Cookie settings in Global Configuration
-
- Joomla! Fledgling
- Posts: 3
- Joined: Sun Aug 17, 2008 9:11 am
- Location: Romania
- Contact:
FEATURE REQ: Cookie settings in Global Configuration
Domain cookie settings in Global Configuration under Site or System.
Could solve multiple issues with compatibility with 3rd party applications (bridges, forums, galleries and so on) that require logon on different subdomains.
Example:
- running main joomla site on joomla.somedomain.xyz
- a forum on forum.somedomain.xyz
- a gallery on gallery.somedomain.xyz
a) User is logging on Joomla:
- Joomla is setting cookie for joomla.somedomain.xyz
- (through bridges) cookies for forum and gallery are set for .somedomain.xyz
- logging succes for site / forum / gallery
b) User is logging on forum:
- cookies for forum are set for .somedomain.xyz
- in current configuration (through bridge) Joomla is setting cookie for forum.somedomain.xyz
- logging succes in forum - loggin failed in Joomla.
Solution:
Domain seetings for cookies in Joomla global configuration.
Setting manually Joomla cookies domain to .somedomain.xyz solve this. In case this parameter is not set, Joomla should behave like until now: set cookies for default domain.
Could solve multiple issues with compatibility with 3rd party applications (bridges, forums, galleries and so on) that require logon on different subdomains.
Example:
- running main joomla site on joomla.somedomain.xyz
- a forum on forum.somedomain.xyz
- a gallery on gallery.somedomain.xyz
a) User is logging on Joomla:
- Joomla is setting cookie for joomla.somedomain.xyz
- (through bridges) cookies for forum and gallery are set for .somedomain.xyz
- logging succes for site / forum / gallery
b) User is logging on forum:
- cookies for forum are set for .somedomain.xyz
- in current configuration (through bridge) Joomla is setting cookie for forum.somedomain.xyz
- logging succes in forum - loggin failed in Joomla.
Solution:
Domain seetings for cookies in Joomla global configuration.
Setting manually Joomla cookies domain to .somedomain.xyz solve this. In case this parameter is not set, Joomla should behave like until now: set cookies for default domain.
Advertisement
-
- Joomla! Fledgling
- Posts: 3
- Joined: Sun Aug 17, 2008 9:11 am
- Location: Romania
- Contact:
Re: FEATURE REQ: Cookie settings in Global Configuration
Problem solved.
If anyone from Joomla Team is interested just drop me a PM with info where to send the code.
If anyone from Joomla Team is interested just drop me a PM with info where to send the code.
-
- Joomla! Intern
- Posts: 57
- Joined: Thu Jul 10, 2008 9:10 pm
Re: FEATURE REQ: Cookie settings in Global Configuration
Where are the cookie settings configured in Joomla?
-
- Joomla! Fledgling
- Posts: 3
- Joined: Sun Aug 17, 2008 9:11 am
- Location: Romania
- Contact:
Re: FEATURE REQ: Cookie settings in Global Configuration
In default Joomla install is doesn't exists such feature.
I had to patch the code myself to implement it.
I had to patch the code myself to implement it.
-
- Joomla! Intern
- Posts: 57
- Joined: Thu Jul 10, 2008 9:10 pm
Re: FEATURE REQ: Cookie settings in Global Configuration
So there is not a way to configure the cookies - can you explain how you did it or is it too complicated?
-
- Joomla! Apprentice
- Posts: 28
- Joined: Tue Mar 25, 2008 3:10 pm
Re: FEATURE REQ: Cookie settings in Global Configuration
I would love to know too!! We're running into problems with JFusion and some cookies having www and others now.
-
- Joomla! Apprentice
- Posts: 5
- Joined: Fri Jun 26, 2009 10:36 pm
- Location: Macedonia
Re: FEATURE REQ: Cookie settings in Global Configuration
Hi! I posted this solution in the JFusion forums; I am posting it here as well. I hope it helps.
To fix the login issue, two problems need to be solved: setting cookies and opening sessions. We need to tell Joomla to always use our top domain (and not subdomains) for these operations.
Be sure to replace mysite.com with your actual domain name below.
Fix Sessions:
File to edit:
\libraries\joomla\session\session.php
Find the two occurences of the line:
Add the following code on a new line right before session_start() is invoked:
Fix Cookies:
Files to edit:
/libraries/joomla/application/application.php
/libraries/joomla/session/session.php
/plugins/system/remember.php
Find all the occurences of the setcookie(...) function in the files above.
Add an additional (domain) parameter: '.mysite.com'
Examples:transforms into
transforms into
I am aware that this is not the most elegant solution, but it gets the job done. I hope this will help many site owners use the wonderful JFusion extension. Thanks to the JFusion team for bringing us this wonderful piece of software.
Greetings from Macedonia.
To fix the login issue, two problems need to be solved: setting cookies and opening sessions. We need to tell Joomla to always use our top domain (and not subdomains) for these operations.
Be sure to replace mysite.com with your actual domain name below.
Fix Sessions:
File to edit:
\libraries\joomla\session\session.php
Find the two occurences of the line:
Code: Select all
session_start();
Code: Select all
ini_set('session.cookie_domain','.mysite.com');
Files to edit:
/libraries/joomla/application/application.php
/libraries/joomla/session/session.php
/plugins/system/remember.php
Find all the occurences of the setcookie(...) function in the files above.
Add an additional (domain) parameter: '.mysite.com'
Examples:
Code: Select all
setcookie(session_name(), '', time()-42000, '/');
Code: Select all
setcookie(session_name(), '', time()-42000, '/', '.mysite.com');
Code: Select all
setcookie( JUtility::getHash('JLOGIN_REMEMBER'), false, time() - 86400, '/' );
Code: Select all
setcookie( JUtility::getHash('JLOGIN_REMEMBER'), false, time() - 86400, '/', '.mysite.com' );
Greetings from Macedonia.
Forum signature rules: viewtopic.php?f=8&t=65
-
- Joomla! Apprentice
- Posts: 28
- Joined: Tue Mar 25, 2008 3:10 pm
Re: FEATURE REQ: Cookie settings in Global Configuration
Thank you so much!!
We did a change to .htaccess to rewrite all url's without the www in front of them
Here it is:
# Redirect all www requests to non www, to solve canonical issues
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule (.*) http://%1/$1 [R=301,L]
Before we did this bout half our cookies were being set with www and half without. This was causing Joomla to log out every once in a while, and for some users never log in. VirtueMart seems to set both www and non-www cookies. The only problem left was after you clear all cookies, you get a session expired message the first time you try to log in, and I think you just supplied the fix for that. Thank you!!!
With that .htaccess change all cookies are set without the www. I'm not technical enough to know why, but it works.
In JFusion we used cookie domains of .mysite.com.
Thanks again for sharing!
We did a change to .htaccess to rewrite all url's without the www in front of them
Here it is:
# Redirect all www requests to non www, to solve canonical issues
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule (.*) http://%1/$1 [R=301,L]
Before we did this bout half our cookies were being set with www and half without. This was causing Joomla to log out every once in a while, and for some users never log in. VirtueMart seems to set both www and non-www cookies. The only problem left was after you clear all cookies, you get a session expired message the first time you try to log in, and I think you just supplied the fix for that. Thank you!!!
With that .htaccess change all cookies are set without the www. I'm not technical enough to know why, but it works.
In JFusion we used cookie domains of .mysite.com.
Thanks again for sharing!
-
- Joomla! Apprentice
- Posts: 28
- Joined: Tue Mar 25, 2008 3:10 pm
Re: FEATURE REQ: Cookie settings in Global Configuration
This might be silly question.. but what parts of the following do I substitute my own information??
ini_set('session.cookie_domain','.mysite.com');
Do I replace cookie_domain and .mysite.com??
ini_set('session.cookie_domain','.mysite.com');
Do I replace cookie_domain and .mysite.com??
-
- Joomla! Apprentice
- Posts: 5
- Joined: Fri Jun 26, 2009 10:36 pm
- Location: Macedonia
Re: FEATURE REQ: Cookie settings in Global Configuration
In the line:
Replace only mysite.com with your actual site. Don't forget that second dot.
Example:
Code: Select all
ini_set('session.cookie_domain','.mysite.com');
Example:
Code: Select all
ini_set('session.cookie_domain','.thehulaqueen.com');
Forum signature rules: viewtopic.php?f=8&t=65
-
- Joomla! Apprentice
- Posts: 28
- Joined: Tue Mar 25, 2008 3:10 pm
Re: FEATURE REQ: Cookie settings in Global Configuration
I've just done some more testing... our .htaccess fix solved our login issues... I was thinking I needed to do the session fix above, but realized my session issue was pretty small.
For me to get the session expired message I have to:
- Log out of the site
- Clear all cookies
- Attempt to login again
If I close the browser, then navigate to the site again, first time login works.
Using cookies of .mydomain.com we are successfully bridging Joomla, PHPBB and Virtuemart.
Yahhh!
For me to get the session expired message I have to:
- Log out of the site
- Clear all cookies
- Attempt to login again
If I close the browser, then navigate to the site again, first time login works.
Using cookies of .mydomain.com we are successfully bridging Joomla, PHPBB and Virtuemart.
Yahhh!
-
- Joomla! Intern
- Posts: 53
- Joined: Sat Sep 17, 2005 6:08 pm
- Location: Portugal
Re: FEATURE REQ: Cookie settings in Global Configuration
I am using JFusion login module to login and this don´t works (joomla and vBulletin).
Actually, I was logged in Joomla and now I cannot logout, nothing appends if I click on the button!
Actually, I was logged in Joomla and now I cannot logout, nothing appends if I click on the button!
-
- Joomla! Intern
- Posts: 53
- Joined: Sat Sep 17, 2005 6:08 pm
- Location: Portugal
Re: FEATURE REQ: Cookie settings in Global Configuration
After delete cookies this issue login/logout works, only in joomla. Dual login still don´t works.
-
- Joomla! Apprentice
- Posts: 28
- Joined: Tue Mar 25, 2008 3:10 pm
Re: FEATURE REQ: Cookie settings in Global Configuration
Sounds like you have some JFusion settings to fix! It took us many tries to get it all properly configured. Good luck. Alan who works with JFusion does paid work... maybe he'd help.
-
- Joomla! Fledgling
- Posts: 3
- Joined: Mon Nov 16, 2009 8:00 am
Re: FEATURE REQ: Cookie settings in Global Configuration
Doing what mihajlovski suggested seemed to have worked until I realized I was having this problem:
http://forum.joomla.org/viewtopic.php?f=433&t=461048
http://forum.joomla.org/viewtopic.php?f=433&t=461048
-
- Joomla! Apprentice
- Posts: 5
- Joined: Fri Jun 26, 2009 10:36 pm
- Location: Macedonia
Re: FEATURE REQ: Cookie settings in Global Configuration
The issue you are having is just how Joomla behaves. A fresh Joomla installation will do the exact same thing (at least on my server).jkellz wrote:Doing what mihajlovski suggested seemed to have worked until I realized I was having this problem:
http://forum.joomla.org/viewtopic.php?f=433&t=461048
Forum signature rules: viewtopic.php?f=8&t=65
Advertisement