[ABD]Invite A Friend

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Hawaiian Dude
Registered User
Posts: 109
Joined: Mon Jun 17, 2002 10:59 am

[ABD]Invite A Friend

Post by Hawaiian Dude »

Current Version: v1.1.0
Download here

Description:
This will allow your users to invite their friends to your forum.

Made on request from here

History:
Version 1.1.0 Changes (done by Zleviticus)
Added config panel to allow use of different Templates "general config - email config"
Move the subject line to the template for easier editing
general Cleaning of code
Version 1.0.2 Changes (done by Hawaiian Dude & MJ)
Added link on index

Version 1.0.1 Changes (done by Zleviticus)
Fixed errors with the code
Changed Strings to match each other
Added Subject Line

Version 1.0 (created by Hawaiian Dude)
First release

Authors:
Hawaiian Dude
Zleviticus
MJ

Thanks too:
Thx to Hardout, Brewjah, R. U. Serious for the interesting Tell-A-Friend MOD that we used (hope this is ok)
Thx to all the testers
Last edited by Hawaiian Dude on Mon Jul 01, 2002 6:25 pm, edited 8 times in total.
talia679
Registered User
Posts: 716
Joined: Tue Mar 12, 2002 4:07 pm
Location: PA
Contact:

Post by talia679 »

This is great ... do you have a demo?
Thanks, Talia
Tag You're It Writing Community || TYI Forums
Taleria - Talia's Gallery of 2000+ Links & 140+ Books
GameCrafters Guild – Gaming info and resources
Brandons
I am too lazy to register

Post by Brandons »

Great. Hmm could you include how we might include these forms at the bottom of our index page? so they can just tell friends from there?

And also.. a demo of what it looks like?.. hehe thanks
zleviticus
Registered User
Posts: 66
Joined: Wed May 08, 2002 3:45 pm

having problems

Post by zleviticus »

Ok I am having problems with this dev mod.. i like the idea though...

The first is that the strings in the Lang file do not match those inthe tpl file.

The second is that when I try to do a submit I get the following error..

"Could not find email template file invite_email"

What is going on? Anyone have an idea?
zleviticus
Registered User
Posts: 66
Joined: Wed May 08, 2002 3:45 pm

Got it working

Post by zleviticus »

Ok I got it working with a few changes.. If people would like and if it is ok with the original author(s) I can post the changes and files in the corrected format... I can also provide instructions on what changes I made to the original files...

Just PM me if you want either the files uploaded or available for download and if the author is reading let me know if it is ok to post the corrected version... with all due credit that is... :mrgreen:

Cheers!
Hawaiian Dude
Registered User
Posts: 109
Joined: Mon Jun 17, 2002 10:59 am

Post by Hawaiian Dude »

its ok to post correct version it's in development and was hoping that people like you wanted to help with this MOD, you can add your name to the MOD authors if you want
zleviticus
Registered User
Posts: 66
Joined: Wed May 08, 2002 3:45 pm

Version 1.0.1 released

Post by zleviticus »

Here is version 1.0.1 of Invite a friend MOD. I have correct a couple errors. It works fine on my board.. have any problems let me know.

In order to use it you need to create a link to the invite.php file. That's It!

Enjoy!


Get the file: See original Posts for it...
Last edited by zleviticus on Fri Jun 28, 2002 3:48 pm, edited 1 time in total.
User avatar
scoobie
Registered User
Posts: 237
Joined: Sun May 12, 2002 6:07 pm

Post by scoobie »

Excellent MOD by the way

Slight problem with the Subject Line - comes up as L_Tell_Friend_Email_Subject

Any ideas how to sort this out - tried editing the code but just brought back errors.
Hawaiian Dude
Registered User
Posts: 109
Joined: Mon Jun 17, 2002 10:59 am

Post by Hawaiian Dude »

new v1.0.2
updates:
you will see a link on the index page next to 'Mark all forums read'
(any ideas on other place(s) to set link let us know)

demo: N/A

see first message for instructions (download)
zleviticus
Registered User
Posts: 66
Joined: Wed May 08, 2002 3:45 pm

oops

Post by zleviticus »

Here is the corrected invite.php file code...

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_post.'.$phpEx);


$userdata = session_pagestart($user_ip, PAGE_FAQ);
init_userprefs($userdata);

if( !$userdata['session_logged_in'] ) 
    { 
        header("Location: " . append_sid("login.$phpEx?redirect=$PHP_SELF", true));
       	exit; 
    } 
        
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->assign_vars(array(
'L_TELL_FRIEND_TITLE' => $lang['Invite_Friend_Title'],
'L_TELL_FRIEND_EMAIL_MESSAGE' => $lang['Invite_Friend_Email_Message'],
'L_TELL_FRIEND_SENDER_USER' => $lang['Invite_Friend'],
'L_TELL_FRIEND_SENDER_USER' => $lang['Invite_Friend_Sender_User'],
'L_TELL_FRIEND_SENDER_EMAIL' => $lang['Invite_Friend_Sender_Email'],
'L_TELL_FRIEND_RECIEVER_USER' => $lang['Invite_Friend_Reciever_User'],
'L_TELL_FRIEND_RECIEVER_EMAIL' => $lang['Invite_Friend_Reciever_Email'],
'L_TELL_FRIEND_EMAIL_SUBJECT'=>$lang['Invite_Friend_Email_Subject'],

 
"SUBMIT_ACTION" => $PHP_SELF, 
"SITENAME" => $board_config['sitename'], 
"HOST" => 'http://' . $HTTP_HOST . '/register'.$phpEx , 
"SENDER_NAME" => $userdata[username], 
"SENDER_MAIL" => $userdata[user_email], 
));

/**************/
		if ( isset($HTTP_POST_VARS['submit']) )
		{
			$error = FALSE;

			if ( !empty($HTTP_POST_VARS['friendemail']) && (strpos($HTTP_POST_VARS['friendemail'],"@")>0) )
			{
				$friendemail = trim(stripslashes($HTTP_POST_VARS['friendemail']));
				if (!$HTTP_POST_VARS['friendname']) { $friendname=substr($friendemail,0,strpos($HTTP_POST_VARS['friendemail'],"@")); };
			}
			else
			{
				$error = TRUE;
				$error_msg = "You have not entered a (valid) email address";
			}

			if ( !$error )
			{
					include($phpbb_root_path . 'includes/emailer.'.$phpEx);
					$emailer = new emailer($board_config['smtp_delivery']);

					$email_headers = 'From: '. $userdata['username'] .'<'. $userdata['user_email'] .'>' . "\n";
					$email_headers .= 'Return-Path: ' . $userdata['user_email'] . "\n";
					$email_headers .= 'X-AntiAbuse: Board servername - ' . $server_name . "\n";
					$email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
					$email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n";
					$email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\r\n";

					$emailer->use_template('invite_email', $user_lang); 
					$emailer->email_address($friendname .'<'. $friendemail .'>');

					/* $emailer->set_subject("An invitation for You!"); */
					$emailer->set_subject($lang['Invite_Friend_Email_Subject']);


					$emailer->extra_headers($email_headers);

					 $emailer->assign_vars(array(
						'SITENAME' => $board_config['sitename'], 
						'FROM_USERNAME' => $userdata['username'], 
						'TO_USERNAME' => $friendname, 
					));
					$emailer->send();
					$emailer->reset();

					$template->assign_vars(array(
						'META' => '<meta http-equiv="refresh" content="5;url=' . append_sid("index.$phpEx") . '">')
					);

					$message = $lang['Email_sent'] . '<br /><br />' . sprintf($lang['Click_return_index'],  '<a href="' . append_sid("index.$phpEx") . '">', '</a>');

					message_die(GENERAL_MESSAGE, $message);
			}

			if ( $error )
			{
				$template->set_filenames(array(
					'reg_header' => 'error_body.tpl')
				);
				$template->assign_vars(array(
					'ERROR_MESSAGE' => $error_msg)
				);
				$template->assign_var_from_handle('ERROR_BOX', 'reg_header');
			}

		}

/**************

if ($submit)
{
mail("\"$friendname\" <$friendemail>", "$friendname, you have been invited to $board_config[sitename]", $message, "From: \"$userdata[username]\" <$userdata[user_email]>");
message_die(GENERAL_MESSAGE, "Your email has been sent. Click <a href=$HTTP_REFERER>here</a> to tell another friend.");
}
**************/


$template->set_filenames(array("body" => "invite_body.tpl"));
$template->pparse("body");

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
Hawaiian Dude
Registered User
Posts: 109
Joined: Mon Jun 17, 2002 10:59 am

Post by Hawaiian Dude »

file updated, thx man
zleviticus
Registered User
Posts: 66
Joined: Wed May 08, 2002 3:45 pm

Added my link in differ spot

Post by zleviticus »

I added my link on the Main page up where the FAQ, Search and such are located. that way no matter what page or forum you are in you can have the person email a friend.. otherwise you have to be in a forum to do it.. Don't you?


No prob on the updated invite.php file.. I will be added new items when I have a chance... I think this could be a GREAT MOD....

Catch you later!

I have a server to rebuild...
Hawaiian Dude
Registered User
Posts: 109
Joined: Mon Jun 17, 2002 10:59 am

Post by Hawaiian Dude »

what about this pic?
Image
whackyshack
Registered User
Posts: 81
Joined: Tue May 28, 2002 4:47 pm
Contact:

Post by whackyshack »

I keep getting this error.

Could not find email template file invite_email

After I enter the users name and email address. I hit send email and that is the message I get.

Help please

edit
I just realized this was posted earlier, but I still have the problem.

Edit again.

Fixed it.
Hawaiian Dude
Registered User
Posts: 109
Joined: Mon Jun 17, 2002 10:59 am

Post by Hawaiian Dude »

it had to be placed in templates/subSilver, I think in the beginning it said in lang_english/email or something
or what did you do?
Locked

Return to “[2.0.x] MODs in Development”