Search the Community
Showing results for tags 'add field value'.
-
Reference: PW 3.0.111 and uikit3 based site using the Regular-Master profile. I am trying to create a process whereby when a user logs in to their profile page (the user is automatically redirected to their profile page on login) and they then go to their 'members' page and creates a child page ('club-member'), the data stored in the user template ($user->usercode) is automatically added to the equivalent field on the club-member page. This will be applicable only to the template used for the 'club-member' pages. Once the new page has been created the equivalent 'usercode' field on the 'club-member' page should not be subsequently editable. Below is the page hierarchy for visual reference: Login (home) |__ profile |__ members |__ club-members It seems like an AddHookBefore might be the solution here such as: wire()->addHookBefore("Pages::saveReady", function($event) { $page = $event->arguments(0); if($page->template == 'club-member') { $clubcode = $user->club_code; $field = $page->club_code; $field->set('value', $clubcode); } }); I am I on the right track or is there a better way to achieve this? Any thoughts appreciated.
-
- pw3
- add field value
-
(and 1 more)
Tagged with: