Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
How to display number of unread private messages
Avatar
Derek Tenbusch
Member
Free Members
sp_UserOfflineSmall Offline
Sep 2, 2015 - 11:21 am

Hi,

I've been reading through the codex and forum but haven't found this solution.  

After upgrading to the latest version I cannot figure out how to show how many unread private messages a user has.  

In the old version I was able to do this with this code.  Is there a way to do it now?

<li>

<?php

                               $pm = sf_pm_tag(false, true);

                               if ($pm['count'] > -1) {

                                   if ($pm['count'] > 0) $pmLink = '<b><a href="' . $pm['url'] . '">Inbox (' . $pm['count'] . ')</a></b>';

                                   else $pmLink = '<a href="' . $pm['url'] . '">Inbox (' . $pm['count'] . ')</a>';                                }

                    print $pmLink;

?>

</li>

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Sep 2, 2015 - 1:03 pm

The template tags for PMs are documented here: https://simple-press.com/docum.....e-plugins/ - it might just be a name change bit am not sure. I literally have to go bit will be back in an hour or so and if you have not found it I will look myself to work out which it is.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Derek Tenbusch
Member
Free Members
sp_UserOfflineSmall Offline
Sep 2, 2015 - 4:19 pm

I found the files in the plugin folder that should do this

The page sp-pm-inbox-tag.php seems to have the function but I am not having success calling it as a template tag.  Is my syntax off?

 

Here's what the page says:

 

* =====================================================================================
sp_pm_do_inbox($display)

template tag to display number of new PMs in the current user inbox. This tag includes
default text that is output with the pm count data and inbox hyperlink. This text can
be supressed by setting $display to false. If supressed, the new PM count and hyperlink
are returned to the call in an array. A -1 count and empty url will be returned for
guests or user that do not have PM permissions. Additionally, if the default text is used,
the no permissions for pm default text can be supressed or those without permissions.

parameters:

$display Determines whether to display pm count plus informational text
$usersonly If $display is true, only display pm text for users with pm permissions
===================================================================================*/

 

When I drop sp_pm_do_inbox() in it breaks the page.  Any suggestions?

 

Thanks!

Diego

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Sep 2, 2015 - 4:39 pm

No you can't call it like that. As documented in the codex page I linked you to the actual call is just:

sp_pm_inbox();

which should do the trick.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Derek Tenbusch
Member
Free Members
sp_UserOfflineSmall Offline
Sep 2, 2015 - 5:34 pm

yeah i plugged that in but the extra text it adds breaks the area.  Can you pass parameters to this tag to not include text?

break.jpgImage Enlarger

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 2, 2015 - 10:23 pm

if you dont want the canned display, your option is to pass the argument to it to not display.. instead if will return the data to you and you can do what you want with it...  so:

$pm = sp_pm_do_inbox(false);

then you will get an array returned to you where you have $pm['count'] and $pm['url']... the former is the inbox count and the latter is the url to the inbox...

just output whatever you want...

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626