MASsIVE
Senior Member   Posts: 106 Registered: 2/15/2003 Status: Offline
|
posted on 5/5/2003 at 09:58 PM |
Can someone make this work??
if (pnUserLoggedIn()) {
//This is the database hit
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$column = &$pntable['priv_msgs_column'];
$result2 = $dbconn->Execute("SELECT count(*) FROM $pntable[priv_msgs]
WHERE $column[to_userid]=" . pnUserGetVar('uid')." AND
$column[read_msg]='0'");
list($numrow) = $result2->fields;
$result2->Close();
//Now starts the output
echo "Welcome to $sitename "
.pnUserGetVar("uname");
//This statement displays the amount of unread messages (or nothing if
there are none)
if ($numrow == 0) {
echo"";
} else {
echo " You have ".pnVarPrepForDisplay($numrow)." ";
//This should be fairly self explainatory!
if ($numrow==1) {
echo "new message";
}
elseif ($numrow>1) {
echo "new messages";
}
echo"";
}
//This message will come up if no one is logged.
}else{
echo"Please register (or somthing...)";
}
it's not working properly for 0.7.2.3
this modified as a command would be excellent, but fixed
any takers hahaaa |
| |
| |
shawn
Administrator   Posts: 4548 Registered: 10/7/2002 Status: Offline
|
posted on 5/6/2003 at 07:42 PM |
What does it DO or NOT do?
Where is this code located?
-Shawn |
| |
MASsIVE
Senior Member   Posts: 106 Registered: 2/15/2003 Status: Offline
|
posted on 5/6/2003 at 09:03 PM |
its supposed to show the username adn the amount of read and unread
messages when a user is logged in.
but need a gif or animated gif beside it (left) this will catch the logged
in users eye and the digits (0|6) would be linked to the inbox or
readbox.
Does this help ?? |
| |
msandersen
Newbie   Posts: 4 Registered: 7/4/2003 Status: Offline
|
posted on 7/15/2003 at 02:00 AM |
This is what I use (You can see it here:
[url=http://users.tpg.com.au/staer/Downloads/PostNuke-V.zip]PostNuke-V.zip[
/url ])
code: <?PHP ////// If logged
in, display welcome, else display loginform on top bar //////
if (pnUserLoggedIn()) { $username = pnUserGetVar('uname');
echo " "._WELCOME.$username."!"; // If logged in,
show greeting
// Display private messages
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$column = &$pntable['priv_msgs_column'];
// Get total number of messages from database
$result = $dbconn->Execute("SELECT count(*) FROM
$pntable[priv_msgs] WHERE $column[to_userid]=" . pnUserGetVar('uid'));
list($messages) = $result->fields;
// Get number of unread messages
$result2 = $dbconn->Execute("SELECT count(*) FROM $pntable[priv_msgs]
WHERE $column[to_userid]=".pnUserGetVar('uid')." AND
$column[read_msg]='0'");
list($unread) = $result2->fields;
if ($messages > 0) { ?>
<SPAN class="topmenu"><?PHP echo _YOUHAVE ?> <A
href="Messages.html"><B><?PHP echo
pnVarPrepForDisplay($messages)
." ".($messages==1 ? _PRIVATEMSG : _PRIVATEMSGS)
?></b></a>, <?PHP echo "$unread "._UNREAD; ?>
</span>
<?PHP }
Also requres setting the globals.php language file;
quote: define('_WELCOME','Welcome ');
if (!defined("_YOUHAVE")) {
define('_YOUHAVE','You have'); }
if (!defined("_PRIVATEMSG")) {
define('_PRIVATEMSG','message'); }
if (!defined("_PRIVATEMSGS")) {
define('_PRIVATEMSGS','messages'); }
define('_UNREAD','unread');
Martin
PS: There seem to be a problem previewing the post. In the textarea, it
includes the HTML code for the page below it, and there is no page rendered
below the text area, so it can't be submitted. |
| |
|
|
|
|
Page created in 0.347190 Seconds
|