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: 673
  • Total: 673

[Done!] Join Us! form

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

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

JPDeni

Try using


$board_id=10;


If that doesn't work, then you'll need to give us the URL that shows up in your browser when you get the error. It's hard to know why something doesn't work unless I can see it.

GreenX

#341
I deleted that line and it works now, dunno why but it does  :D

New question, I tried various methods but how do I make this line:


   $msgOptions = array(
        'id' =>  0 ,
        'subject' => '[Pending] Application of ' . $context['user']['name'],
        'body' => $postbody ,
        'icon' => 'xx',
        'smileys_enabled' => true,
        'attachments' =>  array(),


Instead of doing what it does now "[Pending] Application of FORUM ACCOUNT NAME" as teh subject of the post to:

[Pending] Application from array[charname] array[charclass]

as the subject?

Thanks!

JPDeni

Try


'subject' => '[Pending] Application of ' . $_REQUEST['charname' . ' ' . $_REQUEST['charclass'],

GreenX

That worked, your the greatest. One last thing

I stuck this at the very top before globals and it doesn't seem to show the message to guests. What am I missing?



if ($context['user']['is_guest'])
{
   echo
   '<h5>Access Denied</h5>
   We are sorry. You must be registered on the site in order to apply.';
} else  {


I just want when the article is viewed to check it they are a guest , if so show them that message.

Thanks!

JPDeni

Your $context array is only available to use after the global line. So pull the global line out of where it is and stick it at the very top and you should be fine. Don't forget your ending } ! :)

Glad to help.

JPDeni

The only way to debug it is if I can see the code.

Azphat12

Ok decided to give this code a try.... here is the code I am currently using.

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 recruitment staff member
$email_address='recruitement@darkaftermath.org';

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

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

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

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


//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 a name
if (empty($_POST['game_name']) ){
$enroll_errors[] = 'You forgot to enter your In-Game Name.';
}       
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';


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'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Current Game Name:  ' . $_POST['game_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Race: ' . $_POST['race'] . '
Class: ' . $_POST['class'] . '
Primary Talent Spec:  ' . $_POST['spec'] . '
Secondary Talent Spec:  ' . $_POST['spec2'] . '
Armory Link:  ' . $_POST['armory'] . '
Willing to respec?:  ' . $_POST['respec'] . '
Previous Guild(s):  ' . $_POST['prev_guilds'] . '
Game Experience:  ' . $_POST['experience'] . '
Availability: ' . $_POST['availability'] . '
What can you offer Dark Aftermath?  ' . $_POST['why'] . '
What can Dark Aftermath do for you?  ' . $_POST['why2'] . '
Gaming habbits:   ' . $_POST['habbits'] . '
Member Referral:  ' . $_POST['referral'] . '
Other information:  ' . $_POST['other'] .'
Guild Rules: ' . $_POST['rules'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
<table>
<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Current Game Name:<td></td><td>  ' . $_POST['game_name'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Gender: <td></td><td>' . $_POST['gender'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>Race:<td></td><td> ' . $_POST['race'] . '</td></tr>
<tr><td>Class:<td></td><td> ' . $_POST['class'] . '</td></tr>
<tr><td>Primary Talent Spec: <td></td><td> ' . $_POST['spec'] . '</td></tr>
<tr><td>Secondary Talent Spec: <td></td><td> ' . $_POST['spec2'] . '</td></tr>
<tr><td>Armory Link: <td></td><td> ' . $_POST['armory'] . '</td></tr>
<tr><td>Willing to respec?: <td></td><td> ' . $_POST['respec'] . '</td></tr>
<tr><td>Previous Guild(s): <td></td><td> ' . $_POST['prev_guilds'] . '</td></tr>
<tr><td>Game Experience: <td></td><td> ' . $_POST['experience'] . '</td></tr>
<tr><td>Availability: <td></td><td>' . $_POST['availability'] . '</td></tr>
<tr><td>What can you offer Dark Aftermath? <td></td><td> ' . $_POST['why'] . '</td></tr>
<tr><td>What can Dark Aftermath do for you? <td></td><td> ' . $_POST['why2'] . '</td></tr>
<tr><td>Gaming habbits: <td></td><td> ' . $_POST['habbits'] . '</td></tr>
<tr><td>Member Referral:<td></td><td>  ' . $_POST['referral'] . '</td></tr>
<tr><td>Other information: <td></td><td> ' . $_POST['other']. '</td></tr>
<tr><td>Guild Rules: <td></td><td>' . $_POST['rules'] . '</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 ' . $_REQUEST['game_name'] . ' ' . $_REQUEST['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://www.darkaftermathguild.com/forums/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" />

<br><center>Please take your time to fill out the form.  This is your first impression, so make it a good one.</center><br>

<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "250px">* Your 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 = "250px">* 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 = "250px">* In-game Name:</TD>
<TD><INPUT id="game_name" name="game_name" type="text" value ="';
if (isset($_POST['game_name'])) echo $_POST['game_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "250px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "250px">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>----Please Select----</OPTION>
<OPTION value="Male">Male</OPTION>
<OPTION value="Female">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "250px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];   
echo '" /></TD>
</TR>
                                <TR class ="windowbg">
        <TD width = "250px">Race:
</TD><TD><SELECT id = "race" name = "race" style="WIDTH: 152px" value ="';
if (isset($_POST['race'])) echo $_POST['race'];   
echo '" />
<OPTION value="No Answer" selected>----Please Select----</OPTION>
<OPTION value="Draenei">Draenei</OPTION>
<OPTION value="Dwarf">Dwarf</OPTION>
<OPTION value="Gnome">Gnome</OPTION>
<OPTION value="Human">Human</OPTION>
<OPTION value="Night Elf">Night Elf</OPTION>
</SELECT></TD>
</TR>
                                 <TR class ="windowbg">
         <TD width = "250px">Class:
</TD>
<TD><SELECT id = "class" name = "class" style="WIDTH: 152px" value ="';
if (isset($_POST['class'])) echo $_POST['class'];   
echo '" />
<OPTION value="No Answer" selected>----Please Select----</OPTION>
                                                <OPTION value="Death Knight">Death Knight</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="Shaman">Shaman</OPTION>
<OPTION value="Warlock">Warlock</OPTION>
<OPTION value="Warrior">Warrior</OPTION>
</SELECT></TD>
</TR>
                        <TR class ="windowbg">
<TD width = "250px">Primary Talent Spec:</TD>
<TD><INPUT id="spec" name="spec" type="text" value ="';
if (isset($_POST['spec'])) echo $_POST['spec'];
echo '" /></TD>
</TR>
                        <TR class ="windowbg">
<TD width = "250px">Secondary Talent Spec:</TD>
<TD><INPUT id="spec2" name="spec2" type="text" value ="';
if (isset($_POST['spec2'])) echo $_POST['spec2'];
echo '" /></TD>
</TR>
                                <TR class ="windowbg">
<TD width = "250px">Willing to respec?":
</TD>
<TD><SELECT id = "respec" name = "respec" style="WIDTH: 152px" value ="';
if (isset($_POST['respec'])) echo $_POST['respec'];   
echo '" />
<OPTION value="No Answer" selected>----Please Select----</OPTION>
<OPTION value="Yes">Yes</OPTION>
<OPTION value="No">No</OPTION>
</SELECT></TD>
</TR>
                         <TR class ="windowbg2">
<TD width = "250px">Armory Link:</TD>
<TD><TEXTAREA id="armory" name="armory" rows="1" cols="40" value ="';
if (isset($_POST['armory'])) echo $_POST['armory'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "250px">Previous Guild(s) and reason for leaving:</TD>
<TD><TEXTAREA id="prev_guilds" name="prev_guilds" rows="4" cols="40" value ="';
if (isset($_POST['prev_guilds'])) echo $_POST['prev_guilds'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "250px">Game Experience:</TD>
<TD><TEXTAREA id ="experience" name ="experience" rows="4" cols="40"  value ="';
if (isset($_POST['experience'])) echo $_POST['experience'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "250px">Availability:</TD>
<TD><TEXTAREA id ="availability" name ="availability" rows="4" cols="40"  value ="';
if (isset($_POST['availability'])) echo $_POST['availability'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "250px">What can you offer Dark Aftermath?</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 ="windowbg">
<TD width = "250px">What can Dark Aftermath do for you?</TD>
<TD><TEXTAREA id="why2" name ="why2" rows="4" cols="40" value ="';
if (isset($_POST['why2'])) echo $_POST['why2'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "250px">Tell us about your gaming habbits:
</TD>
<TD><TEXTAREA id="habbits" name="habbits" rows="4" cols="40" value ="';
if (isset($_POST['habbits'])) echo $_POST['habbits'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
                        <TR class ="windowbg2">
<TD width = "250px">Member Referral:</TD>
<TD><INPUT id="referral" name="referral" type="text" value ="';
if (isset($_POST['referral'])) echo $_POST['referral'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "250px">Any other information you think<br>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 width = "250px">I understand, and accept the Guild Rules:
</TD>
<TD><SELECT id = "rules" name = "rules" style="WIDTH: 152px" value ="';
if (isset($_POST['rules'])) echo $_POST['rules'];   
echo '" />
<OPTION value="No Answer" selected>----Please Select----</OPTION>
<OPTION value="Yes">Yes</OPTION>
<OPTION value="No">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';



and the output is this...

Enrollment application has been made by admin_Gyza























Real Name:                      Jason
Email address:              admin@darkaftermath.org
Current Game Name:           Gyza
Age:                              33
Gender:                     Male
Location:                      Arizona
Race:                            Human
Class:                    Paladin
Primary Talent Spec:          Retribution
Secondary Talent Spec:      Protection
Armory Link:             test1
Willing to respec?:          yes
Previous Guild(s):          test2
Game Experience:          test3
Availability:             test4
What can you offer Dark Aftermath?       test5
What can Dark Aftermath do for you?       test6
Gaming habbits:             test7
Member Referral:              test8
Other information:              test9
Guild Rules:              yes

So the overall code is working.  But there is a large gap at the top, and some of the answers do not line up.  I exagerated them here, but it is maybe a space or 2 on the post.

Also is there a way to ask for an applicant to log into SMF before posting?  Right now I can apply with no login.  Either a login or a visual confirm at the bottom of the app or something?  If not I can deal with is.

JPDeni

I would suggest taking out the <br  /> in


$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
<table>


I'm not sure what you mean by "some of the answers to not line up." Are you talking about lining up nicely in vertical columns? If so, the problem is likely due to there being html in the code but you have not allowed html in your posts. You can change it, though.

Wherever you see < > brackets in the table structure, change them to [ ] brackets. Like this:


$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
[table]
[tr][td]Real Name:[/td][td]  ' . $_POST['real_name'] . '[/td][/tr]
[tr][td]Email address:[/td][td]  ' . $_POST['email'] . '[/td][/tr]


Also I noticed that there were some duplicated tags which might be messing up your table.

Notice

<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>


There's an extra <td> tag after the label. I think it's on every row. You can try taking out the extra one first and see if that works before going to the trouble of editing all the brackets.

QuoteAlso is there a way to ask for an applicant to log into SMF before posting?  Right now I can apply with no login.  Either a login or a visual confirm at the bottom of the app or something?  If not I can deal with is.

I thought that was part of it.

If you have the most recent version of TP, you should be able to select which groups it's visible to. If not, right after


global $sourcedir, $user_info, $context ;


add


if ($user_info['id'] == 0)
{
    echo 'You must be logged in before you can apply.';
}
else {


and (very important!!) at the very end of the code, add


}

Azphat12

#348
@JPDeni - I took out the <br />and it lessened the gap, but not by much.

I then went into the admin panel and enabled basic HTML....which didnt help
I then took out all the extra <td> that you mentioned, all that did was put all my answers in the top gap, and the questions below....or vice versa I dont remember.
I then started changing the <table> to [table] and that really messed things up and put alot of code on the output of the form.....

So....I was looking around and found that you posted your original code.  It is alot closer to what I had before (infact I think we talked about that in my other thread).  I upgraded to Tinyportal beta 1 (or whatever the newest was yesterday) and it looked really good.

I liked the output of the form alot better, and I am more familiar with editing it since that is the one I used before. 

I did see an error in your post above tho.... ['charname'] you listed as ['charname' 

Took me awhile to find that one!!   ;D

I will be looking to add the login info edit you posted, and I really like the math problem as a way to verify someone is at the keyboard,  ;)

JPDeni

Oh, well, I always make a lot of mistakes. It just comes with the territory. :)

If you have any problems with the other code, post in that topic. Things get really confused enough as it is. :)

This website is proudly hosted on Crocweb Cloud Website Hosting.