In an administrator account using the administrator panel i can create and edit content from content type Country. But when they are created from a script, and even if i own them, i can't edit if their origin is said script. I get the message "You are not authorized to access this page."

Already checked permissions (Admin can edit own content and any content) and rebuild them.

How country is created in code:

        $new_country = new stdClass(); 
        $new_country->type = "country_profile";
        $new_country->title = $country;
        $new_country->language = LANGUAGE;
        global $user;
        $new_country->uid = $user->uid;
        $new_country = node_submit($new_country);

        $new_country->status = NODE_PUBLISHED;
        $country_wrapper = entity_metadata_wrapper('node', $new_country);

  • It would help if you could post the script you used to create the node. – Parag Jan 22 at 21:21
  • Edited with it :) – Fabíola Jan 22 at 21:50
  • It looks like you are setting the owner to be the current user who is on the page. Shouldn’t you just set the uid to be 1? – Parag Jan 23 at 12:43

Browse other questions tagged or ask your own question.