0

I have a network blog and after the user has created a site they are getting an error when trying to save their post:

You need to login with a user that has edit posts capacity

Shouldn't they have edit posts capacity when they've created their account?

1
  • turn off your plugins and try again Commented Nov 9, 2015 at 5:37

2 Answers 2

1

Try this by keeping in current theme functions.php Change your roles instead of author

function add_theme_caps() {
    // gets the author role
    $role = get_role( 'author' );

    // This only works, because it accesses the class instance.
    // would allow the author to edit others' posts for current theme only
    $role->add_cap( 'edit_posts' ); 
}
add_action( 'admin_init', 'add_theme_caps');
6
  • I don't understand what is going on here. Does the theme have anything to do with edit permissions? Commented Nov 9, 2015 at 23:20
  • 1
    No there is a problem with some plugin in your site but if you didn't find the what's the errors we can revoke by adding filters in theme functions.php
    – maddog
    Commented Nov 10, 2015 at 8:39
  • OK. I will check that if problems persist. I think I found the problem was my own fault this time. Commented Nov 10, 2015 at 8:53
  • did your problem solved?
    – maddog
    Commented Nov 10, 2015 at 8:57
  • Yes. I had duplicated post to new user but old url was in post still. Could not save to other url site. Replaced old url with user url and save complete. Commented Nov 10, 2015 at 8:58
0

Short answer:
Incorrect URL. Was trying to save to the network path and not the user path.

Long answer:
I have a network blog. I have an examples blog with the default user. With the default user I made posts. When a new user signs up they get a copy of that post locally on the client side (JSON of the post data). It is a duplicate they can use to get started. When default user saves it works fine because he is at the default network path. When a new user saves it does not work because new user cannot save to default path. New user can only save to new user path.

Default user path:

http://www.example.com/networksite/

New user path:

http://www.example.com/networksite/newusersite/

The client side JSON object that was duplicated was trying to save to the original URL (this worked for default user who has same path):

http://www.example.com/networksite/

Once I updated the path to new users site:

http://www.example.com/networksite/newusersite/

...he was able to save the document.

The error message was correct. My code was incorrect. However, the error message could have contained more information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.