1
dargosch
Include the inbox of a user in a theme?
  • 2006/7/12 7:07

  • dargosch

  • Friend of XOOPS

  • Posts: 118

  • Since: 2004/12/21


Hi,

Is there a way to display the number of messages available to a logged in user in the theme?

/Fredrik
My Gentoo + PVR-350 + IVTV + MythTV blog is on
http://gentoomythtv.blogspot.com/

2
xuser
Re: Include the inbox of a user in a theme?
  • 2006/7/12 7:45

  • xuser

  • Just popping in

  • Posts: 73

  • Since: 2002/11/26


if u use the most recently version 2.0.14, its very simple

just insert such code into your theme.html or elsewhere u want put

inboxcount: <{xoInboxCount}>


if other versions , u should check the template: system_block_user.html and the function : b_system_user_show in the system_blocks.php

3
khuhner
Re: Include the inbox of a user in a theme?
  • 2006/8/3 22:35

  • khuhner

  • Quite a regular

  • Posts: 232

  • Since: 2006/1/6 3


Thanks for the code. I would like the same thing but am running XOOPS 2.0.13.2. I just deployed into production and not ready to go to 2.0.14.

I tried the following code in a custom block that I use as my home page:

$criteria = new CriteriaCompo(new Criteria('read_msg'0));
$criteria->add(new Criteria('to_userid'$xoopsUser->getVar('uid')));
$mc $pm_handler->getCount($criteria);

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


I got bits of the code from other places. It was a long shot.

Any ideas on how to get the inbox count in 2.0.13.2 in a custom block?

Kurt

4
snow77
Re: Include the inbox of a user in a theme?
  • 2006/8/3 22:44

  • snow77

  • Just can't stay away

  • Posts: 864

  • Since: 2003/7/23


this is an example of an html column I have for the Inbox with count included:

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}><{if $msgcount > 0}>
Inbox (<{$msgcount}>)
<{else}>
Inbox
<{/if}>

5
khuhner
Re: Include the inbox of a user in a theme?
  • 2006/8/3 22:56

  • khuhner

  • Quite a regular

  • Posts: 232

  • Since: 2006/1/6 3


Quote:

snow77 wrote:
this is an example of an html column I have for the Inbox with count included:


Thanks so much for your code. I tried the code in a new custom block (both and HTML and PHP) and I didnt have much luck.

The HTML version didnt seem to evaluate the code. It just renders the code as text.

Suggestions?

6
snow77
Re: Include the inbox of a user in a theme?
  • 2006/8/3 23:31

  • snow77

  • Just can't stay away

  • Posts: 864

  • Since: 2003/7/23


I don't know if it can work as custom blocks, cause they don't accept smarties and I don't know from what I posted which can be smarty and wich pure php.

In the html of a theme it will work.

If you still have problems if you post a link to the page where the problem is happening it could be easier to help you.

7
khuhner
Re: Include the inbox of a user in a theme?
  • 2006/8/4 0:05

  • khuhner

  • Quite a regular

  • Posts: 232

  • Since: 2006/1/6 3


Snow77,

Thanks. I was putting it into a bloack; after putting it in my theme, it worked perfectly!

Thanks again,
Kurt

Login

Who's Online

424 user(s) are online (296 user(s) are browsing Support Forums)


Members: 0


Guests: 424


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!

Latest GitHub Commits