Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Themes
Author Message
ecvej
Hangin' Around


Joined: Oct 10, 2004
Posts: 45
Location: Northampton, UK

PostPosted: Sun Oct 24, 2004 12:00 pm Reply with quote

I'm editing my theme.php file which is why I'm posting here. As many popup blockers stop the popup on private message, I have made a way to edit my theme.php to change the colour of my header background when a user has an unread pm. Replace

Code:
$tmpl_file = "themes/3D-Fantasy/header.html";

    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;


With

Code:
function pms() {

global $user, $user_prefix, $prefix, $cookie, $db;
cookiedecode($user);
$username = $cookie[1];
$sql = "select user_new_privmsg from ".$user_prefix."_users where username='$username'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$user_new_privmsg = $row[user_new_privmsg];
if ($user_new_privmsg > 0) {
$tmpl_file = "themes/3D-Fantasy/headerpm.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
}
else {
$tmpl_file = "themes/3D-Fantasy/header.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
}
}
pms();


Then open your header.html file, change line
Code:
<td bgcolor="ffffff" width="100%">
and put in a different colour code than ffffff and save as headerpm.html. NB you should now have an unaltered header.html and a headerpm.html in your themes\chosentheme\ directory.

The above is fine and works ok for me using 3D-Fantasy theme. However, perhaps someone can come up with a better way of displaying when a user has a new PM without a java pop up? Would it be possible to send a broadcast message to just that one user for example?

*gauntlet thrown down*
 
View user's profile Send private message
ecvej
PostPosted: Tue Nov 02, 2004 9:11 am Reply with quote

*picks up gauntlet he dropped*

Errr so thanks for your ideas Wink I put my theme.php file back to how it was and decided to have a flashing status bar message as it's a slicker look. Changed the header.php file so this thread definitely needs moving from the theme section!

Code:
############################################################

function pms() {
global $user, $user_prefix, $prefix, $cookie, $db;
cookiedecode($user);
$username = $cookie[1];
$sql = "select user_new_privmsg from ".$user_prefix."_users where username='$username'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$user_new_privmsg = $row[user_new_privmsg];
if ($user_new_privmsg > 0) {
$message = 1;
}
else {
$message = 0;
}
return $message;
}
$message = pms();
##############################################

<SCR IPT>
<!--
//Pass variables to Javascript
var pm = '<?php echo $message?>';

//Function for PMs
var yourwords = "You have a new message";
var speed = 500;
var control = 1;
function flash()
{
if (pm == 1)
{
if (control == 1)
{
window.status=yourwords;
control=0;
}
else
{
window.status="";
control=1;
}
setTimeout("flash();",speed);
}
else
{
window.status= "ecvej.com";
}
}

//-->
</SCR IPT>
</HEAD>
<BODY onLoad = "flash()">
</HTML>



NB There isn't meant to be a space in the code above for the word <SCR IPT>
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Themes

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©