XF 2.0 Config Cookie

Hi,

On XF1 the config.php file contains the cookie configuration that was editable in the config.php file.

Code:
// COOKIES WILL WORK ON ANY SUBDOMAIN OF yoursite.com, WITH OR WITHOUT www
$config['cookie'] = array(
    'prefix' => 'xf_',
    'path' => '/',
    'domain' => '.mydomain.com'
);

How to do with XF2, because adding the following line does not change my subdomain problem.

My configuration is:

www.mydomain.com
forum.mydomain.com

I need to know under www.mydomain.com which member is connected to XF2.

Thanks
 
I use this :

Code:
$visitor = \XF::visitor();

$welcome = '';

if ($visitor->user_id) {

    $welcome = 'Hello ' . $visitor->username . "\n<br>";

}

\XF::dump($visitor);

echo $welcome;

It's ok on forum.mydomain.com, but it does not work on www.mydomain.com
 
After a test from www.mydomain.com, I find the following error in the XF logs

Code:
ErrorException: Fatal Error: Class 'XenForo_Session' not found /home/wwwmydomain/www/xf2/user.php:20
Generated by: Unknown account Dec 18, 2017 at 10:27 PM

Stack trace
#0 [internal function]: XF::handleFatalError()
#1 {main}
Request state
array(4) {
["url"] => string(13) "/xf2/user.php"
["referrer"] => bool(false)
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
 
Hi @Mike ,
I use /src/config.php file it's correct ?

Regarding the version of the script, it works perfect on the hosting of the forum (forum.mydomain.com), but it returns this error since the hosting of the site (www.mydomain.com)

Regards,
 
That's the correct file. I tested the code you entered locally and it applied without issue. If you're sure you edited the correct file, then perhaps you have an opcode cache that doesn't automatically apply changes.

As for that user.php script, it's definitely not designed for XF2 and thus won't work. It needs to be rewritten for the XF2 framework.
 
I'm afraid I can't really debug a full arbitrary script. If you have specific questions about converting elements to the XF2 approach, you may wish to post them in this forum.

In terms of the cookies, I could only recommend confirming that you have change src/config.php. If you're positive the correct code is in there, then I would look at your opcode cache.
 
Back
Top Bottom