Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 21 May 2016, 18:20
heat23 heat23 is offline
 
Join Date: Mar 2016
Profile field save hook?

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?

Last edited by heat23; 21 May 2016 at 18:31.
Reply With Quote
  #2  
Old 21 May 2016, 18:36
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Real name: Mark
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.
__________________
Former vBulletin.org Staff Member



Support for my products (as well as updates/new product publishing) has been moved to MHB - vBulletin Products and TAZ - Add-ons
Reply With Quote
  #3  
Old 21 May 2016, 21:47
heat23 heat23 is offline
 
Join Date: Mar 2016
Originally Posted by MarkFL View Post
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

Last edited by heat23; 21 May 2016 at 21:55.
Reply With Quote
  #4  
Old 21 May 2016, 21:50
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Real name: Mark
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.
__________________
Former vBulletin.org Staff Member



Support for my products (as well as updates/new product publishing) has been moved to MHB - vBulletin Products and TAZ - Add-ons
Reply With Quote
  #5  
Old 21 May 2016, 22:10
heat23 heat23 is offline
 
Join Date: Mar 2016
Originally Posted by MarkFL View Post
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
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 22:46.

Layout Options | Width: Wide Color: