Advertisement:

Run custom script when a new member registers

Aloittaja bobdole2281, syyskuu 17, 2013, 10:46:02 AP

« edellinen - seuraava »

bobdole2281

I'm trying to run a custom script (very tiny) whenever a new member registers. Is this possible? I've been trying to locate the php file which contains most of this data, but can not find it. Any help would be appreciated.

Arantor

There are several ways this could be done depending on what actually needs to be done... so what do you need to actually do on registration exactly?
Holder of controversial views, all of which my own.


Burke ♞ Knight

More details are needed.
What is the script?
What exactly is it supposed to do?
Does it have a page you want them to go to?

bobdole2281

Nope, no re-direction. It's an SQL update statement. Will update a database I made. Updates a field from 0 to 1.

I want to add it at the bottom of the successful registering page. Would the file be in Themes somewhere? What other information would you like?

Arantor

Why does the database need updating? Why can't you just get the value from the main smf_members table?

The registration code is spread across multiple files. Database code should NEVER be in templates. EVER.
Holder of controversial views, all of which my own.


bobdole2281


Arantor

Well, if you were to explain what you were actually trying to do (rather than how you think you have to do it), maybe you'd get a better answer.
Holder of controversial views, all of which my own.


bobdole2281

Okay, so I need to run an Update SQL statement for a table I made (not usually in smf).

sql = "Update 'bobs_table' SET 'bobs_category' = 1 WHERE id = ".$membersID." "

So you said Database code should never be in templates. Where can I put it without breaking anything?

Arantor

No, that's just repeating what you already told me. You have added nothing to the *why*, only the *what*.

I can still think of three places this could go, one of which doesn't involve any PHP whatsoever.

Here's the real kicker, your statement makes absolutely ZERO sense. If you're doing a registration, the row only just got created. Unless you already pre-populated bobs_table with all possible values of member id (there are, in fact, 16,777,215 of these), the odds are that statement will do nothing because the row won't exist for it to update.

Now do you understand what I'm getting at? What is the point of doing this update? What is the purpose of the change you want to make? Is it to use this information somewhere else? (Because depending on THAT, SMF almost certainly already records it anyway, but since you never actually answer my questions, you won't get any real answers)
Holder of controversial views, all of which my own.


Advertisement: