2012-08-17, 02:08 PM
i just reposted this: http://community.mybb.com/thread-120815-...#pid872179
Is there a MyBB plugin like this or javascript to do this?
Basically it's a quirky little reminder for guests to register on your site which displays on any edge of the site:
examples
Now I found a php script for vBulletin that does this, here's what it looks like:
I've used the Guest warn mod plugin by clear before but it doesn't quite fit what I want as the above script does.
Any ideas and/or input?
thanks.
i also tried using different mods for guest but it also doesn't fit what i need. So anyone could help me do it? Thanks a lot!
Is there a MyBB plugin like this or javascript to do this?
Basically it's a quirky little reminder for guests to register on your site which displays on any edge of the site:
examples
Now I found a php script for vBulletin that does this, here's what it looks like:
placed in header
vBulletin Plugin notes:
in additional.css append:
div.forcetoregister {
background:url(images/misc/register.png);
background-repeat: no-repeat;
width:300px;
height:200px;
padding:0 5px 3px;
position:fixed;
right:1px;
bottom:0px;
z-index:1;
}
or
div.forcetoregister {
background: url(rotate.php) no-repeat scroll 0 0 transparent;
bottom: 0;
height:200px;
position:fixed;
right:1px;
bottom:0px;
z-index:1;
}
To show it on EVERY PAGE add this:
<vb:if condition="$show['guest']"><a href="/register.php"><div class="forcetoregister"></div></a></vb:if>
To show it only on FIRST PAGE (forum home) add this:
<vb:if condition="THIS_SCRIPT == 'index'">
<vb:if condition="$show['guest']"><a href="/register.php"><div class="forcetoregister"></div></a></vb:if>
</vb:if>
To show it on every page EXCEP THE REGISTER PAGE, add this code:
<vb:if condition="THIS_SCRIPT != 'register'">
<vb:if condition="$show['guest']"><a href="/register.php"><div class="forcetoregister"></div></a></vb:if>
</vb:if>
Paste in header
<div class="forcetoregister"></div>
_______________________________________
<?php
$folder = 'images/misc/ftr';
$extList = array();
$extList['gif'] = 'image/gif';
$extList['jpg'] = 'image/jpeg';
$extList['jpeg'] = 'image/jpeg';
$extList['png'] = 'image/png';
$img = null;
if (substr($folder,-1) != '/') {
$folder = $folder.'/';
}
if (isset($_GET['img'])) {
$imageInfo = pathinfo($_GET['img']);
if (
isset( $extList[ strtolower( $imageInfo['extension'] ) ] ) &&
file_exists( $folder.$imageInfo['basename'] )
) {
$img = $folder.$imageInfo['basename'];
}
} else {
$fileList = array();
$handle = opendir($folder);
while ( false !== ( $file = readdir($handle) ) ) {
$file_info = pathinfo($file);
if (
isset( $extList[ strtolower( $file_info['extension'] ) ] )
) {
$fileList[] = $file;
}
}
closedir($handle);
if (count($fileList) > 0) {
$imageNumber = time() % count($fileList);
$img = $folder.$fileList[$imageNumber];
}
}
if ($img!=null) {
$imageInfo = pathinfo($img);
$contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ];
header ($contentType);
readfile($img);
} else {
if ( function_exists('imagecreate') ) {
header ("Content-type: image/png");
$im = @imagecreate (100, 100)
or die ("Cannot initialize new GD image stream");
$background_color = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 0,0,0);
imagestring ($im, 2, 5, 5, "IMAGE ERROR", $text_color);
imagepng ($im);
imagedestroy($im);
}
}
?>
Can't php code be added to the template file to check if user is a guest and then display an image?I've used the Guest warn mod plugin by clear before but it doesn't quite fit what I want as the above script does.
Any ideas and/or input?
thanks.
i also tried using different mods for guest but it also doesn't fit what i need. So anyone could help me do it? Thanks a lot!