Home >> Uncategorized >> WordPress "You don't have permission to do that" error

WordPress "You don't have permission to do that" error

by Chris

If you have a fresh install of WordPress with plugins deactivated and no special tweaks, it most certainly should not be telling you that you don’t have permission to do things. If it does:

This is a javascript error. I noticed the glitch when I was trying to create new categories – which is an Ajax function. A helpful user on the WordPress forums discovered the solution:

Go into your wp-includes/pluggable.php file. Find this code, or something very similar to it (mine was slightly different, but most of the lines were exact). Now, make a copy of this file before you proceed, because then if it screws something up horribly, you can fix it.

$cookie = explode('; ', urldecode(empty($_POST['cookie']) ? $_GET['cookie'] : $_POST['cookie'])); // AJAX scripts must pass cookie=document.cookie
foreach ( $cookie as $tasty ) {
if ( false !== strpos($tasty, USER_COOKIE) )
$user = substr(strstr($tasty, '='), 1);
if ( false !== strpos($tasty, PASS_COOKIE) )
$pass = substr(strstr($tasty, '='), 1);
}

Replace it with:

$user = $_COOKIE[USER_COOKIE];
$pass = $_COOKIE[PASS_COOKIE];

Related posts:

  1. Fantastic PHP trick to fix permission errors
  2. Hide from the Google Cookie with Bookmarklets
  3. Matt’s Perplexing Response to the WordPress Spam Issue
  4. Google's My Search History – Big Bro is watching
Updated: May 16, 2007, first published: Posted in Uncategorized.

Leave a Comment

Previous post:

Next post: