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,913
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 448
  • Total: 448

Generic Application Form

Started by JPDeni, May 23, 2009, 11:04:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JPDeni

I'll give you the edits here and also change the code in the first post.

Change the first line

global $sourcedir, $ID_MEMBER, $context, $scripturl, $user_info;


to


global $sourcedir, $ID_MEMBER, $context, $scripturl, $user_info, $db_prefix;


After


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

// email address of recruitment staff member
   $email_address='';

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

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


(your options may be different)

Add


// Poll options
$add_poll = 1; // 0 = No poll; 1 = add poll
$poll_question = "Accept this member?"; // This is the question for the poll
$expireTime = 0; // Change this to the number of days you want the poll to run
$hideResults = 0; // 0 = Results are always visible; 1 = Can see results only after voting; 2 = Can see results only after poll expires
$changeVote = 0; // 0 = Voters can not change their votes; 1 = Voters can change their votes
$poll_choices = array('Yes','No'); // The options listed for the poll


After


         if ($enable_post) {  //create new forum post with application


Add


if ($add_poll === 1) {
$posterName = $context['user']['name'];
if ($expireTime > 0)
$expireTime = time() + $expireTime * 3600 * 24;
db_query("
INSERT INTO {$db_prefix}polls
(question, hideResults, maxVotes, expireTime, ID_MEMBER, posterName, changeVote)
VALUES ('$question', '$hideResults', '1', '$expireTime', '$ID_MEMBER', '$posterName', '$changeVote')", __FILE__, __LINE__);
$ID_POLL = db_insert_id();


// Create each answer choice.
$i = 0;
$setString = '';
foreach ($poll_choices as $option)
{
$setString .= "
('$ID_POLL', '$i', SUBSTRING('$option', 1, 255)),";
$i++;
}

db_query("
INSERT INTO {$db_prefix}poll_choices
(ID_POLL, ID_CHOICE, label)
VALUES" . substr($setString, 0, -1), __FILE__, __LINE__);

}
else
$ID_POLL = null;


Change


            $topicOptions = array(
               'id' => 0 ,
               'board' => $board_id,
               'poll' =>  null
               'lock_mode' =>  null,
               'sticky_mode' =>  null,
               'mark_as_read' => true,
            );


to


            $topicOptions = array(
               'id' => 0 ,
               'board' => $board_id,
               'poll' =>  $ID_POLL,
               'lock_mode' =>  null,
               'sticky_mode' =>  null,
               'mark_as_read' => true,
            );

Bika

Thank youuuuuuuuuuuuuuuuuu!
;)  :up:

Awesome cakes!

alhaudhie

#152
any option to get user can upload image?

like    <form id="Upload" action="<?php echo $uploadHandler ?>" enctype="multipart/form-data" method="post">
   
        <h1>
            Upload form
        </h1>
       
        <p>
            <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size ?>">
        </p>
       
        <p>
            <label for="file">File to upload:</label>
            <input id="file" type="file" name="file">
        </p>
               
        <p>
            <label for="submit">Press to...</label>
            <input id="submit" type="submit" name="submit" value="Upload me!">
        </p>
   
    </form>


or with bbc imagelink?

JPDeni

No. That would be beyond the capability of this mod.

alhaudhie


JPDeni

If you want to add that, give it a try. Play around with it. Experiment.

Off the top of my head, I don't know how to do it, but maybe you can work it out.

nadrojcote

Very Nice job!! this is perfect!

but one thing,

is there anyway I could make it underline or bold the headings within the post?

thanks!

JPDeni

Obviously not perfect ;-)

Look for

$postbody = 'Recruitment application has been made by ' . $context['user']['name'] .'<br /><br/>';
            foreach ($fielddef as $field) {
               if ($field['type'] == 'heading')
                  $postbody .= $field['caption'] . '<br />';
               else
                  $postbody .=  $field['caption'] . ': ' . $_REQUEST[$field['name']] . '<br />';
            }


To make the headings bold, change it to


$postbody = 'Recruitment application has been made by ' . $context['user']['name'] .'<br /><br/>';
            foreach ($fielddef as $field) {
               if ($field['type'] == 'heading')
                  $postbody .= '[b]' . $field['caption'] . '[/b]<br />';
               else
                  $postbody .=  $field['caption'] . ': ' . $_REQUEST[$field['name']] . '<br />';
            }


To make the heading underlined change it to


$postbody = 'Recruitment application has been made by ' . $context['user']['name'] .'<br /><br/>';
            foreach ($fielddef as $field) {
               if ($field['type'] == 'heading')
                  $postbody .= '[u]' . $field['caption'] . '[/u]<br />';
               else
                  $postbody .=  $field['caption'] . ': ' . $_REQUEST[$field['name']] . '<br />';
            }


You can add any BBC code within quotation marks that you want.

nadrojcote

:D thank you very much I was messing around with that but i guess i didnt have the tags within the quotes like i was supposed to, your da best!

JPDeni

You're welcome. :) Sometimes it just takes an example to see how it's done. Now that you've seen the pattern, you'll be able to do anything you want.

This website is proudly hosted on Crocweb Cloud Website Hosting.