PDA

View Full Version : Profile field save hook?


heat23
05-21-2016, 03:20 PM
I am creating a product that adds a new profile field. When the user changes this value, I would like to run some custom PHP code. Can anyone tell me the the name of the hook to do this?

Bonus question: For my product, I want to add a Scheduled Task, is the only way to do that is by running a SQL INSERT or is there a more graceful way?

MarkFL
05-21-2016, 03:36 PM
Try the hook "profile_updateprofile" to answer your first question.

For running schedules tasks, you can attach code to be run to your cleanup tasks...examine the hooks beginning with "cron_" depending on how often you want the code to be executed.

heat23
05-21-2016, 06:47 PM
Try the hook "profile_updateprofile" to answer your first question.

For running schedules tasks, you can attach code to be run to your cleanup tasks...examine the hooks beginning with "cron_" depending on how often you want the code to be executed.

Thanks Mark. I tried using profile_updateprofile but it doesn't seem to be firing my plugin code. When saving a profile, it is actually going to ajax.php:

if ($_POST['do'] == 'profile_updateprofile')
{
....
}

However, there is no "hook" statements in here.

UPDATE
I think I need to use "ajax_complete" hook...trying it now

MarkFL
05-21-2016, 06:50 PM
Yes, the hook I cited only works if the user is updating their profile from the settings page, not from their "About Me" on their profile page.

heat23
05-21-2016, 07:10 PM
Yes, the hook I cited only works if the user is updating their profile from the settings page, not from their "About Me" on their profile page.

I guess I would need to make my code work in both places. Seems like ajax_complete would work when updating the 'About Me' page, but it didnt :(