SMF Support > SMF 2.0.x Support
Custom Application Form
(1/1)
cddude:
Hey all.
I am currently working on a custom application form for my community, and I have just finised the HTML part of it, but I'd like some help with the PHP file.
I know what functions to use, but I don't know how to use them. I have read the function database, but it doesn't really help me with the little skills I have in php. I would appreciate it if someone could write how I would need to use these functions (syntax) and how to call them (include or require??)
Here is a very simple example of the html form:
--- Code: ---<h1>ACCOUNT CREATION</h1>
Username: <input type="text" id="uname" size="20" />
Email: <input type="text" id="email" size="20" />
Password: <input type="password" id="pwd" size="20" />
<br />
<br />
<h1>MEMBER QUALIFICATION</h1>
Age: <input type="text" id="age" size="20" />
How can you contribute?: <textarea cols="15" rows="5" name="contribute">
Past gaming experiences: <textarea cols="15" rows="5" name="experiences">
--- End code ---
And here is what I want to do:
1. Include and use SMF function that will register an (unapproved) account with:
Username: value of "uname"
Password: value of "pwd"
Email: value of "email"
2. Create a new topic on forum on board with id "1" with the following BBC template:
--- Code: ---[size=20]ACCOUNT CREATION[/size]
[b]Username:[/b] <value of "uname">
[b]Email:[/b] <value of "email">
[b]Password:[/b] <value of "pwd">
[size=20]MEMBER QUALIFICATION[/size]
[b]Age:[/b] <value of "age">
[b]How can you contribute?:[/b] <value of "contribute">
[b]Past gaming experiences:[/b] <value of "experiences">
--- End code ---
I have made the 2nd part before, but that was by just inserting data into the database ( :P) which worked fine, but I'd prefer to do it the proper way this time by calling the appropriate function.
Some of you might be thinking that the "Custom Forms Mod" is the solution, but I have used this in the past and it does not have the features I need (such as conditional enable/disable of form fields, jQuery, etc). So that's why I am looking for this custom solution.
Thanks for all help in advance!
/cddude
Kindred:
this should be moved to coding discussion...
you also probably want to look into the API
cddude:
UPDATE:
Okay, I managed to get the createTopic() function to work fine.
Could someone tell me though what functions I'll need to look at for the user registration?
Which function should I use? The register2() or the registerMember()?
Also, is there a function that checks for existing usernames? I don't want someone registering with my name, overwriting my account! :P
Cheers.
Suki:
registerMember() is what you need to use, the function also takes care of checking for existing members
http://support.simplemachines.org/function_db/index.php?action=view_function;id=594
$regOptions is a large array so take a look at the code in Sources/Subs-Members.php to see all the keys it needs.
Navigation
[0] Message Index
Go to full version