1
wildo
PM module: MessageBox (or sound) on new PM?
  • 2005/8/14 15:03

  • wildo

  • Just popping in

  • Posts: 33

  • Since: 2004/3/1 1


I would like to show a messageBox to users when they receive new PM's. Is this possible in XOOPS 2.2, if so, how?

I've seen a hack which could do this for earlier Xoopsversions ...
...

2
Zarei
Re: PM module: MessageBox (or sound) on new PM?
  • 2005/8/14 18:04

  • Zarei

  • Just popping in

  • Posts: 13

  • Since: 2005/5/26


I did this in my header.php then you can check the smarty variable HaveMsg in your themefiles.

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)
    {
    
$xoopsTpl->assign("MsgCount",$pm);
     
$xoopsTpl->assign("HaveMsg"1);
    }
  else
    {
    
$xoopsTpl->assign("HaveMsg"0);
    }
}

3
wildo
Re: PM module: MessageBox (or sound) on new PM?
  • 2005/8/14 19:39

  • wildo

  • Just popping in

  • Posts: 33

  • Since: 2004/3/1 1


Hi Zarei,

I'm not a XOOPS of php expert... Could you give a more detailed example of how to use your code? How do I check the variable in my themefile?
...

4
Mithrandir
Re: PM module: MessageBox (or sound) on new PM?

We will improve on the PM module to contain this asked-for functionality and more in the future.

Until then, I assume that Zarei means putting something like this somewhere in your theme.html where you want it.

<{if $xoops_isuser && $HaveMsg == 1}>
    
Hello <{$xoops_uname}>, you have <{$MsgCount}> messages in your <a href="<{$xoops_url}>/modules/pm/viewpmsg.php" title="Inbox">Inboxa>
<{/if}>
"When you can flatten entire cities at a whim, a tendency towards quiet reflection and seeing-things-from-the-other-fellow's-point-of-view is seldom necessary."

Cusix Software

5
wildo
Re: PM module: MessageBox (or sound) on new PM?
  • 2005/8/14 20:55

  • wildo

  • Just popping in

  • Posts: 33

  • Since: 2004/3/1 1


Thank you. This works great and is for sure a good option, but what I really meant was a windows MessageBox, which will show when there are new messages in the Inbox.
User has to press OK to continue, and will be redirected to his Inbox.

I've seen this hack for earlier versions ...
...

6
Mithrandir
Re: PM module: MessageBox (or sound) on new PM?

Could probably be done with some javascript.

<{if $xoops_isuser && $HaveMsg == 1}>
    <
script type="text/javascript">
        if (
confirm("Hello <{$xoops_uname}>, you have <{$MsgCount}> messages in your Inbox, do you want to go to the Inbox?") ) {
             
location.href="<{$xoops_url}>/modules/pm/viewpmsg.php";
        }
    script>
<{/if}>

(not at all certain that this will work - I'm no javascript wizard)
"When you can flatten entire cities at a whim, a tendency towards quiet reflection and seeing-things-from-the-other-fellow's-point-of-view is seldom necessary."

Cusix Software

7
Zarei
Re: PM module: MessageBox (or sound) on new PM?
  • 2005/8/14 21:19

  • Zarei

  • Just popping in

  • Posts: 13

  • Since: 2005/5/26


Sorry, should have been more clear.

(a bit ot)

If you're adding this mithrandir are you also adding admincontrol over the navbar menu (adding new menus/menuitems)? I was thinking of releasing my hack as a module but if you're doing it I won't bother.

8
Mithrandir
Re: PM module: MessageBox (or sound) on new PM?

I have some ideas for the navbar, but since that is a theme-specific element, I don't see how it could be implemented in the core.

One could perhaps set e.g. the center-left blocks to be in the navbar and just assume that they would use the same structure as the navbar expects (through some custom templates for the blocks placed in the center-left block area)

In the PM module, we will probably add some blocks with this kind of information (hi {uname} you have {x} messages in your inbox) and other stuff/stats...
"When you can flatten entire cities at a whim, a tendency towards quiet reflection and seeing-things-from-the-other-fellow's-point-of-view is seldom necessary."

Cusix Software

9
ChronicTom
Re: PM module: MessageBox (or sound) on new PM?
  • 2011/3/27 15:23

  • ChronicTom

  • Just popping in

  • Posts: 2

  • Since: 2011/3/27


I realize this is old and all, but in following it, it only shows the notification when I go to my inbox, not across the whole site...

anyone know why?

[EDIT] forget it, it was the location that I pasted the code into the header.php

Putting it right before // Sets cache time

works


Login

Who's Online

343 user(s) are online (275 user(s) are browsing Support Forums)


Members: 0


Guests: 343


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