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

Recent

Welcome to TinyPortal. Please login or sign up.

April 19, 2024, 04:11:23 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,164
  • Total Topics: 21,219
  • Online today: 266
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 236
  • Total: 236

Tell A Friend Block

Started by RebelRose, August 29, 2006, 07:11:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rebelrose

I have a Tell A Friend Block, that send up to three email, to tell a friend about your site. If anyone is intered in the code. You have to have custom mod installed for this to work. A member on my forum showed this to me.

You can see it work here Forum

G6Cad

That looked really nice, i love the image you use in the tell a friend block :)

rebelrose


RoarinRow

Very nice, do you have the code you can share?

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

rebelrose

#4
This is how it works:

First you have to download and install the "custom actions" mod

then after that you go and create a javascript/html bloc telling people about it

the code I use for it is this:



<div align="center"><a href="http://yoursite.com/forum/index.php?action=tellafriend"><img

src="http://yoursite.com/forum/Themes/yourtheme/images/friends.gif" width="125" height="125"

border="0" /></a></div>


then you go into the admin and custom actions and create 2 pages - both are HTML

first the "tell a friend" page:


<html>
<head>
<title>tell a friend</title>
<script language="javascript">
<!--

function reset() {
document.tellafriend.name.value="";
document.tellafriend.email.value="";
document.tellafriend.friendmail1.value="";
document.tellafriend.friendmail2.value="";
document.tellafriend.friendmail3.value="";
}

function validate() {


if (document.tellafriend.friendmail1.value.length==0) {
alert("please enter your friend's email address");
return false;
}

if (document.tellafriend.email.value.length==0) {
alert("please enter your email address");
return false;
}
if (document.tellafriend.name.value.length==0) {
alert("please enter your name");
return false;
}

document.tellafriend.submit()
return true;
}

//-->
</script>
</head>
<body onload="reset()" topmargin="0" leftmargin="0">
<center>
</center>
<table width="500" cellpadding="0" cellspacing="0" align="center">
  <tr valign="top">
    <td valign="middle" align="center"><img

src="http://www.yoursite.com/forum/Themes/yourtheme/images/tell.gif" width="500" height="100"></td>
  </tr>
  <tr valign="top">
    <td valign="middle" align="center"> <p><font color="#000099" size="4" face="Arial">Complete
        the details below to send our link to your friends.</font></p>
      <form name="tellafriend"

action="http://www.yoursite.com/forum/Themes/yourtheme/tellafriend.php" method="post"

onsubmit="return checkfields()">
        <div align="center">
          <center>
            <table width="500" border="0" cellpadding="10" cellspacing="0">
              <tr>
                <td><strong><font color="#000099" size="2" face="Arial"> *your
                  name:</font></strong></td>
                <td> <strong><font color="#000099" size="2" face="Arial">
                  <input size="30" name="name" maxlength="45">
                  </font></strong></td>
              </tr>
              <tr>
                <td><strong><font color="#000099" size="2" face="Arial">*your
                  email:</font></strong></td>
                <td> <strong><font color="#000099" size="2" face="Arial">
                  <input size="30" name="email" maxlength="45">
                  </font></strong></td>
              </tr>
              <tr>
                <td colspan="2"> <p align="center"><font color="#000099"><strong><font size="2"

face="Arial">please
                    enter your friend's email addresses:</font></strong></font></td>
              </tr>
              <tr>
                <td><strong><font color="#000099" size="2" face="Arial">*email
                  1:</font></strong></td>
                <td> <strong><font color="#000099" size="2" face="Arial">
                  <input size="30" name="friendmail1" maxlength="45">
                  </font></strong></td>
              </tr>
              <tr>
                <td><strong><font color="#000099" size="2" face="Arial">email
                  2:</font></strong></td>
                <td> <strong><font color="#000099" size="2" face="Arial">
                  <input size="30" name="friendmail2" maxlength="45">
                  </font></strong></td>
              </tr>
              <tr>
                <td><strong><font color="#000099" size="2" face="Arial">email
                  3:</font></strong></td>
                <td> <strong><font color="#000099" size="2" face="Arial">
                  <input size="30" name="friendmail3" maxlength="45">
                  </font></strong></td>
              </tr>
              <tr>
                <td colspan="2"> <p align="center"><font color="#000099"><strong><font size="2"

face="Arial">
                    The email that will be sent will contain your name and email
                    address. <br>
                    <input onclick="validate();" type="button" value="click here to send">
                    </font></strong></font></td>
              </tr>
            </table>
          </center>
        </div>
      </form></td>
  </tr>
  <tr valign="top">
    <td valign="middle" align="center">&nbsp; </td>
  </tr>
</table>
</body>
</html>


then the thank you page:


<html>
<head>
</head>
<body onload="reset()" topmargin="0" leftmargin="0">
<center>
</center>
<table width="500" cellpadding="0" cellspacing="0" align="center">
  <tr valign="top">
    <td valign="middle" align="center">&nbsp;</td>
  </tr>
  <tr valign="top">
    <td valign="middle" align="center"><img src="http://yoursite.com/myimages/thankyou.gif" width="400"

height="300"></td>
  </tr>
  <tr valign="top">
    <td valign="middle" align="center">&nbsp; </td>
  </tr>
</table>
</body>
</html>


NOW you need to create a php file for the whole thing to work and name it "tellafriend.php"
you load this to your theme folder

the file should contain this info:


<?PHP

// This following statement must be left intact.
// Taming The Beast Tell-A-Friend script V 1.2
// Taming the Beast.net - http://www.tamingthebeast.net
// Free Web Marketing and Ecommerce Resources
// By using this code you agree to indemnify
// Taming the Beast from from any liability that might arise
// from it's use.
// This following statement must be left intact.

# This section removes any nasty tags that the user may
# have input into any of the form fields

strip_tags($friendmail1);
strip_tags($friendmail2);
strip_tags($friendmail3);
strip_tags($email);
strip_tags($name);


# This section sends you a notification email when
# the form is used

// Your email address (for copies to be sent to you)
$emailto = "you@yoursite.com";

// Your email subject text
$esubject = "a page has been sent";

// The email text for copies sent to you
$emailtext = "
".$name." has used the tell-a-friend form. Their email address is ".$email."

The people they have recommended are:

".$friendmail1."
".$friendmail2."
".$friendmail3."

";
# Send the email to you
@mail("$emailto", $esubject, $emailtext, "From: $email");

## This section sends to the recipients
// Target page after successful submission
$thankyoupage = "http://yoursite.com/forum/index.php?action=thankyou";

// Change the subject text below to suit
$tsubject = "Come join me at the your Forum";

// Change the text below for the email
$ttext = "
Hi,

A friend yours, ".$name.", whose email address is ".$email." thought you may like to visit our forum!! ".$name." has used our Tell-a-Friend form to send you this

email.

http://yoursite.com/forum/

";
# This sends the email to the addresses entered
@mail("$friendmail1,$friendmail2,$friendmail3", $tsubject, $ttext, "FROM: $email");

# After submission, the target URL
header("Location: $thankyoupage");
exit;
?>


Just be sure to change any image, url and information to your own.

rebelrose

We work on all kind of modification on our Tiny Portals, I love Tiny Portal

RoarinRow

Quote from: RebelRose on August 29, 2006, 07:49:44 PM
We work on all kind of modification on our Tiny Portals, I love Tiny Portal

Very cool, thanks!

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

rebelrose


Greenbug

Question, I installed the custom action mod, but do not see this in the admin area, what should I be looking for?

To create the 2 pages for this snippet.

Cheers,
GB

rebelrose

Quote from: Greenbug on August 31, 2006, 04:15:39 AM
Question, I installed the custom action mod, but do not see this in the admin area, what should I be looking for?

I don't understand what you mean by what you should be looking for?
If you mean the area to do custom mods then look in the control panel under features and options and you will see custom actions.