vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Profile field save hook? (https://vborg.vbsupport.ru/showthread.php?t=322690)

heat23 05-21-2016 03:20 PM

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?

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

Quote:

Originally Posted by MarkFL (Post 2571124)
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

Quote:

Originally Posted by MarkFL (Post 2571137)
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 :(


All times are GMT. The time now is 12:52 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02586 seconds
  • Memory Usage 1,717KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete