TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,911
  • Total Topics: 21,307
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 730
  • Total: 730

[Done!] Join Us! form

Started by mebymyself, October 19, 2006, 08:10:13 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

OzButcher

#80
I thought of a extra feature... But I'm not sure how easy it is to add. :)

Our clan is getting 5-7 new applications a day and we are finding it a bit tiresome having to manually send a comprehensive "New Recruit" email which includes information on how to setup our in-game communications, rules, recruiting process etc.

Is it possible to automatically send a pre-formatted letter to new applicants after they hit the Send Application button?

junkenstein

I just wanted to say thank you for this great script!
It works really well on my site, but i have 1 little problem.
Every time a new user submits a new application, then on the forum there will  be alot of spaces before the input text.
Does anyone have any idea where to change that?
Thanx in advance :)

hsdk

Quote from: junkenstein on December 05, 2006, 01:51:57 PM
I just wanted to say thank you for this great script!
It works really well on my site, but i have 1 little problem.
Every time a new user submits a new application, then on the forum there will  be alot of spaces before the input text.
Does anyone have any idea where to change that?
Thanx in advance :)

reformat the output, and remove the table tags.

junkenstein

Thanks for the answer but i have no idea what you are talking about lol
Here's a copy of my phpfile, it would be really sweet if you could give me any tips :)

if ($context['user']['is_guest'])
{
   echo
   '<h5>Access Denied</h5>
   We are sorry. You must be registred on the site in order to apply for The Fellowship Elites.';
} else  { // remove closing bracket


global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=false;

// email address of reqruitment staf member
$email_address='xxx';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=2;

//the id of the this article
$this_article_id = '12';

//article to be redirected when form is submitted
$thank_you_article_id = '13';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';

// Check for an location
if (empty($_POST['location']) ){
$enroll_errors[] = 'You forgot to enter your location.';
}
   
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';
}

// Check for an class
if (empty($_POST['class']) ){
$enroll_errors[] = 'You forgot to enter your class.';
}

// Check for an race
if (empty($_POST['race']) ){
$enroll_errors[] = 'You forgot to enter your race.';
}

// Check for an level
if (empty($_POST['level']) ){
$enroll_errors[] = 'You forgot to enter your level.';
}

// Check for an professions
if (empty($_POST['professions']) ){
$enroll_errors[] = 'You forgot to enter your professions.';
}

// Check for an attunements
if (empty($_POST['attunements']) ){
$enroll_errors[] = 'You forgot to enter your attunements.';
}

// Check for an playtime
if (empty($_POST['playtime']) ){
$enroll_errors[] = 'You forgot to enter your playtimes.';
}

// Check for an talents
if (empty($_POST['talents']) ){
$enroll_errors[] = 'You forgot to enter your talents.';
}

// Check for an ventrilo
if (empty($_POST['ventrilo']) ){
$enroll_errors[] = 'You forgot to enter your ventrilo question.';
}

// Check for an pvp
if (empty($_POST['pvp']) ){
$enroll_errors[] = 'You forgot to enter your pvp.';
}

// Check for an contribution
if (empty($_POST['contribution']) ){
$enroll_errors[] = 'You forgot to enter your contribution question.';
}

// Check for an why
if (empty($_POST['why']) ){
$enroll_errors[] = 'You forgot to enter why you want to join us.';
}                   
    }

if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Name: ' . $_POST['name'] . '
Email address: ' . $_POST['email'] . '
Location: ' . $_POST['location'] . '
Gender: ' . $_POST['gender'] . '
Age: ' . $_POST['age'] . '
Class: ' . $_POST['class'] . '
Race: ' . $_POST['race'] . '
Level: ' . $_POST['level'] . '
Professions: ' . $_POST['professions'] . '
Attunements: ' . $_POST['attunements'] . '
Playtime: ' . $_POST['playtime'] . '
Talents: ' . $_POST['talents'] . '
Ventrilo: ' . $_POST['ventrilo'] . '
PvP: ' . $_POST['pvp'] . '
CTprofile: ' . $_POST['ctprofile'] . '
Contribution: ' . $_POST['contribution'] . '
Why do you want to join our guild? ' . $_POST['why'] . '
Other information: ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
<table>
<tr><td>Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>Gender:<td></td><td>  ' . $_POST['gender'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Class:<td></td><td> ' . $_POST['class'] . '</td></tr>
<tr><td>Race:<td></td><td> ' . $_POST['race'] . '</td></tr>
<tr><td>Level:<td></td><td> ' . $_POST['level'] . '</td></tr>
<tr><td>Professions:<td></td><td>  ' . $_POST['professions'] . '</td></tr>
<tr><td>Attunements:<td></td><td>  ' . $_POST['attunements'] . '</td></tr>
<tr><td>Playtime:<td></td><td>  ' . $_POST['playtime'] . '</td></tr>
<tr><td>Talents:<td></td><td>  ' . $_POST['talents'] . '</td></tr>
<tr><td>Ventrilo:<td></td><td>  ' . $_POST['ventrilo'] . '</td></tr>
<tr><td>PvP:<td></td><td>  ' . $_POST['pvp'] . '</td></tr>
<tr><td>CTprofile:<td></td><td>  ' . $_POST['ctprofile'] . '</td></tr>
<tr><td>Contribution:<td></td><td>  ' . $_POST['contribution'] . '</td></tr>
<tr><td>Why do you wanna join this guild:<td></td><td>  ' . $_POST['why'] . '</td></tr>
<tr><td>Other information:<td></td><td>  ' . $_POST['other']. '</td></tr>
</table>';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'] . ' ' . $_POST['level'] . ' ' . $_POST['class'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">Character Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Male">Male</OPTION>
<OPTION value="Female">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Class:</TD>
                                </TD>
<TD><SELECT id="class" name= "class" style="WIDTH: 152px" value ="';
if (isset($_POST['class'])) echo $_POST['class'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Druid">Druid</OPTION>
<OPTION value="Hunter">Hunter</OPTION>
<OPTION value="Mage">Mage</OPTION>
<OPTION value="Paladin">Paladin</OPTION>
<OPTION value="Priest">Priest</OPTION>
<OPTION value="Rogue">Rogue</OPTION>
<OPTION value="Warlock">Warlock</OPTION>
<OPTION value="Warrior">Warrior</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Race:</TD>
                                </TD>
<TD><SELECT id="race" name= "race" style="WIDTH: 152px" value ="';
if (isset($_POST['race'])) echo $_POST['race'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Dwarf">Dwarf</OPTION>
<OPTION value="Human">Human</OPTION>
<OPTION value="Gnome">Gnome</OPTION>
<OPTION value="Night Elf">Night Elf</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Level:</TD>
<TD><INPUT id ="level" name ="level" type="text" value ="';
if (isset($_POST['level'])) echo $_POST['level'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">What are your professions?</TD>
<TD><INPUT id ="professions" name ="professions" type="text" value ="';
if (isset($_POST['professions'])) echo $_POST['professions'];   
echo '"  /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Which attunements do you have?</TD>
<TD><INPUT id="attunements" name="attunements" type="text" value ="';
if (isset($_POST['attunements'])) echo $_POST['attunements']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">At which times do you play daily?</TD>
<TD><INPUT id="playime" name="playtime" type="text" value ="';
if (isset($_POST['playtime'])) echo $_POST['playtime']; 
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">What is your current talentbuild?</TD>
<TD><INPUT id="talents" name="talents" type="text" value ="';
if (isset($_POST['talents'])) echo $_POST['talents'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have Ventrilo installed?:</TD>
<TD><SELECT id="ventrilo" name="ventrilo" style="WIDTH: 160px" value ="';
if (isset($_POST['ventrilo'])) echo $_POST['ventrilo'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you PvP often and is this very important to you?</TD>
<TD><INPUT id="pvp" name="pvp" type="text" value ="';
if (isset($_POST['pvp'])) echo $_POST['pvp'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">If you have a CTprofile, then please link it here:</TD>
<TD><INPUT id="ctprofile" name="ctprofile" type="text" value ="';
if (isset($_POST['ctprofile'])) echo $_POST['ctprofile'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">How do you think you can contribute to the guild?</TD>
<TD><TEXTAREA id="contribution" name ="contribution" rows="4" cols="40" value ="';
if (isset($_POST['contribution'])) echo $_POST['contribution'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Why do you wanna join us?
</TD>
<TD><TEXTAREA id="why" name = "why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];
echo '" ></' . 'TEXTAREA></TD> </TR>

<TR class ="windowbg2">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';
} // Closing at the very end of the code

OzButcher

#84
I had this same problem... I took off all the table tags in the bit which submits the fields to the forum. You can actually improve how it will look in the forum using the bold tags.... Sample from my script:

[B]Real Name:[/B]  ' . $_POST['real_name'] . '
[B]Email address:[/B]  ' . $_POST['email'] . '
[B]In-Game Nick:[/B]  ' . $_POST['aa_name'] . '
[B]Age:[/B] ' . $_POST['age'] . '
[B]Gender:[/B] ' . $_POST['gender'] . '
[B]Location:[/B] ' . $_POST['location'] . '


Your current layout:
<table>
<tr><td>Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>Gender:<td></td><td>  ' . $_POST['gender'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Class:<td></td><td> ' . $_POST['class'] . '</td></tr>
<tr><td>Race:<td></td><td> ' . $_POST['race'] . '</td></tr>
<tr><td>Level:<td></td><td> ' . $_POST['level'] . '</td></tr>
<tr><td>Professions:<td></td><td>  ' . $_POST['professions'] . '</td></tr>
<tr><td>Attunements:<td></td><td>  ' . $_POST['attunements'] . '</td></tr>
<tr><td>Playtime:<td></td><td>  ' . $_POST['playtime'] . '</td></tr>
<tr><td>Talents:<td></td><td>  ' . $_POST['talents'] . '</td></tr>
<tr><td>Ventrilo:<td></td><td>  ' . $_POST['ventrilo'] . '</td></tr>
<tr><td>PvP:<td></td><td>  ' . $_POST['pvp'] . '</td></tr>
<tr><td>CTprofile:<td></td><td>  ' . $_POST['ctprofile'] . '</td></tr>
<tr><td>Contribution:<td></td><td>  ' . $_POST['contribution'] . '</td></tr>
<tr><td>Why do you wanna join this guild:<td></td><td>  ' . $_POST['why'] . '</td></tr>
<tr><td>Other information:<td></td><td>  ' . $_POST['other']. '</td></tr>
</table>';


I would maybe change to this:


Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Location:  ' . $_POST['location'] . '
Gender:  ' . $_POST['gender'] . '
Age:  ' . $_POST['age'] . '
Class: ' . $_POST['class'] . '
Race: ' . $_POST['race'] . '
Level: ' . $_POST['level'] . '
Professions:  ' . $_POST['professions'] . '
Attunements:  ' . $_POST['attunements'] . '
Playtime:  ' . $_POST['playtime'] . '
Talents:  ' . $_POST['talents'] . '
Ventrilo:  ' . $_POST['ventrilo'] . '
PvP:  ' . $_POST['pvp'] . '
CTprofile:  ' . $_POST['ctprofile'] . '
Contribution:  ' . $_POST['contribution'] . '
Why do you wanna join this guild:  ' . $_POST['why'] . '
Other information:  ' . $_POST['other']. ';





junkenstein

That did the trick!
Thank you so much!

OzButcher

No problem :)

Looking through your code I actually realised the form can be redirected to another article which is an other alternative solution the my last request for a custom email feature :)

Balrost

This is an awesome script.  Thanx for your hard work.

When I run the script as you have it it works fine.  When I change the way the data is posted and emailed it works fine.  BUT...

When I go in and try to customise the form, basicly I want to remove some of the questions such as gender, I get an error.

Parse error: parse error, unexpected T_STRING in /home/vongr2/public_html/hg/Sources/Load.php(1733) : eval()'d code(231) : eval()'d code on line 81

I am removing <TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>


I was ass-u-me ing that was all I hade to do.  I just need to remove some of the questions that dont pertain to my needs.

Please help. 

Thanx in advance.

Balrost

I figured it out.  It wasn't in the removal of code.  I have put a ' in the wrong dang spot way back up in the email section.

Sure wish I had a clue what I was doing. LOL

Thanx for your time.

dapoppet

I love this script.  I had it up and working and well...i ended up trashing everything to start with a fresh install and I didn't save my form.

I am having problems with it posting to the forum.

Current code:

// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of reqruitment staf member
$email_address=\'xxx\';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=3;

//the id of the this article
$this_article_id = '11';

//article to be redirected when form is submitted
$thank_you_article_id = '7';


This actually posts to the forum, but it does not redirect to the thank you article.  I get a 404 error for index.php?page=11.

I change the this_article_id = '7'; and it redirects to the correct article, but does not post.  Any idea's on how to fix this?

Thanks!

This website is proudly hosted on Crocweb Cloud Website Hosting.