I’ve been modifying phpBB for ages now. So, a while ago I thought of making a kick-ass phpBB plugin that will make its users feel a bit more comfy… Anyways, the project turned black. Why? I found out that, to make a plugin, you have to do a whole lots of things, not just open up your notepad.exe and give out some intl. It turned out that you will probably need to make an MODX version and a .txt version of the mod for a start. Then, you’ll have to add the template modifications to at-least one template, where subSilver was that one…
Anyways, the idea passed, like most of my ideas :D. But a couple of days ago, when I was alone @ home with nothing to do, I cracked up a small phpBB plugin. “The Official phpBB Contact Us Form”, I called it :D. Its basically to put in a damn contact form to integrate with your phpBB. It turned out kinda good considering how much reading I made about how to submit a phpBB MOD :D.
Enuf talk..
Here is the part which is supposedly showed to public to reference the MOD, or in other words, that B.S before the MOD installation instructions :D.
##############################################################
## MOD Title: Simple Contact Form
## MOD Author: Damnz! damnz.ramnz@gmail.com http://damnz.wordpress.com
## MOD Description: I already explained :p
## MOD Version: 0.0.1
##
## Installation Level: Easy
## Installation Time: 3 Minutes
## Files To Edit:
## language/lang_english/lang_admin.php,
## templates/subSilver/overall_header.tpl
##
##
## Included Files: contact_form.php,
## contact_form_body.tpl
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes:
## Hope you like it ;). I’d really appreciate a backlink too
to http://damnz.wordpress.com .
##############################################################
## MOD History:
##
## 2006-09-07 - Version 0.0.1
##
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
As for the MOD’s code, I’m gonna have to put it up right here, cuz there is something wrong with the upload engine, or so I think :D.
The instructions are,
#
#—–[ COPY ]——————————————
#
*.* to *.* #
#—–[ OPEN ]——————————————
#
language/lang_english/lang_main.php
#
#—–[ FIND ]——————————————
#
//
// That’s all, Folks!
// ————————————————-
#
#—–[ BEFORE, ADD ]——————————————
#
$lang['Contact_Form_Title'] = “Contact Form”;
$lang['Contact_Form_Subject'] = ‘Subject’;
$lang['Contact_Form_Name'] = ‘Name’;
$lang['Contact_Form_Email'] = ‘E-Mail’;
$lang['Contact_Form_Message'] = ‘Message Body’;
$lang['Contact_Form_Notice'] = ‘Please fill in the WHOLE form’;
$lang['Contact_Form_Success'] = ‘Your e-mail has been sent!’;
$lang['Contact_Form_Failure'] = ‘Your e-mail delivery failed!’;
#
#—–[ SAVE/CLOSE ALL FILES ]——————————————
#
# EoM
Now, to the real PHP code then the subSilver template :D:
phpbb_root/contact_form.php
<?php/***************************************************************************
* contact_form.php
* ——————-
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id: contact_form.php,v 0.0.1 2006/09/07 16:17:27 damnz Exp $
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define(’IN_PHPBB’, true);
$phpbb_root_path = ‘./’;
include($phpbb_root_path . ‘extension.inc’);
include($phpbb_root_path . ‘common.’.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_PROFILE);
init_userprefs($userdata);
//
// End session management
//
$page_title = $lang['Contact_Form_Title'];
include($phpbb_root_path . ‘includes/page_header.’.$phpEx);
$template->set_filenames(array(
’body’ => ‘contact_form_body.tpl’)
);
if(! $_POST['submitted']==”1″)
{
$template->assign_vars(array(
’L_SUBJECT’ => $lang['Contact_Form_Subject'],
’L_EMAIL’ => $lang['Contact_Form_Email'],
’L_MESSAGE’ => $lang['Contact_Form_Message'],
’L_CONTACT_NOTICE’ => $lang['Contact_Form_Notice'],
’L_NAME’=> $lang['Contact_Form_Name'],
’VALIDATION’=>”)
);
}
else
{
$this[email]=$_POST['email'];
$this[subject]=$_POST['subject'];
$this[message]=$_POST['message'];
$this[name]=$_POST['name'];
foreach ($this as $key => $value)
{
if(empty($value))
{
$validation .=’<span class=”gen”><center><font color=”red”> |You\’re ‘.$key.’ box was empty| </font></center></span>’;
}
}
if(empty($validation))
{
// subject
$subject = $this[subject];
// message
$message = ‘
This message was sent to you by ‘.$this[email].’:’.$this[message];
$headers = ‘From: ‘.$this[name].’ <’.$this[email].’>’ . “\r\n”;
// Mail it
mail($board_config['board_email'], $subject, $message, $headers);
$template->assign_vars(array(
’L_SUBJECT’ => $lang['Contact_Form_Subject'],
’L_EMAIL’ => $lang['Contact_Form_Email'],
’L_MESSAGE’ => $lang['Contact_Form_Message'],
’L_CONTACT_NOTICE’ => ”,
’L_NAME’=> $lang['Contact_Form_Name'],
’VALIDATION’ => ”
)
);
}
{
//Handle the reprinting
$template->assign_vars(array(
’L_SUBJECT’ => $lang['Contact_Form_Subject'],
’L_EMAIL’ => $lang['Contact_Form_Email'],
’L_MESSAGE’ => $lang['Contact_Form_Message'],
’L_CONTACT_NOTICE’ => $lang['Contact_Form_Notice'],
’L_NAME’=> $lang['Contact_Form_Name'],
’VALIDATION’ => $validation)
);
}
}
$template->pparse(’body’);
include($phpbb_root_path . ‘includes/page_tail.’.$phpEx);
?>
templates/subSilver/contact_form_body.tpl
<form action="contact_form.php" method="post"><table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline" align="center">
<tr>
<th height=”25″ class=”thHead” nowrap=”nowrap”>{L_CONTACT_NOTICE}</th>
</tr>
<tr>
<td class=”row1″><table border=”0″ cellpadding=”3″ cellspacing=”1″ width=”100%”>
<tr>
<td colspan=”2″ align=”center”> </td>
</tr>
{VALIDATION}
<tr>
<td width=”45%” align=”right”><span class=”gen”>{L_SUBJECT}:</span></td>
<td>
<input type=”text” class=”post” name=”subject” size=”25″ maxlength=”40″ />
</td>
</tr>
<tr>
<td align=”right”><span class=”gen”>{L_EMAIL}:</span></td>
<td>
<input type=”text” class=”post” name=”email” size=”25″ maxlength=”32″ />
</td>
</tr>
<tr>
<td align=”right”><span class=”gen”>{L_NAME}:</span></td>
<td>
<input type=”text” class=”post” name=”name” size=”25″ maxlength=”32″ />
</td>
</tr>
<tr>
<td align=”right”><span class=”gen”>{L_MESSAGE}:</span></td>
<td>
<textarea name=”message” rows=”15″ cols=”35″ wrap=”virtual” style=”width:450px” tabindex=”3″ class=”post”/></textarea>
</td>
</tr>
<tr align=”center”>
<td colspan=”2″><input type=”hidden” name=”submitted” value=”1″ />
<input type=”submit” value=”Email!” /></td>
</tr>
</table></form>
Yes, I know it’s lame, but I like it for a first MOD :D. If you like it, don’t be shy and tell me :D.