Steven Word
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Can’t access dashboard; getting two errorsSame here, but I’m with 2.9.2.
Same exact errors:
ABSPATH is never defined and then if I define it, I get the get_option() function undefined.
Anyone figure this out?
Some Testing:
<?php $included_files = get_included_files(); echo '<pre>'; print_r($included_files); echo '<pre>'; ?>
The Output:
Array
(
[0] => /home/somepath/public_html/blog/wp-admin/index.php
[1] => /home/somepath/public_html/blog/wp-admin/admin.php
)This shows wp-load.php is never loaded.
Forum: Fixing WordPress
In reply to: Session Variables Set Twice? Crazy behavior!@a.dysl
Now that makes perfect sense! I wish I had thought to ask you if you were cashing your HTML sooner.
In all likely hood, setting you session was working fine, but you’re Caching plugin was returning the values from the last cache rather live!
That was definitely your problem. You should be able to strip out the
session_regenerate_id(); and then add an exception to your caching plugin (or disable it).Forum: Fixing WordPress
In reply to: Session Variables Set Twice? Crazy behavior!@a.dysl
That is great news! I know how frustrating code can be when you just can’t figure out WHY something is not working like you think it should.
I wish I could have provided more help there at the end, but I’m glad I was able to offer SOME assistance.
It looks like we both learned something new this week. Cheers to that!
Forum: Fixing WordPress
In reply to: Session Variables Set Twice? Crazy behavior!I understand what you are saying.
The output shows that your session is starting correctly.
Session variables are usually set for each browser. If you logout a user you will need to destroy the session with session_destroy). I would use a filter on the logout hook to do this.
Try it with two browsers, ie. firefox for one user, and chrome for a 2nd user. It should show the variables different for two different users.
Forum: Fixing WordPress
In reply to: Session Variables Set Twice? Crazy behavior!Put this at the top of your header.php and paste the output in a comment:
<?php echo "Register Globals: ".ini_get('register_globals')."<br/>"; session_start(); $_SESSION['test'] = 'foobar'; print_r($_SESSION); ?>
Forum: Fixing WordPress
In reply to: Session Variables Set Twice? Crazy behavior!@a.dysl
I started the session by calling session_start() in header.php but wp-settings.php would be fine. Just as long as it’s called before you set / get your session variable. If you place it in wp-settings.php, it will be applied of your themes.
It turns out that my CSS was using an @import clause to a bad location. I read online of someone else having an experience with session variables in wordpress caused by a bad ‘favicon’ link in the header. I started taking the code apart, line by line, and found that I was able to stop the double submit by removing my stylesheet include statement.
I conclude that the problem is called when you reference a bad file with an include or style declaration.
For example, if you were to reference a file incorrectly:
<link rel="stylesheet" href="<?php bloginfo('url');?>/badfile.css" type="text/css" media="screen" />
instead of
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url');?>/style.css" type="text/css" media="screen" />
the browser would try to open https://www.domain.com/wp-content/your-theme/badfile.css which doesn’t exist. What would happen instead is that it would hit the 404 page, which in turn calls the header (where I am setting my session variable).
By including or referencing a bad HTML location I was hitting the 404 page and setting my session variable twice. Once for the page I’m loading, and then again for the 404 page (caused by mistyping my stylesheet path).
Forum: Fixing WordPress
In reply to: Session Variables Set Twice? Crazy behavior!Update:
It turns out that something in my stylesheet is causing the problem.
If I remove it, it works again. Weird!