Jump to content

Recommended Posts

Posted

Hi,

 

How do I create a page with another user than the user currently logged in as?

Example.

 

Im logged in as Simon (superuser) and would want to create a page in the name of Jesper(regular) user.

I could of course set a custom field named userid in the form but is there another way?

 

So if I would select Jesper from the dropdown of users it would add Jespers ID to the page.

 

Am I on the wrong track?

 

Couldn't find a answer by googling.

 

 

Coming back to PW from a 6 year long break! :D

Posted

On "Advanced" tab of a template settings page, you can enable setting ' Allow the 'created user' to be changed on pages?' Than you will be able to change 'create user' on settings tab on page edit page. 

  • Like 1
Posted

Allowing the user to be changed in the template is still necessary when you use the API, though you might get by if you temporarily set the flag. Then assign created_users_id the id of Jesper.

// set up your new page, then...
$page->template->allowChangeUser = true;
$page->created_users_id = (int)$input->post->creatorid; // or however the input is named in the form
$page->save();

 

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...