Support Spidean

Do you like our FREE downloads? How about the FREE support for the FREE downloads? Please help us out and donate any amount! It's fast and easy through PayPal.

Spidean Forums

Board Index > PHP > Messages when user logged in > Post Reply


Post Reply
Icon:
Message:



[More smilies...]
Bold   Italic   Underline   Code   Email   Quote   Url   Image   
Rights

HTML is Off
Smilies are On
BB Code is On
[img] Code is On

Disable smileys?
Use signature?
Turn BBCode off?
Receive email notification of new replies?

Topic Review


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.




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




posted on 5/6/2003 at 07:42 PM

What does it DO or NOT do?
Where is this code located?

-Shawn




Icon depicting mood of post 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



Main Menu

Get AutoTheme

Featured Item

Theme
Theme
$19.95

Poll

How do you like the new look?

[ Results | Polls ]

Votes: 105
Comments: 0

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