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 
"/viewpmsg.php" title="Read your new Private Messages">Private Messages ($pm)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}>
Inbox (<{$msgcount}>)
<{else}>
Inbox
<{/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

Inbox (<{$msgcount}>)

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:



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

491 user(s) are online (2 user(s) are browsing XOOPS FAQ)


Members: 0


Guests: 491


more...

Donat-O-Meter

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

Did you know ?

you can use 'cronjob' in CPanel to complete backups of your database.

Random question

I using the theme phpkaox, but after upgrading XOOPS Core, the menus displayed horizontally instead of vertically