Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: rcane on June 01, 2022, 05:25:36 PM

Title: Looking for opinions on the most efficient way to grab profile data.
Post by: rcane on June 01, 2022, 05:25:36 PM
I've added some custom profile fields (2.0.19) for zipcode and the +4 zip code.

I have some curl code to go to a public house.gov site and grab their rep / district / etc.

I was trying to see what would be the most efficient way to get all users' info into a separate DB/table I have.

The two methods that came to mind where to: 

1. use a cron job on the entire members table  (and themes table) or
2. somehow tie it to the "change profile" button on the user' profile page.

#1 seems like a lot of repetitive work  (unless I had mySQL ignore id_members that already have an entry)--but it's still running periodically, multiple times a day.

#2 seems cleaner because upon making a change to their profile (even if they did something small like update their avatar) the job would be small and only limited to the number of times "change profile" is pressed throughout the day (which I think would be small)

And, I'd have to manually run reports to check on the cron job method to know when to turn it off--else risk turning it off on a certain date and risk missing data.


If #2, where is the "change profile" button in order to have an 'include/magic.php' and a function called at button press?
 
I'm interested in any opinions.

Title: Re: Looking for opinions on the most efficient way to grab profile data.
Post by: vbgamer45 on June 01, 2022, 07:05:12 PM
I would have a table with the house.gov table.

Are you linking the data via the zip code from the custom profile table in smf? Or another field?
Title: Re: Looking for opinions on the most efficient way to grab profile data.
Post by: rcane on June 04, 2022, 04:55:12 PM
Quote from: vbgamer45 on June 01, 2022, 07:05:12 PMI would have a table with the house.gov table.

Are you linking the data via the zip code from the custom profile table in smf? Or another field?


No, not in the custom profile.  I was going to build a table in a separate DB and access from there.

I just wanted the php to run when they "change profile".
Title: Re: Looking for opinions on the most efficient way to grab profile data.
Post by: vbgamer45 on June 04, 2022, 05:32:26 PM
That seems like the best way.
2. somehow tie it to the "change profile" button on the user' profile page.

Would be the best way. Its not that much work to link the data on change profile/trigger the update


For 2.0.x custom field data is updated in function makeCustomFieldChanges($memID, $area, $sanitize = true)
Sources\Profile-Modify.php(1382): // Make those changes!