Enhanced PM System includes:- A more dynamic PM Read layout.
- A better PM Notification.
- A 'total pm' feature.
Preview:
(
The missing 'have', is fixed within the coding. ;))
Alrighty then, first things first. This modification, does not require any Database entries =D, kinda..
If you have installed my Forum Modification, you don't need mess around with your Database =D
This PM Enhancement, uses the 'postbar' feature from the Forum Modification, if you want details on how to 'install' the postbar feature(meaning the database part) go to this thread:
Forum Modification
Okay, so first go to your
functions.php file, and find your sidebar function where it says:
PHP Code:
$msgctr = "<a href='messages.php'>Visit Message Center</a><br>";
$query = "SELECT * FROM ".$prefix."messages WHERE touser='".$loggedinname."' and status='unread'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > 0){
$msgctr = "<a href='messages.php'>Visit Message Center</a>(<b>".$num."</b>)<br>";
And replace that entire thing with this:
PHP Code:
$msgctr = "<a href='messages.php'>Visit Message Center</a>(Unread: 0 | Total: 0)<br>";
$query = "SELECT * FROM ".$prefix."messages WHERE touser='".$loggedinname."'";
$result = mysql_query($query);
$num2 = mysql_numrows($result);
if($num2 > 0){
$msgctr = "<a href='messages.php'>Visit Message Center</a>(Unread: 0 | Total: ".$num2.")<br>";
}
$query = "SELECT * FROM ".$prefix."messages WHERE touser='".$loggedinname."' and status='unread'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > 0){
$msgctr = "<a href='messages.php'>Visit Message Center</a>(Unread: <b>".$num."</b> | Total: ".$num2.")<br>";
The newly added query will help us get the 'total amount' of PM's that we have currently. (The total amount is based off of the PM's sent to you, not the PM's you have sent.)
Now, just for the sake of it, I am going to have you add the function that calls that 'postbar', you will be adding it right after your 'sidebar' function.
PHP Code:
function getpostbar($name){
include("config.php");
$query = "SELECT * FROM ".$prefix."users WHERE username = '".$name."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
$membersince=@mysql_result($result,$i,"membersince");
$displayquote=@mysql_result($result,$i,"displayquote");
$profilepic=@mysql_result($result,$i,"profilepic");
$postbar = "
<span class='smalltext'>
<img src='".$profilepic."'><br>
<b>Member Since: </b><br>".$membersince."<br>
<b>Quote:</b><br>
".$displayquote."<br>
</span>
";
return $postbar;
}
Now, you make the 'postbar' contain whatever you want. But I had the 'postbar' act like that of an actual 'postbar' minus the posts. (For now ;) )
Okay, now you will need to add the following code, to any page you want your PM Notification to show up. You will need to paste at the of each page:
PHP Code:
if($isloggedin == "yes") {
$query = "SELECT * FROM ".$prefix."messages WHERE touser='".$loggedinname."' and status='unread'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > 0){
$msg = "
<table width='450' border='1' cellpadding='3' cellspacing='1' bordercolor='1' bgcolor='#F9AE00'>
<td>
<table width='450' border='1' cellpadding='3' cellspacing='1' bordercolor='1' bgcolor='#FECF61'>
<tr>
<td><center>You a new message(s): <a href='messages.php'>Visit Message Center</a>(<b>".$num."</b>)<br></center></td>
</tr>
</table>
</table>";
}
$article_content = "".$msg."<br>".$article_content."";
}
The Mysql query in this code, does the samething as the one in your 'sidebar' function, except the output is more.. attention seeking ;)
Now, the last thing(s) you have to do is replace your
message.php file and your
pmpost.php file, with these new
message.php and
pmpost.php files.
A little notice, the new
message.php file, contains the neccesssary(sp) coding for my Report Member Modification. If you want that part of the code to work, you will need to 'install' my Warning System Modification, found here:
Warning System
If you don't want it, all you have to do, edit the out the link that takes the member to the reporting page.
Another notice, any link inside the new
message.php file that goes to the profile, you will have to edit, because as it is currently the link will say
profile2.php, You currently don't have (or shouldnt have) a file that says that, because I haven't 'release' my Custom Profile Modification yet.
(The reason I don't do this myself, is because I am trying to get you familiarized with the coding.)
Anywho, on to the pages you need to install:
[attachment=181][attachment=180][attachment=187]