Welcome Guest, Not a member yet? Register   Sign In
Need support on Shield
#1

Hi All,

I want create a profile section using the Shield library. Created a new table that can hold profile data. Now I just want to add the newly created member ID to link between the user table and the profile table automatically when the registration take place. Any idea how I can run a function to update this new table with out modifying Shield's core files using shield base registration flow?

thank you in advance.
Reply
#2

(This post was last modified: 02-07-2024, 10:50 AM by InsiteFX.)

You should be able to use the Auth Helper and get the user or users ID.

Then use that as your promary key for your profile table.

PHP Code:
// get the current user
auth()->user();

// get the current user's id
auth()->id();
// or
user_id();

// get the User Provider (UserModel by default)
auth()->getProvider(); 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

Thanks InsiteFx but I was looking for a method to chain a new function right after member creation happens from core shield function with out editing the core files. I hope that's clear.
Reply
#4

Customize User Provider:
https://shield.codeigniter.com/customiza..._provider/
https://github.com/codeigniter4/shield/b...rModel.php
and add a model event for it.
https://codeigniter.com/user_guide/model...del-events
Reply




Theme © iAndrew 2016 - Forum software by © MyBB