SmartFAQ is developed by The SmartFactory (https://www.smartfactory.ca), a division of InBox Solutions (https://www.inboxsolutions.net)

How can I make a block to show my PMs ?
make a php custom block with the following code;
global $xoopsUser;
if( 
$xoopsUser )
{
  
$pm_handler =& xoops_gethandler('privmessage');
  
$criteria = new CriteriaCompo(new Criteria('read_msg'0));
  
$criteria->add(new Criteria('to_userid'$xoopsUser->getVar('uid')));
  
$pm $pm_handler->getCount($criteria);
}

if( 
$pm )
{
  echo 
"<a href="/viewpmsg.php" title="Read your new Private Messages">Private Messages ($pm)</a>n";
}
else
{
  echo 
"No new Private Messagesn";
}


The comments are owned by the author. We aren't responsible for their content.
user

 making a new block


would this also work for anything? i have a couple sections that won't work well in news or sections and would like to have a couple more blocks/modules(?) to set up ... i'm a noob when it comes to this ... just do html *sighs* .. thanks!

 
user

 Re: making a new block


I will simply say - WOW !!!

 
user

 using inbox waring global


In addition to this nice feature, the following is something I came across on the forum:

Quote:


<{php}>
GLOBAL $xoopsUser;
$pm_handler =& xoops_gethandler('privmessage');
$uid = $xoopsUser->getVar('uid');
$criteria = new CriteriaCompo(new Criteria('read_msg', 0));
$criteria->add(new Criteria('to_userid', $uid));
$msgcount = $pm_handler->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('msgcount', $msgcount);
<{/php}>


This will allow you to use the following anywhere in your theme:

Quote:

<{if $msgcount > 0}>
<a class="highlight" href="<{$xoops_url}>/viewpmsg.php">Inbox (<span style="color:#ff0000; font-weight: bold;"><{$msgcount}></span>)</a>
<{else}>
<a href="<{$xoops_url}>/viewpmsg.php">Inbox</a>
<{/if}>


This way you’ll see just ‘Inbox’ when there are no messages and ‘Inbox (3)’ when you have, for example, 3 messages.

 
user

 Re: using inbox waring global


Also, you will need to wrap the PHP with the ifuser statement, otherwise non logged in users will have problems with the page not being rendered.

Quote:


<{if $xoops_isuser}>
<{php}>
GLOBAL $xoopsUser;
$pm_handler =& xoops_gethandler('privmessage');
$uid = $xoopsUser->getVar('uid');
$criteria = new CriteriaCompo(new Criteria('read_msg', 0));
$criteria->add(new Criteria('to_userid', $uid));
$msgcount = $pm_handler->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('msgcount', $msgcount);
<{/php}>
<{/if}>

 
user

 Re: using inbox waring global


This doesnt work for me...

It displays the "Inbox" fine but doesn't pick up there is new messages.

I tried just

<a class="highlight" href="<{$xoops_url}>/viewpmsg.php">Inbox (<span style="color:#ff0000; font-weight: bold;"><{$msgcount}></span>)</a>

and it showed "Inbox (0)" even though i had one...?


Edit: wait im using the ipb module it edits core files... ah now what?!

 
user

 Re: Inbox messages display in 2RC2


Upgraded to 2RC2 and lost my inbox new messages display. In system_block_user.html, I re-added this code so that "inbox" would show in the user menu:

Quote:

<table cellspacing="0">

<tr>

<td id="usermenu">

<a class="menuTop" href="<{$xoops_url}>/user.php"><{$block.lang_youraccount}></a>

<a href="<{$xoops_url}>/edituser.php"><{$block.lang_editaccount}></a>

<a href="<{$xoops_url}>/notifications.php"><{$block.lang_notifications}></a>

<a href="<{$xoops_url}>/user.php?op=logout"><{$block.lang_logout}></a>

<{if $block.new_messages > 0}>

<a class="highlight" href="<{$xoops_url}>/viewpmsg.php"><{$block.lang_inbox}> (<span style="color:#ff0000; font-weight: bold;"><{$block.new_messages}></span>)</a>

<{else}>

<a href="<{$xoops_url}>/viewpmsg.php"><{$block.lang_inbox}></a>

<{/if}>

<{if $xoops_isadmin}>

<a href="<{$xoops_url}>/admin.php"><{$block.lang_adminmenu}></a>

<{/if}>

</td>

</tr>

</table>


And the 2.0.10 system_blocks.php, used to use:

Quote:
function b_system_user_show()

{

global $xoopsUser;

if (is_object($xoopsUser)) {

$pm_handler =& xoops_gethandler('privmessage');

$block = array();

$block['lang_youraccount'] = _MB_SYSTEM_VACNT;

$block['lang_editaccount'] = _MB_SYSTEM_EACNT;

$block['lang_notifications'] = _MB_SYSTEM_NOTIF;

$block['uid'] = $xoopsUser->getVar('uid');

$block['lang_logout'] = _MB_SYSTEM_LOUT;

$criteria = new CriteriaCompo(new Criteria('read_msg', 0));

$criteria->add(new Criteria('to_userid', $xoopsUser->getVar('uid')));

$block['new_messages'] = $pm_handler->getCount($criteria);

$block['lang_inbox'] = _MB_SYSTEM_INBOX;

$block['lang_adminmenu'] = _MB_SYSTEM_ADMENU;

return $block;

}

return false;


but now this doesn't work and results in fatal call to non-object.

Has anyone modified this yet?

Thanks.

 
user

 Re: using inbox waring global


have the same problem, i'm using ipb and i just want to show the new messages in the header, so i can hide de User Menu block

 
user

 Re: using inbox waring global


I have tried your code for the themes but all I get is INBOX without the message count eventhough I have messages. Is there a newer code if I am using XOOPS 2.2.3

Also What is the first above code for and where do I put it?

Thanks

 
user

 need help with private messages core...!!!


hi...the code shown here results very interesting for me...

i'm trying to send private messages from a XML workflow specification for the XOOPS workflow module (xflow), but i don't know how to write the code to do this....i'm a quite new with the XOOPS core...is there some guidelines you can provide me?

this messages represent the notifications in a request tracking system i want to implement using the workflow module

Thanks ...Mario Castro

 


Login

Who's Online

191 user(s) are online (3 user(s) are browsing XOOPS FAQ)


Members: 0


Guests: 191


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Did you know ?

There is a flash tutorial explaining exactly how to add some first content to your new site!

Random question

How can I find out how my theme style sheet works