Spidean Forums


 < Last Thread   Next Thread >Ascending sortDescending sorting  New Topic  Post Reply
Author: Subject: Messages when user logged in

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 "&nbspYou have&nbsp".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 o­ne 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

 
Reply With Quote Visit User's Homepage

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

 
Reply With Quote

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 ??

 
Reply With Quote

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 "&nbsp;&nbsp;"._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)
."&nbsp;".($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.

 
Reply With Quote
New Topic    Post Reply


Main Menu

Get AutoTheme

New Template

Featured Item

Poll

How do you like the new look?

[ Results | Polls ]

Votes: 30
Comments: 0

Powered by the AutoTheme HTML Theme System
Page created in 0.347190 Seconds