1
Cavan
PM Hacks...
  • 2005/5/11 15:02

  • Cavan

  • Friend of XOOPS

  • Posts: 218

  • Since: 2004/11/28


I'm looking for help with two specific hacks I could really use for the PM feature in XOOPS:

1. Notify (by pop-up or possibly text output) users of new pms after they log in.

2. Ability to send pms to multiple users, or all users.

Is anyone using these hacks? Are they even available? I've seen the thread on the "Wani PM Hack" but this is a bit much for our site and isn't quite what we need...Can someone point me in the right direction here?

2
Cavan
Re: PM Hacks...
  • 2005/6/3 20:29

  • Cavan

  • Friend of XOOPS

  • Posts: 218

  • Since: 2004/11/28


Well, I suppose I'll ask again: The Wani PM Hack isn't what I'm looking for but rather two minor improvements on the XOOPS PM function.

1. I'd like to be able to send private messages to ALL users, but only allow myself the ability to do this (using <{if $xoops_isadmin}> somewhere in the right file).

2. I can live without a pop-up notification, but how do I allow notification of new pms for users?

Is there anyone using XOOPS with either of these functions on their site?

3
gtop00
Re: PM Hacks...
  • 2005/6/3 22:45

  • gtop00

  • Friend of XOOPS

  • Posts: 498

  • Since: 2004/11/13


Cavan,

(2.)If I understood well what you want, you can do it any time as administrator. look at the documentation

The notification for PMs, as far as I know, is always on.

Is that u want?

4
Cavan
Re: PM Hacks...
  • 2005/6/4 5:05

  • Cavan

  • Friend of XOOPS

  • Posts: 218

  • Since: 2004/11/28


gtop00:

To clarify, I'm aware that I can do this from the admin backend. But what about users who want notifications as pms and not emails? What I meant is being able to do this from the PM itself, in the dropdown box with the users' names.

As for notification, I meant when a user logs in to the site, a text message (or whatever) is displayed showing that they have a new private message. Is there a way to do either of these in Xoops?

5
ladon
Re: PM Hacks...
  • 2005/6/4 8:20

  • ladon

  • Quite a regular

  • Posts: 284

  • Since: 2003/10/31


Look here. The FAQ shows you how to put it in a block. But if you don't want to use a block, look at the comments and see:

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}>


I've set the above in between <{if $xoops_isuser}> <{/if}> otherwise I got a blank page when visiting my site anonymously.

This will allow you to use the following html 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}>


I use this in my main theme.html. Emty everything between 'else if' as I did and it only shows anything when there is a PM (or more).

edit: look here for a pop-up when recieving a pm. Didn't get this to work on my site though, maybe you will.

6
Cavan
Re: PM Hacks...
  • 2005/6/4 17:16

  • Cavan

  • Friend of XOOPS

  • Posts: 218

  • Since: 2004/11/28


ladon:

Thank you for the information...

Quote:

ladon wrote:
...The FAQ shows you how to put it in a block. But if you don't want to use a block, look at the comments and see:

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}>


I've set the above in between <{if $xoops_isuser}> <{/if}> otherwise I got a blank page when visiting my site anonymously.


I don't want to use a block because it will interfere with the center block on my home page. This is exactly what I'm looking for, but where should I put this code, and in which file? Does it go in the index.php?

Edit: Just realized that I'm not sure how to add this to my particular theme.html because my main and user menus are different (using html) than typical XOOPS sites. Below is the code from my theme.html for the Inbox:

<a href"<{$xoops_url}>/viewpmsg.php" onMouseOver"if (document.images) document.icon_mini_message.src= 
'<
{$xoops_url}>/themes/phpbbstyle/images/icon_mini_message2.gif';" onMouseOut"if (document.images) 
document.icon_mini_message.src= '<
{$xoops_url}>/themes/phpbbstyle/images/icon_mini_message.gif';">
<
img src"<{$xoops_url}>/themes/phpbbstyle/images/icon_mini_message.gif" width=12 height=13 
alt
="Inbox" name="icon_mini_message" border=0>&nbsp;Inbox</a>&nbsp;


Is this correct?
<{if $msgcount 0}>
<
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" onMouseOver"if (document.images) document.icon_mini_message.src= 
'<
{$xoops_url}>/themes/phpbbstyle/images/icon_mini_message2.gif';" onMouseOut"if (document.images) 
document.icon_mini_message.src= '<
{$xoops_url}>/themes/phpbbstyle/images/icon_mini_message.gif';">
<
img src"<{$xoops_url}>/themes/phpbbstyle/images/icon_mini_message.gif" width=12 height=13 
alt
="Inbox" name="icon_mini_message" border=0>&nbsp;Inbox</a>&nbsp;<{/if}>

7
ladon
Re: PM Hacks...
  • 2005/6/5 12:42

  • ladon

  • Quite a regular

  • Posts: 284

  • Since: 2003/10/31


I think this is the best way. You didn't account for the design whithin de if/else (non or > 0 where in different styles)

Include the phpblock on top of your theme.html, use the code below anywhere in in your theme.

<{if $msgcount 0}>

<
a href"<{$xoops_url}>/viewpmsg.php" onMouseOver"if (document.images) document.icon_mini_message.src='<{$xoops_url}>/themes/phpbbstyle/images/icon_mini_message2.gif';" onMouseOut"if (document.images) document.icon_mini_message.src= '<{$xoops_url}>/themes/phpbbstyle/images/icon_mini_message.gif';">
<
img src"<{$xoops_url}>/themes/phpbbstyle/images/icon_mini_message.gif" width=12 height=13 alt="Inbox" name="icon_mini_message" border=0>&nbsp;Inbox</a>&nbsp;(<span style="color:#ff0000; font-weight: bold;"><{$msgcount}></span>)

<{else}>

<
a href"<{$xoops_url}>/viewpmsg.php" onMouseOver"if (document.images) document.icon_mini_message.src='<{$xoops_url}>/themes/phpbbstyle/images/icon_mini_message2.gif';" onMouseOut"if (document.images) document.icon_mini_message.src= '<{$xoops_url}>/themes/phpbbstyle/images/icon_mini_message.gif';">
<
img src"<{$xoops_url}>/themes/phpbbstyle/images/icon_mini_message.gif" width=12 height=13 alt="Inbox" name="icon_mini_message" border=0>&nbsp;Inbox</a>&nbsp;

<{/if}>

8
Cavan
Re: PM Hacks...
  • 2005/6/5 15:10

  • Cavan

  • Friend of XOOPS

  • Posts: 218

  • Since: 2004/11/28


ladon:

Thank you, but I'm not sure what you meant by "include the phpblock on top of your theme.html"...

<{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}>

Where do I put this?

9
menochi
Re: PM Hacks...
  • 2005/6/5 15:24

  • menochi

  • Friend of XOOPS

  • Posts: 259

  • Since: 2003/12/28



10
ladon
Re: PM Hacks...
  • 2005/6/5 16:00

  • ladon

  • Quite a regular

  • Posts: 284

  • Since: 2003/10/31


Quote:

Cavan wrote:
ladon:

Thank you, but I'm not sure what you meant by "include the phpblock on top of your theme.html"...

<{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}>

Where do I put this?


Ehm, open theme.html located in the theme dir and add that code before everything else in there. Don't know how else to put it

Login

Who's Online

181 user(s) are online (137 user(s) are browsing Support Forums)


Members: 0


Guests: 181


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!

Latest GitHub Commits