Author: Gizmo (James of
VNC Web Services)
Requirements: UBB.Threads 7.x (not compatible with UBB.Threads 6.x or below)
About:This modification will allow you to add "signup nag screens" to your forums; these will show for any indicated groups (through the "Site Permissions" screen.
We use a Custom Island for the nag screen, you'll need to configure one to your liking.
Demo:You can see a working demo on
UGN Security.
Install Instructions:Add The New PermissionUsing PHPMyAdmin or the UBB.T7 Database Tools Page, execute the following (adds the new permission to the db, be sure to change ubbt_ to your db prefix):
ALTER TABLE `ubbt_SITE_PERMISSIONS` ADD `SHOW_NAG` TINYINT( 4 ) NOT NULL DEFAULT '0';
And (adds the new permission to the permission group, be sure to change "yourdb" to your database name and "ubbt_" to your db prefix):
INSERT INTO `yourdb`.`ubbt_PERMISSION_LIST` (`PERMISSION_NAME`, `PERMISSION_IS_HIGH` , `PERMISSION_IS_LOW` , `PERMISSION_TYPE`, `PERMISSION_ORDER`) VALUES ('SHOW_NAG', '1', '0', 'site', '8');
Now, edit the language file "admin/siteperms.php" and add the following (gives the new permission a name for the editing screens):
$ubbt_lang['SHOW_NAG'] = "Must View Nag Screens";
Now, go to the Site Permissions link in the control panel, and add what groups should be forced to view the nag (example, guests).
Create a Custom IslandGo to the CP and create a new Custom Island, you'll need the "External Use" code for this island for our next step. This island will contain all of the data for the nag screen. You can get the external use code for the Custom Island from the Portal Layout screen.
For our example, mine is:
<?php
if (!defined('UBB_MAIN_PROGRAM')) define('UBB_MAIN_PROGRAM',1);
$style_side="";$tbopen="";$tbclose="";
echo "<table width=\"100%\">";
include("/home/siteuser/public_html/forum/languages/english/portal_islands.php");
include("/home/siteuser/public_html/forum/languages/english/generic.php");
include("/home/siteuser/public_html/forum/cache/portal_box_10.php");
echo "</table>";
?>
Please note that ALL we need here are the include lines; you'll use these in place of mine in the below steps.
Add The ContentFiles modified:
scripts/activetopics.inc.php
scripts/cfrm.inc.php
scripts/postlist.inc.php
scripts/showflat.inc.php
templates/default/activetopics.tpl
templates/default/cfrm.tpl
templates/default/cfrm_cat_only.tpl
templates/default/postlist.tpl
templates/default/showflat.tpl
In scripts/activetopics.inc.php Find:
extract($in, EXTR_OVERWRITE | EXTR_REFS); // quick and dirty fix - extract hash values as vars
Add After:
if($userob->check_access("site","SHOW_NAG")) {
$nag = 1;
}
Find:
Add AFTER:
In templates/default/activetopics.tpl Find:
{* Script Version 7.5.3 *}
Add After:
{if $nag eq '1'}
{php}
if (!defined('UBB_MAIN_PROGRAM')) define('UBB_MAIN_PROGRAM',1);
$style_side="";
$tbopen="<table width=\"100%\" class=\"t_outer\" cellpadding=\"0\" cellspacing=\"0\">\n<tr>\n<td>\n<table width=\"100%\" class=\"t_inner\" cellpadding=\"0\" cellspacing=\"1\">\n<thead>";
$tbclose="</thead>\n</table>\n</td>\n</tr>\n</table>";
include("/home/siteuser/public_html/forum/languages/english/portal_islands.php");
include("/home/siteuser/public_html/forum/languages/english/generic.php");
include("/home/siteuser/public_html/forum/cache/portal_box_10.php");
{/php}
{/if}
In scripts/cfrm.inc.php (this is for the main index) Find:
extract($in, EXTR_OVERWRITE | EXTR_REFS); // quick and dirty fix - extract hash values as vars
Add After:
if($userob->check_access("site","SHOW_NAG")) {
$nag = 1;
}
Find:
Add After:
In templates/default/cfrm.tpl Find:
{if $introtitle}
{$tbopen}
<tr>
<td class="tdheader">{$introtitle}</td>
</tr>
<tr>
<td class="alt-1">{$introbody}</td>
</tr>
{$tbclose}
{/if}
Add AFTER:
{if $nag eq '1'}
{php}
if (!defined('UBB_MAIN_PROGRAM')) define('UBB_MAIN_PROGRAM',1);
$style_side="";
$tbopen="<table width=\"100%\" class=\"t_outer\" cellpadding=\"0\" cellspacing=\"0\">\n<tr>\n<td>\n<table width=\"100%\" class=\"t_inner\" cellpadding=\"0\" cellspacing=\"1\">\n<thead>";
$tbclose="</thead>\n</table>\n</td>\n</tr>\n</table>";
include("/home/siteuser/public_html/forum/languages/english/portal_islands.php");
include("/home/siteuser/public_html/forum/languages/english/generic.php");
include("/home/siteuser/public_html/forum/cache/portal_box_10.php");
{/php}
{/if}
In templates/default/cfrm_cat_only.tpl Find:
{if $introtitle}
{$tbopen}
<tr>
<td class="tdheader">{$introtitle}</td>
</tr>
<tr>
<td class="alt-1">{$introbody}</td>
</tr>
{$tbclose}
{/if}
Add AFTER:
{if $nag eq '1'}
{php}
if (!defined('UBB_MAIN_PROGRAM')) define('UBB_MAIN_PROGRAM',1);
$style_side="";
$tbopen="<table width=\"100%\" class=\"t_outer\" cellpadding=\"0\" cellspacing=\"0\">\n<tr>\n<td>\n<table width=\"100%\" class=\"t_inner\" cellpadding=\"0\" cellspacing=\"1\">\n<thead>";
$tbclose="</thead>\n</table>\n</td>\n</tr>\n</table>";
include("/home/siteuser/public_html/forum/languages/english/portal_islands.php");
include("/home/siteuser/public_html/forum/languages/english/generic.php");
include("/home/siteuser/public_html/forum/cache/portal_box_10.php");
{/php}
{/if}
In scripts/postlist.inc.php Find:
extract($in, EXTR_OVERWRITE | EXTR_REFS); // quick and dirty fix - extract hash values as vars
Add AFTER:
if($userob->check_access("site","SHOW_NAG")) {
$nag = 1;
}
Find:
Add AFTER:
In templates/default/postlist.tpl Find:
{if $intro_title}
{$tbopen}
<tr>
<td class="tdheader">
{$intro_title}
</td>
</tr>
<tr>
<td class="alt-1">
{$intro_body}
</td>
</tr>
{$tbclose}
{/if}
Add AFTER:
{if $nag eq '1'}
{php}
if (!defined('UBB_MAIN_PROGRAM')) define('UBB_MAIN_PROGRAM',1);
$style_side="";
$tbopen="<table width=\"100%\" class=\"t_outer\" cellpadding=\"0\" cellspacing=\"0\">\n<tr>\n<td>\n<table width=\"100%\" class=\"t_inner\" cellpadding=\"0\" cellspacing=\"1\">\n<thead>";
$tbclose="</thead>\n</table>\n</td>\n</tr>\n</table>";
include("/home/siteuser/public_html/forum/languages/english/portal_islands.php");
include("/home/siteuser/public_html/forum/languages/english/generic.php");
include("/home/siteuser/public_html/forum/cache/portal_box_10.php");
{/php}
{/if}
In scripts/showflat.inc.php Find:
extract($in, EXTR_OVERWRITE | EXTR_REFS); // quick and dirty fix - extract hash values as vars
Add AFTER:
if($userob->check_access("site","SHOW_NAG")) {
$nag = 1;
}
Find:
Add AFTER:
In templates/default/showflat.tpl Find:
Add ABOVE:
{if $nag eq '1'}
{php}
if (!defined('UBB_MAIN_PROGRAM')) define('UBB_MAIN_PROGRAM',1);
$style_side="";
$tbopen="<table width=\"100%\" class=\"t_outer\" cellpadding=\"0\" cellspacing=\"0\">\n<tr>\n<td>\n<table width=\"100%\" class=\"t_inner\" cellpadding=\"0\" cellspacing=\"1\">\n<thead>";
$tbclose="</thead>\n</table>\n</td>\n</tr>\n</table>";
include("/home/siteuser/public_html/forum/languages/english/portal_islands.php");
include("/home/siteuser/public_html/forum/languages/english/generic.php");
include("/home/siteuser/public_html/forum/cache/portal_box_10.php");
{/php}
{/if}