In the core ONLINE block number of read and unread meassages of PN Meassage module are shown.
If I like to use number of read and unread meassages of pnPHPbb2 which varibales of pnPHPbb2 should I put in ONLINE block file.
Sample code would be more help.
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 07:01 AM
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 06:41 AM
- ehdwma created topic »Hide "Register new account" and change template to 3 col« 06:27 AM
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 01:29 AM
- mdee created topic »How to implement returnpage ?« 01:00 AM
- nestormateo responded to »Fillters in Clip« 24. May
- damon responded to »Can the Updated Version Check be Turned Off (Z 1.3)« 24. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
pnPHPbb2 Message Varibale
-
- Rank: Softmore
- Registered: Nov 03, 2003
- Last visit: Nov 22, 2009
- Posts: 154
I have the same question as well
Im using OnlineXp block and well the original code is like this :
Code
if (pnUserLoggedIn()) {
$content .= '<br />';
if ($vars['icons'] =="1") {$content .= "<img src=images/blocks/authors.gif align=absmiddle>";}
$content .= ' '._YOUARELOGGED.' <b>' .pnUserGetVar('uname') . '</b>.<br />';
$column = &$pntable['priv_msgs_column'];
$result2 = $dbconn->Execute("SELECT count(*) FROM $pntable[priv_msgs] WHERE $column[to_userid]=" . pnUserGetVar('uid'));
list($numrow) = $result2->fields;
// get unread messages
$result3 = $dbconn->Execute("SELECT count(*) FROM $pntable[priv_msgs] WHERE $column[to_userid]=" . pnUserGetVar('uid') . " AND $column[read_msg]='0'");
list($unreadrow) = $result3->fields;
if ($numrow == 0) {
$content .= '<br /></span>';
} else {
$content .= "<br />";
if ($vars['icons'] =="1") {$content .= "<img src=images/blocks/email.gif align=absmiddle vspace=2>";}
$content .= " "._YOUHAVE." (<a class=\"pn-normal\" href=\"modules.php?op=modload&name=Messages&file=index\">".pnVarPrepForDisplay($numrow)."</a>|<a class=\"pn-normal\" href=\"modules.php?op=modload&name=Messages&file=index\" title=\""._PRIVATEMSGNEW."\"><b>".pnVarPrepForDisplay($unreadrow)."</b></a>) ";
What I did is :
-replace the 'priv_msgs' table with 'phpbb_privmsgs' table
-replaced the link so it would point to pnphpbb2 link
-replaced $column[read_msg] with $column[type] as i thought it would be the only identifier of the unread messages.
so the new code would be:
Code
if (pnUserLoggedIn()) {
$content .= '<br />';
if ($vars['icons'] =="1") {$content .= "<img src=images/blocks/authors.gif align=absmiddle>";}
$content .= ' '._YOUARELOGGED.' <b>' .pnUserGetVar('uname') . '</b>.<br />';
$column = &$pntable['phpbb_privmsgs_column'];
$result2 = $dbconn->Execute("SELECT count(*) FROM $pntable[phpbb_privmsgs] WHERE $column[to_userid]=" . pnUserGetVar('uid'));
list($numrow) = $result2->fields;
// get unread messages
$result3 = $dbconn->Execute("SELECT count(*) FROM $pntable[phpbb_privmsgs] WHERE $column[to_userid]=" . pnUserGetVar('uid') . " AND $column[type]='1'");
list($unreadrow) = $result3->fields;
if ($numrow == 0) {
$content .= '<br /></span>';
} else {
$content .= "<br />";
if ($vars['icons'] =="1") {$content .= "<img src=images/blocks/email.gif align=absmiddle vspace=2>";}
$content .= " "._YOUHAVE." (<a class=\"pn-normal\" href=\"index.php?name=PNphpBB2&file=privmsg&folder=inbox\">".pnVarPrepForDisplay($numrow)."</a>|<a class=\"pn-normal\" href=\"modules.php?op=modload&name=Messages&file=index\" title=\""._PRIVATEMSGNEW."\"><b>".pnVarPrepForDisplay($unreadrow)."</b></a>) ";
if ($numrow==1) {
$content .= _PRIVATEMSG ;
}
elseif ($numrow>1) {
$content .= _PRIVATEMSGS ;
}
now, nothing from that is working, I wonder how can I make it work !?
any help would be much appreciated -
**unknown user**
- Rank: Freshman
- Registered: Mar 16, 2002
- Last visit: Jan 29, 2005
- Posts: 72
anim_chowdhury
Sample code would be more help.
Lol.
These are the queries we can use for those variable values.
Code
$prefix = $pnconfig['prefix'] . "_phpbb";
$sql1 = "SELECT user_new_privmsg FROM " . $prefix ."_users WHERE user_id='$uid'";
$result1 = $dbconn->Execute($sql1);
Number of new messages = $result1
Code
$sql2 = "SELECT user_unread_privmsg FROM " . $prefix ."_users WHERE user_id='$uid'";
$result2 = $dbconn->Execute($sql2);
Number of unread messages = $result2
Code
$sql3 = "SELECT COUNT(*) FROM " . $prefix ."_privmsgs WHERE privmsgs_to_userid='$uid' AND privmsgs_type!='2'";
$result3 = $dbconn->Execute($sql3);
Number of total messages = $result3 -
- Rank: Softmore
- Registered: Nov 03, 2003
- Last visit: Nov 22, 2009
- Posts: 154
there's no need for unread and new messages, both would be the same I guess
I updated the code (which still doest work)
Code
if (pnUserLoggedIn()) {
$uid = pnUserGetVar('uid');
$content .= '<br />';
if ($vars['icons'] =="1") {$content .= "<img src=images/blocks/authors.gif align=absmiddle>";}
$content .= ' '._YOUARELOGGED.' <b>' .pnUserGetVar('uname') . '</b>.<br />';
$column = &$pntable['phpbb_privmsgs_column'];
$result2 = $dbconn->Execute("SELECT count(*) FROM $pntable[phpbb_privmsgs] WHERE $column[privmsgs_to_userid]=" . $uid AND ($column[privmsgs_type]='1' or $column[privmsgs_type]='5' or $column[privmsgs_type]='0'));
list($numrow) = $result2->fields; //"privmsgs WHERE (privmsgs_type='1' or privmsgs_type='5') and privmsgs_to_userid=" . $uid)
// get unread messages
$result3 = $dbconn->Execute("SELECT count(*) FROM $pntable[phpbb_privmsgs] WHERE $column[privmsgs_to_userid]=" . $uid. " AND ($column[privmsgs_type]='1' or $column[privmsgs_type]='5')");
list($unreadrow) = $result3->fields;
this code is the same as the one in pnphpb2 mutiblock, but again it does not work :|
- Moderated by:
- Support
