Jump to content
Sign in to follow this  
Pip

Setting page creator via API

Recommended Posts

Hi everyone, 

I'm trying to work on automatically creating a page when a user signs up. 

Thing is the page created will be automatically assigned to them as the creator. How do I assign it to a different user? 

Been testing out various codes but it still wont work. Any idea? 

$memberpage = wire('pages')->add("blank", "/member/", ['title' => $user->name, 'name' => $user->name ]);
						$memberpage->set("createdUser", wire("users")->get("bobot"));
						$memberpage->save(); 

bobot is my user where I would like to set the page creator as. 

Sorry. Totally new on this. 

Thank in advance. 

Share this post


Link to post
Share on other sites

Check the "Advanced" tab in the Template settings. There you'll find an option to make the createdUser modifiable:

Quote

When checked, pages using this template will have an option to change the 'created by user' (for superusers only). It will also enable the $page->createdUser or $page->created_users_id fields to be saved via the API.

 

  • Like 6

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...