WordPress.org

Ready to get started?Download WordPress

Forums

WP 2.1 - "you don't have permission.." (37 posts)

  1. philjette
    Member
    Posted 7 years ago #

    Sorry guys I hate to bring this up again, but I've searched everywhere and nothing works.
    I've installed 2.1, and I'm unable to create categories or delete posts. I always get the famous "you don't have permission to do that" error.
    I tried installing both through fantastico as well as manually, I've cleared cookies from both IE and Firefox, I'm sure I'm in the Admin account, and still nothing works.
    I should also mention my DB user has all required privileges.

    Thanks alot for taking the time to read my post :)

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Got any plugins running? Try disabling them.

  3. philjette
    Member
    Posted 7 years ago #

    Nope, no plugins running.

  4. angewa
    Member
    Posted 7 years ago #

    I've got the same problem. No plugins, cleared cookies, and I'm triple postive that I'm set as Administrator.

    Hope someone figures this out soon.

  5. philjette
    Member
    Posted 7 years ago #

    I'm really running out of ideas here, which is too bad because I really wanted to us WP for my site

  6. Bucker
    Member
    Posted 7 years ago #

    This worked for all my problems with wordpress 2.1. Make another account with full site admin powers and take away admin from your old account and then give it back. Sounds stupid but it did the trick and everything seems to work fine now.

  7. philjette
    Member
    Posted 7 years ago #

    Hi Bucker
    Thanks alot for the tip, but I tried that to no avail. This is quite odd, nothing seems to work. Could it be file permissions?

  8. emvee
    Member
    Posted 7 years ago #

    Re-applying the adminstrator role to my admin user id solved my problems with adding categories and deleting posts.

  9. PetLvr
    Member
    Posted 7 years ago #

    Hmm .. emvee's suggestion seemed to work for me

  10. miletjs
    Member
    Posted 7 years ago #

    didnt work for me

    im so desperate i tried all the tricks to no success

    the only trick that worked is disabling javascript in firefox

    but as you all know i cant just disable it because some if not most of wordpress core files need javascript

    so now am terribly helpless!

  11. DeathEater
    Member
    Posted 7 years ago #

    Oh re-applying permission is working! But it's tricky. You should first set different role for your account then immediately (without logout or something) give you again administrator privilegies! Then I successfully added category!!!

  12. miletjs
    Member
    Posted 7 years ago #

    I tried this but it didnt work for me :(

  13. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    What is the exact error message that you are getting? I searched through the code, and there's no such error as "you don't have permission to do that".

  14. seanwedig
    Member
    Posted 7 years ago #

    I'll throw in as well... also getting this error on a fresh install of 2.1 - no plugins, no cache, etc. I've tried re-asserting Admin rights, to no avail.

    @Otto42
    Actually - there is such an error. It's in the AJAX code, which can be found in /wp-includes/js/wp-ajax-js.php. It's in the JS method WPAjax.parseAjaxResponse... forgive me if I'm off - my JS is a bit rusty.

    I don't know the WP code at all, and my AJAX work is limited... but I'm looking for the code that actually handles the AJAX requests. It seems to be returning erroneous results, and denying permission when it shouldn't.

    Any help would be great, as it appears I'm not the only one running into the problem.

    -sean

  15. orliville
    Member
    Posted 7 years ago #

    I'm experiencing the same issue regarding adding categories.

  16. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Huh. I wonder how I missed that one.

    Anyway, the code that actually handles the ajax requests is in wp-admin/admin-ajax.php.

    And I think there's a bug there. It's checking for the "delete_post" capability, but the name of that capability is actually "delete_posts". Or not. I'm uncertain of that one.

  17. seanwedig
    Member
    Posted 7 years ago #

    Hmm... that's odd. I wonder why there aren't constants used in the code for that sort of thing... (I'm sure there's a good reason, it just seems odd to me that they don't define constants for things like that)

    It's weird, though, because in an installation on my local dev environment, it runs fine. But up on the server, it fails. Hmm... I think we should submit this as a bug, but I'm really having trouble getting enough information to help them reproduce it... :-/

    Thoughts? I hate to submit a bad bug report, but my newb-quality is leaving me with little to check on...

    -sean

  18. moshu
    Member
    Posted 7 years ago #

    If it wasn't a new install I'd say it might be related to the things described in this post...

  19. DeathEater
    Member
    Posted 7 years ago #

    In fact I was wrong. Heh, when activated the K2 theme the things gone back problematic. In fact the whole headache is coming from the prototype. When K2 theme is activated it replaces the HTML header and makes the link to prototype.js to points the version coming with K2 theme. The one coming with WP2.1 is prototype 1.5.0_rc0 the one w/ K2 is 1.5.0

    Dunno what's the "Big" difference in the file, but with DEFAULT theme it works okay for me, and of course when using DEFAULT prototype.js.So, this post could help in some case, but in mine (where can't administrate categories/delete posts) - it's a no-no!

  20. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    K2 is more than just a theme. It's a whole other beast. I suggest taking over to the K2 forums for their assistance.

  21. saucycowboy
    Member
    Posted 7 years ago #

    I was having the same issue and with the suggestion of prototype and themes really helped out. I copied the prototype.js from wp-includes/js/prototype.js in to the K2 prototype.js.php and everything worked fine.

  22. seanwedig
    Member
    Posted 7 years ago #

    Hmm... no solution yet, but I'm closer.

    wp-icludes/pluggable.php answers the ajax requests as well, with the line in the method check_ajax_referer which is calling wp_login with the user and password taken from the cookie. wp_login calls get_userdatabylogin, passing in the username passed to it.

    On my local machine, the username in $_POST['cookie'] is plaintext, and so do not cause get_userdatabylogin to fail. On the remote machine, though, it's giving a hashed username, which then causes get_userdatabylogin to return false, which leads to the AJAX request failing in check_ajax_referer.

    Is this the cause of everyone else's problems? Maybe, but I don't really know.

    Do I have a fix? No. I have no idea why one system is using the hashed username and the other is not. However, I think I now have enough information to write up a good enough bug report, and to supply more information as the devs need it.

    -sean

  23. seanwedig
    Member
    Posted 7 years ago #

    Well I think I found the problem (at least in my case). For some reason that I do not understand, instead of just using PHP's $_COOKIE array, the code in check_ajax_referer is manually parsing the cookie values out from $_POST['cookie']. I was so focused on the wp_login call, I was dumb and glanced right over that code.

    It was fixable by replacing the code

      $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);
    	}
    

    with simply

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

    This is in wp-includes/pluggable.php, lines 244 through 251 (in the function check_ajax_referer). A warning, though: I'm not a WP Dev, or even a WP guru, so change at your own risk!

    As for success, though - It worked for a few test cases that I could think of off the top of my head (adding other Administrators, deleting categories, deleting posts from the Manage page, etc). Those were the problems I was having, but it seems that this is a sporadic and problem that is pretty arbitrary... However, given that the way the manual parsing was done seems a bit unreliable, I think I could see this being the problem.

    I will see about posting a bug report soon.

    EDIT: I feel it important to state that I very well may have gotten this wrong, and that there's a very good reason that code was the way it was - I cannot guarantee that the change I suggest is safe or at all a good idea. :)

  24. ShadowKnight
    Member
    Posted 7 years ago #

    I have tried seanwedig's fix and seems to be working on my site aswell. Just beware seanwedig's warnings :)

  25. gertoft
    Member
    Posted 7 years ago #

    Thank you a thousand times, this was driving me crazy. I also tried to find the problem but got stuck. Especially since sometimes it worked just because I added a debug printout!?!?

  26. David
    Member
    Posted 7 years ago #

    It worked for me as well. And to say it again, heed the warnings.

    I appreciate the effort

  27. psi0
    Member
    Posted 7 years ago #

    Thanks for solve my problem, it worked :)

  28. seanwedig
    Member
    Posted 7 years ago #

    I'm glad it's fixing the problem for more people! :)

    By the way, I went ahead and entered a bug report for this item - #3807. Hopefully it will either get fixed as I suggest, or (if I'm wrong), get fixed the "right" way.

    -sean

  29. Zaldor
    Member
    Posted 7 years ago #

    YES!!! That fixed some of my problems, now if I can get PodPress to work with 2.1!

    Thank you for this fix!!!!!

  30. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    seanwedig: Actually, the use of _POST or _GET ['cookie'] would be correct. Check out line 13 of wp-ajax-js.php.

    Your suggested fix will only work in certain browsers. Some browsers do not send cookies for AJAX operations.

Topic Closed

This topic has been closed to new replies.

About this Topic