Solved: 1 Year, 11 Months ago [General] Odd MyBBTheme Cookie Behavior
Solved: 1 Year, 11 Months ago
Hello all,

I may have stumbled upon some odd behavior regarding the MyBBTheme cookie that is saved. I've done hours of digging into this, and I'm not entirely sure what's going on. I hope I'm simply missing something.

What I'm doing:
  • I have my main website ( and a development website on the same server.
  • I have the cookie domain, cookie path, and cookie prefixes all set up correctly as per the documentation. The cookiepath follows the folder path of my development site. I have a cookie prefix that exists on the development website.
  • I'm having no other issues whatsoever with cookies except for this one cookie.
  • This only affects guest users.
  • This inadvertantly causes MyBB to attempt to load templates for a theme that doesn't exist, falling back to the master (-2) templates on the dev website. Plugins do not modify these during installation, so this causes all sorts of issues for plugins on guest users.

When I select an alternative theme on my root domain (, it, as expected, saves the MyBBTheme cookie in the root domain. I do not have a MyBB theme cookie saved under the dev website (although other cookies for the dev website do correctly show. I can produce screenshots of this. )

However, when I go into my development website, it seems that MyBB is trying to pull the cookie from the main root-level cookie, despite otherwise ignoring root level cookies. Is this something anyone has stumbled upon when hosting two installations on the same MyBB server? I would not ordinarily be concerned, but it's causing some interesting issues testing out some plugins that are being developed.

I will add that I verified this by adding an "echo $mybb->user['style']" and having it spit out the style that it attempts to load for guest users. This value follows the value that is saved on the root level cookie. I will provide a link to the test forum by request.

Thank you in advance,
-Darth Apple

Edit: Solved.

Upon further digging, I did find that it indeed had some odd behavior with this particular cookie. However, setting a cookie prefix on my main root level forum, then deleting the original cookie solved the problem. If anyone else stumbles upon the same issue, make sure that both boards have a cookie prefix. It appears that MyBB first fetches cookies where it can find one with its prefix. If it can't find one with that prefix, it looks at the root level cookie and fetches that one instead.

This is solved, and can be closed!

Forum Jump:

Users browsing this thread: 1 Guest(s)