Author:Thunderer Thunderer
Modification Description:: Adds a Page with your Forum Terms such that members have access to read them
Modification Version:: 1.0.1
I Started working on This a while ago, then shelved it and walked away as it was driving me crazy.
I have now come back to it in an effort to at least complete one MOD and complete it properly, to coding guidelines.
I did put it in for validation, but failed that on a couple of things, one of the main reasons for me leaving this alone, was the advice to include an option to edit the terms from the ACP, and also call the " board name from the configuration", which are both things I did not, and still do not know how to do.
I would like to get this at least to a stage where the intergration is there, I.E ACP editing of the Terms and calling the board name from the configuration.
I have the basic files, but what I have yet to fathom is the best way to call the board name for the configuration and what files need to be placed where for this to work.
The other thing being, of course, where do I start in terms of getting the ACP integration going?
I have put the code for each file that I have so far got below, such that any advice can be better given knowing the content.
phpbbroot/termsofservice.php
Code: Select all
<?php
/**
*
* @package phpBB3
* @version $Id: termsofservice.php Thunderer $
* @copyright (c) 2012 Thunderer
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.T'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('mods/termsofservice');
// Output page
page_header($user->lang['TERMSOFSERVICE'])
;$template->set_filenames(array('body' => 'termsofservice_body.html')
);
page_footer();
?>
phpbbroot/styles/prosilver/template/termsofservice_body.html AFTER running through W3 Validator...
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- INCLUDE overall_header.html -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy for Linux (vers 6 November 2007), see www.w3.org" />
<title></title>
<style type="text/css">
/*<![CDATA[*/
table.c3 {border-collapse: collapse;}
span.c2 {font-size: 120%}
h2.c1 {text-align: center}
/*]]>*/
</style>
</head>
<body>
<table border="0" width="80%" id="table1" class="c3" cellpadding="0">
<tr>
<td height="100">
<h2 class="c1"><strong>{L_TERMSOFSERVICE_NAME}</strong></h2>
</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td align="center"><strong><span class="c2">{L_TERMSOFSERVICE_TITLE}</span></strong></td>
</tr>
<tr>
<td height="41"></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td align="left">{L_TERMSOFSERVICE_TERMS}</td>
</tr>
<tr>
<td align="left"></td>
</tr>
<tr>
<td align="left">{L_TERMSOFSERVICE_THANKS}</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>{L_TERMSOFSERVICE_TERMS2}</td>
</tr>
<tr>
<td></td>
</tr>
</table>
<!-- INCLUDE overall_footer.html -->
</body>
</html>
phpbbroot/styles/prosilver/template/termsofservice_body.html (Original Version)
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- INCLUDE overall_header.html -->
<p>
<div align="center">
<table border="0" width="80%" id="table1" style="border-collapse: collapse; " cellpadding="0">
<tr>
<td height="100">
<p align="center"><font size="5"><b>{L_TERMSOFSERVICE_NAME}</b></font></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="center"><b><font size="4">{L_TERMSOFSERVICE_TITLE}</font></b></td>
</tr>
<tr>
<td height="41"> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="left">{L_TERMSOFSERVICE_TERMS}</td>
</tr>
<tr>
<td align="left"> </td>
</tr>
<tr>
<td align="left">{L_TERMSOFSERVICE_THANKS}</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>{L_TERMSOFSERVICE_TERMS2}</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</div>
<br />
</p>
<!-- INCLUDE overall_footer.html -->
Code: Select all
<?php
/**
*
* template[English]
*
* @package language
* @version $Id: template.php Raimon $
* @copyright (c) 2012 Thunderer
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* DO NOT CHANGE
*/
if (!defined('IN_PHPBB'))
{
exit;
}
if (empty($lang) || !is_array($lang))
{
$lang = array();
}
// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page The International Fellowship Of Trade Cyclists of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
//
// Some characters you may want to copy&paste:
// ’ » “ ” …
//
$lang = array_merge($lang, array(
'TERMSOFSERVICE' => 'Terms of service',
'TERMSOFSERVICE_EXPLAIN' => 'View the terms of service',
'VIEWING_TERMSOFSERVICE' => 'Viewing the terms of service',
'TERMSOFSERVICE_NAME' => 'The ---YOUR GROUP/FORUM NAME GOES HERE---',
'TERMSOFSERVICE_TITLE' => 'These are the Terms of service',
'TERMSOFSERVICE_TERMS' => '<strong>THESE ARE THE TERMS OF SERVICE THAT YOU AGREE TO WHEN SIGNING UP TO BE A MEMBER OF THE FORUM. WE HAVE PROVIDED THEM HERE IN THE HOPE THAT YOU WILL TAKE THE TIME TO PERIODICALLY REFERENCE THEM.</strong>',
'TERMSOFSERVICE_THANKS' => '<strong>WE THANK YOU FOR YOUR PATIENCE IN RE-READING THEM AND HOPE THAT YOU UNDERSTAND THEM.IF YOU HAVE ANY QUERIES OR QUESTIONS CONCERNING THESE TERMS OF SERVICE, PLEASE CONTACT AN ADMINISTRATOR OF THE FORUM.</strong>',
'TERMSOFSERVICE_TERMS2' => 'YOUR TERMS GO HERE',
));
?>
Code: Select all
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<?xml-stylesheet type="text/xsl" href="modx.prosilver.en.xsl"?>
<!--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/-->
<mod xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.phpbb.com/mods/xml/modx-1.2.5.xsd">
<header>
<license>http://opensource.org/licenses/gpl-license.php GNU General Public License v2</license>
<title lang="en">Terms MOD</title>
<description lang="en">
This MOD will add a new page to your forum titled "Terms Of Service" using session management (As per "Raimon's" original MOD),
The page link is added in the same area as the "FAQ", "Members" and "login/logout" links.
</description>
<author-notes lang="en">
<![CDATA[
This MOD is a modification, Re-compososition and expansion of "Raimon's" original "Blank Template MOD".
.
]]>
</author-notes>
<author-group>
<author>
<realname>Ron Whitmill</realname>
<username>Thunderer</username>
<homepage></homepage>
</author>
</author-group>
<mod-version>1.0.1</mod-version>
<installation>
<level>advanced</level>
<time>930</time>
<target-version>3.0.10</target-version>
</installation>
</header>
<action-group>
<copy>
<file from="root/termsofservice.php" to="termsofservice.php" />
<file from="root/language/en/mods/termsofservice.php" to="language/en/mods/termsofservice.php" />
<file from="root/styles/prosilver/template/termsofservice_body.html" to="styles/prosilver/template/termsofservice_body.html" />
</copy>
<open src="viewonline.php">
<edit>
<find>
<![CDATA[ case 'search':
$location = $user->lang['SEARCHING_FORUMS'];
$location_url = append_sid("{$phpbb_root_path}search.$phpEx");
break;]]>
</find>
<action type="after-add">
<![CDATA[
case 'termsofservice':
$location = $user->lang['VIEWING_TERMSOFSERVICE'];
$location_url = append_sid("{$phpbb_root_path}termsofservice.$phpEx");
break;
]]>
</action>
</edit>
</open>
<open src="includes/functions.php">
<edit>
<find><![CDATA[
// The following assigns all _common_ variables that may be used at any point in a template.
]]>
</find>
<action type="before-add">
<![CDATA[
$user->add_lang('mods/termsofservice');]]>
</action>
</edit>
<edit>
<find><![CDATA[
'U_PRIVATEMSGS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'),
]]>
</find>
<action type="before-add">
<![CDATA[
'U_TERMSOFSERVICE' => append_sid("{$phpbb_root_path}termsofservice.$phpEx"),
]]>
</action>
</edit>
</open>
<open src="styles/prosilver/template/overall_header.html">
<edit>
<find><![CDATA[<!-- IF not S_IS_BOT -->
<!-- IF not S_USER_LOGGED_IN and S_REGISTER_ENABLED and not (S_SHOW_COPPA or S_REGISTRATION) --><li class="icon-register"><a href="{U_REGISTER}">{L_REGISTER}</a></li><!-- ENDIF -->]]></find>
<action type="before-add"><![CDATA[
<li class="icon-faq"><a href="{U_TERMSOFSERVICE}" title="{L_TERMSOFSERVICE_EXPLAIN}">{L_TERMSOFSERVICE}</a></li>
]]></action>
</edit>
</open>
<open src="styles/prosilver/template/overall_footer.html">
<edit>
<find><![CDATA[<!-- IF U_TEAM --><a href="{U_TEAM}">{L_THE_TEAM}</a> ]]></find>
<action type="before-add"><![CDATA[<li class="icon-faq"><a href="{U_TERMSOFSERVICE}" title="{L_TERMSOFSERVICE_EXPLAIN}">{L_TERMSOFSERVICE}</a></li>]]></action>
</edit>
</open>
<diy-instructions lang="en">
Don't forget to clear your cache and refresh your templates after you have installed this MOD, or you may not see the pages and links you have just installed.
Good Luck with your forum. ;)
</diy-instructions>
</action-group>
</mod>
If anyone has any pinters on where to start on the acp integration, I would be very grateful. I'm still learning this php and implementing ACP integration frankly scares me.