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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 123
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 70
  • Total: 70

invite friend

Started by falguni1, November 28, 2007, 07:54:39 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

falguni1

I saw this site

http://path-to-peace.com/forum2/  :D

and I want this I saw  :o



I searched the block code snippets and could not find it  how to get this  :-\

Hairy

I'll see if I can modify a different snippet to do something like this, I'm only new to this stuff so allow me some time falguni1 :)

falguni1

#2
hmmmm  :D

thanks  :)

Hairy

#3
OK here goes  :-\

Try this and tell me what you think, make sure you change the admin email and website addresses!

It will also take the person to an article page after they use it, make an article to say thanks or something, it's currently set for article ID #6
//article to be redirected when form is submitted
$thank_you_article_id = '6';


Also a pic attached (colors adjusts to your theme)

global $user_info, $context, $settings ;


///////////////////////////
// CONFIGURATION SECTION //
///////////////////////////


//Website address
$website_address= 'http://www.yoursite.com';

//Admin email address
$admin_email_address= 'adminemail@yours.com';

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


/////////////////////////////////
//END OF CONFIGURATION SECTION //
/////////////////////////////////


$email_address= $_POST['fmail'];

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

// email the form

$subject = 'Invitation from ' . $_POST['real_name'] . '';
$body =
'Hello ' . $_POST['fname'] . '

' . $_POST['real_name'] . ' wanted to invite you to our community at ' . $website_address . '

Their message.....
"' . $_POST['message'] . '"


This email was generated by ' . $context['user']['name'] . ' from IP Address ' . $user_info['ip'] . ' via ' . $website_address . '
If this is spam or abusive, please report it to: ' . $admin_email_address . ' (please include a copy of this email)';



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

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

}

//else { // Display the form
echo '
<br /><center>Invite A Friend</center><hr>';
echo '
<form 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 = "180px">Your Name<br />
<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 = "180px">Your Email<br />
<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 = "180px">Friend\'s Name<br />
<INPUT id="fname" name="fname" type="text" value ="';
if (isset($_POST['fname'])) echo $_POST['fname'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "180px">Friend\'s Email<br />
<INPUT id="fmail" name="fmail" type="text" value ="';
if (isset($_POST['fmail'])) echo $_POST['fmail'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "180px">Your Message<br />
<TEXTAREA id="message" name = "message" rows="4" cols="20" value ="';
if (isset($_POST['message'])) echo $_POST['message'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';


Edit: some more un-needed code removed

Hairy

#4
I thought I should post an example of the email it sends, (I have removed my IP from this image)

::)

It might not be as pretty as the original but I'm sure some people here might have fun improving it  :up:

Cheers

PS. If anyone can think of a much better way to word the email it sends please say so and I'll quickly fix it. It's quite late here so I can not think good right now  :uglystupid2:

IchBin

Falguni, please do NOT post for support in the snippets board. I've told you before this, please post any requests in the REQUESTS board. Since you have a snippet now though, I'll leave it if it works for everyone.

cluksha

I am very new to ALL of this and I'm not even sure yet what tiny portal does for SMF.  But I do wonder - how would go about installing this little snippet code - or where?

Sorry if this request is in the wrong place - but it is my first post and I will 'get it' soon I hope :)

Thanks
Chris

IchBin

cluksha, TP is a mod for SMF. If you read up in the Docs board you'll find a lot more info about TP. Any of the code snippets here can be added to a right/left/center block or even articles.

falguni1

Hairy you are genius  :D

it works so good and looks so nice  :coolsmiley:

thankyou  :)

falguni1

one thing I noticed is that if you want to send email to someone you dont need to log to your email account, just fill this form and send it.  :o

sounds lazy and quick  ::)

This website is proudly hosted on Crocweb Cloud Website Hosting.