1
Watdehek
Display number of new pm's in welcome message
  • 2005/2/21 21:24

  • Watdehek

  • Friend of XOOPS

  • Posts: 130

  • Since: 2005/2/21


I have managed to display a welcome message, but I also want to display the number of unread PM's in that message. Is there a way to achieve this?

2
jdseymour
Re: Display number of new pm's in welcome message

Not that I know of. The inbox button on the user menu does that.

3
Bassman
Re: Display number of new pm's in welcome message
  • 2005/2/21 23:35

  • Bassman

  • Friend of XOOPS

  • Posts: 1272

  • Since: 2003/5/23


If you look at the template for the user menu, the following is the code that tests to see if there is a message in your inbox and dispays the number of messages if there is:
Quote:

<{if $block.new_messages > 0}>
<{$block.lang_inbox}> (<{$block.new_messages}>)
<{else}>
<{$block.lang_inbox}>
<{/if}>\


I'm sure you could use that code in your message to the same effect, with some modification.

4
Bassman
Re: Display number of new pm's in welcome message
  • 2005/2/21 23:41

  • Bassman

  • Friend of XOOPS

  • Posts: 1272

  • Since: 2003/5/23


If you wanted to add it to your theme, you could have:
Quote:


<{if $xoops_isuser}>
Welcome, <{$xoops_uname}> to <{$xoops_sitename}> you have <{$block.new_messages}> new messages.
<{else}>
Become a member of <{$xoops_sitename}>, now!
<{/if}>



I haven't tested this, but it should work.

5
brash
Re: Display number of new pm
  • 2005/2/22 1:08

  • brash

  • Friend of XOOPS

  • Posts: 2206

  • Since: 2003/4/10


Not sure if that will work, as I *think* the <{$block.new_messages}> smarty is used only for the user menu. Probably wrong though, might go and see before opening my mouth......

6
JasonMR
Re: Display number of new pm
  • 2005/2/22 1:22

  • JasonMR

  • Just can't stay away

  • Posts: 655

  • Since: 2004/6/21


I agree with brash.

I once ran into a similar issue. The problem is, the smarty variable needs to be assigned a value, which is usally done by a php-script.

With the user menu, this is done by the system module.

Meaning, you would have to write a little php code, that queries the DB, or somehow add what you want to do, as block of the system module (e.g. change one of the system blocks, to display what you want).

Someone correct me...please

@brash: I believe we think too much , if ya catch my drift

7
brash
Re: Display number of new pm
  • 2005/2/22 2:10

  • brash

  • Friend of XOOPS

  • Posts: 2206

  • Since: 2003/4/10


Ok, this is bugging me now . How on earth can you reuse a smarty tag like this. I know that new_messages is defined in the b_system_user_show function in modules/system/blocks/system_blocks.php, I just don't know how to get the new_messages value. It's driving me nuts coz I've done it before with the MySQL counter I made, just can't for the life of me remember how.

8
Bassman
Re: Display number of new pm
  • 2005/2/22 4:14

  • Bassman

  • Friend of XOOPS

  • Posts: 1272

  • Since: 2003/5/23


I tried what i posted above, and it doesn't work :( i'm sure there's a way to do it though.

9
jdseymour
Re: Display number of new pm

I am no php programmer, but wouldn't you have to include the PHP files that define the variables and then save the block as a PHP script?

10
brash
Re: Display number of new pm
  • 2005/2/22 4:42

  • brash

  • Friend of XOOPS

  • Posts: 2206

  • Since: 2003/4/10


Haven't had a chance to look at this in any detail today, but I am pretty sure it is only a matter of a handful of lines of code and your done. I'll try and have a look again tonight, as this would be handy.

Login

Who's Online

254 user(s) are online (150 user(s) are browsing Support Forums)


Members: 0


Guests: 254


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