PM Template Tags
The following template tags are used to output Private Messaging information.
Unread PMs
This template tag will display (or return) the number of unread PMs in the current users PM inbox. A link to the users PM inbox can also be displayed.
The default text is “You have # PM(s) in your inbox.”. The word ‘inbox’ will be a hyperlink to the users PM inbox. If the user is a guest or does not have PM privileges, the default text is “You do not have PM privileges”. The default text for users with no PM privileges can be suppressed when using the default text.
If the PM data is returned instead of displayed, it will be in an array with keys of ‘count’ and ‘url’. A count of -1 will indicate no PM permissions.
sf_pm_tag($display=true, $usersonly=false)
Possible arguments to the template tag are:
| Parameter | Description | Type | Default |
|---|---|---|---|
| $display | Display the PM count with default text (returns the data if false). | Boolean | true |
| $usersonly | Display privilege message to user/guests without PM permissions. | Boolean | false |
User specified styles available for template tag output are:
| Styles | Affected Output |
|---|---|
| p.sfpmcount | Styles the <p> element that wraps the pm inbox info. |
An example usage of the template tag is:
<?php sf_pm_tag(true, false); ?>
Send PM Link
This template tag will display a link to allow users to send a PM to a registered user with PM permissions. This template tag is normally displayed on non forum pages.
The template tag will display a default string of ‘Send PM’ unless an alternate text string is passed to the template tag. If you choose to pass the text string to the template tag, be sure to include a **%**% somewhere in the text string to indicate where you want the link placed.
sf_sendpm_tag($userid, $text='')
Possible arguments to the template tag are:
| Parameter | Description | Type | Default |
|---|---|---|---|
| $userid | WordPress user ID of the user to send a PM to. | Integer | - |
| $text | Alternate text message to display. | String | - |
An example usage of the template tag is:
<?php $text = '<a href="%%" title="Send PM">Send PM</a>'; sf_sendpm_tag(32, $text); ?>
