Simple:Press Documentation

Plugin: Mentions

Plugin Description –

This Simple:Press plugin is for adding and detecting Twitter style @name mentions and notifying the mentioned user by a forum notice or Email or Private Message.

Note:
If the notification is to be by Private Message, the Simple:Press Plugin: Private Messaging must be installed, activated, and set up.If the notification is to be by email, the Simple:Press Plugin: HTML Emails must be installed, activated, and set up.In order for the autocomplete feature to provide the drop down menu of forum members available to mention, the Simple:Press Plugin: TinyMCE Editor must be installed, activated, set up, and selected for use when posting.

Please see Using Plugins on how to obtain and install these plugins.

Plugin Overview

  • Allows users to mention (or tag) other users in a post and have them notified.
    • Provides a drop down menu of forum members who can be mentioned if the necessary Simple:Press plugin in active and selected for posting.
    • Provides for mentioned users to be notified via a forum notice, or if the necessary Simple:Press plugins are active by email or private message.
  • Allows users to “opt out” of receiving the “mention” notifications.
  • Includes two (2) template tags the forum Admin can add to a Child or Custom theme to display lists of posts by forum users mentioning other forum users and links to the posts in which they are mentioned.

Plugin Features

Installing this Simple:Press plugin adds:

  • A new “Mentions” section in the “Available Plugins – Install Simple:Press Plugins” panel under the forum Admin menu path Forum > Plugins > Available Plugins. From this panel the plugin can be activated, or deleted by the Admin.
  • When properly installed, a new folder in the “forum-plugin” folder named “mentions” containing the plugin’s files.

Activating this plugin provides:

  • A change to the new “Mentions” section in the “Available Plugins – Install Simple:Press Plugins” panel under the Admin menu path Forum > Plugins > Available Plugins so the Simple:Press plugin can be deactivated, uninstalled, or have its Options set up.
    • The Options link goes to the existing “Options – Member Settings” forum Admin panel with the new “Mentions” section where the “Mentions” plugin options can be set.
    • The “Getting Started” link associated with the “Deactivate/Uninstall/Options” selections should be selected to view the pertinent information regarding the plugin.
  • A new “Mentions” section in the existing “Options – Member Settings” forum Admin panel where the plugin’s options can be set .
    • The type of notification a mentioned user will receive can be set.
    • The number of recent mentions to remember for later display via the ‘latest mentions’ template tag can be set.
    • The “Options – Member Settings” forum Admin panel can be accessed from the Forum Admin menu at:
      • Forum > Options > Member Settings
      • Forum > Plugins > Available Plugins > Mentions > Options
  • A new “Opt out of receiving Mentions notifications;” check box on the “Edit Global Options” panel in forum users’ profiles where users can elect to not receive Mention notifications.
    • The “Edit Global Options” panel can be access from the forum page “Profile” button, then “Options” tab, and finally “Edit Global Options” sub-tab.
  • A ‘mention notification message’ in the header of the forum page displayed to logged-in users that have been mentioned if the forum Admin selected that notification method.
  • A ‘mention notification’ e-mail sent to mentioned users if the forum Admin selected that notification method AND the Simple:Press Plugin: HTML Emails is installed, activated, and set up.
  • A ‘mention notification’ private message sent to the mentioned users if the forum Admin selected that notification method AND the Simple:Press Plugin: Private Messaging is installed, activated, and set up.
  • An autocomplete feature in posts providing a drop down menu of forum members who can be mentioned after the post author types the “@” symbol into the post IF the Simple:Press Plugin: TinyMCE Editor is installed, activated, set up, and has been selected for use when posting.

There are no new permissions added to the permission sets due to this plugin.

Plugin Requirements

The Simple:Press Plugin: Private Messaging must be installed, activated, and set up before this plugin’s “Private Message” notifications can operate correctly.

The Simple:Press Plugin: HTML Emails must be installed, activated, and set up before this plugin’s “Email” notifications can operate correctly.

The Simple:Press Plugin: TinyMCE Editor must be installed, activated, set up, and selected for use on posts before this plugin’s autocomplete feature for displaying forum users who can be mentioned can operate correctly.

Requires Simple:Press version 5.6.2 and above.

This plugin must be installed, activated, and its options set before it is operational.

As part of the installation, a “Mentions” section is added to the Plugin Management panel under the admin menu Forum > Plugins > Available Plugins. From this panel the plugin can be activated, deactivated, uninstalled, deleted, or its options set using its “Activate/Delete” and “Deactivate/Uninstall/Options” selections.

  • The Options link goes to the “Options – Global Settings” forum Admin panel with the new “Mentions” section.

There are no new permissions added to the permission sets due to this plugin that must be enabled.

The plugin has two (2) template tags, ‘sp_MentionsLatestTag()’, and ‘sp_MentionsYourLatestTag()’ neither of which is incorporated into standard supplied Simple:Press themes.

  • If the template tags are not to be added to Simple:Press themes, nothing need be done.
  • If one or more of the template tags are to be incorporated, it is recommended that a Child or Custom theme is created first to accept the changes prior to installing this plugin rather than modifying a standard supplied Simple:Press theme.
  • In all cases the template tag should be called conditionally, if (function_exists(‘ ‘)) so that if the plugin is deactivated or does not exist, the website will continue to operate.

Plugin Installation and Activation

Please see Using Plugins on how to obtain and install the Simple:Press

The setup for each plugin is contained on its Simple:Press Codex page.

Please see Using Plugins on how to obtain and install this Simple:Press plugin.

  • Whatever method is used to add the Simple:Press plugin, the folder that should have been added to the forum plugin folder is named “mentions“.
  • If using the “Simple:Press Upload Plugin – Upload a Simple:Press Plugin” panel at the forum Admin menu Forum > Plugins > Plugin Uploader, the folder to browse for after downloading it from the Simple:Press site is “mentions.zip” before clicking the “Upload Now” button.

As mentioned there the default location for Simple:Press plugin folders is …/wp-content/sp-resources/forum-plugins. If this path is changed, it is important to note that the plugin’s folder and its content need to reside in the forum plugins folder wherever it has been moved and however it has been renamed. See Storage Locations for more information.

Activation is accomplished from the Admin Dashboard panel menu by selecting Forum > Plugins > Available Plugins from the drop down forum Admin menu. On the “Available Plugins – Install Simple:Press Plugins” panel select the Mentions plugin and click on “Activate”. The “Activate/Delete” label changes to “Deactivate/Uninstall/Options” with a “Getting Started” Link.

  • The “Getting Started” link associated with the “Deactivate/Uninstall/Options” selections should be selected to view the pertinent information regarding the plugin.

To deactivate the plugin, click on “Deactivate”. The “Deactivate/Uninstall/Options” label changes to “Activate/Delete”.
To re-activated the plugin, click on on “Activate”. The “Activate/Delete” label changes to “Deactivate/Uninstall/Options”.

Plugin Administrative Options

After activation, a) on the aforementioned “Available Plugins – Install Simple:Press Plugins” panel, click “Options” on the Mentions plugin section or b) under the Options entry on the forum menu on the left side forum admin page click the Members Settings sub-menu item to get the “Options – Member Settings” Admin panel with its new “Mentions” section.

    • Go to the “Mentions” section of the Admin panel.
      • Please click on the section’s “Help” link for more information on this section’s feature(s).
    • Mentions Notification Set Up

This feature allows setting up the notification options users can receive when they are “mentioned’ by other forum users. Select one of the options.

Note:
Users can elect to “opt out” of receiving “mention notifications” from their profiles as discussed in the “Plugin Usage” section of this Codex page.
Note:
Options are selected or deselected as follows in this section:

  • The check box is selected if it contains a green check mark.
  • Clicking a check box not containing a green check mark selects that option, puts a green check mark in that check box, deselects the previously selected check box, and removes the green check mark from the previously selected check box.
      • If there is not already a green check mark in the check box, click on the check box to the left of “None” to select this option to not send notifications to users when they are mentioned.
      • If there is not already a green check mark in the check box, click on the check box to the left of “Notification” to select this option to send notifications to users via the Simple:Press notification system that displays a notice to the user at the top of each forum page.
      • If there is not already a green check mark in the check box, click on the check box to the left of “Private Message (requires PM plugin)” to select this option to send Private Message notifications.
        • If this notification method is selected, the Simple:Press Plugin: Private Messaging must be installed, activated, and set up before the “Private Message” notifications can operate correctly.
      • If there is not already a green check mark in the check box, click on the check box to the left of “Email” to select this option to send notifications to users via e-mail.
        • If this notification method is selected, the Simple:Press Plugin: HTML Emails must be installed, activated, and set up before the “Email” notifications can operate correctly.
      • If there are no other options in the section or other sections to select, click on the “Update Members Options” button at the bottom of the panel to save the selection.
      • Otherwise, continue making selections.

 

    • Number of Recent Mentions to Remember

This feature specifies the number of recent mentions made on the site to keep for later use in the latest Mention template tag, ‘sp_MentionsLatestTag()’, if it is being incorporated into a Simple:Press Child or Custom themes by the forum Admin.

    • In the data input box to the right of “Number of recent mentions to remember/display (used in recent mentions template tags):”, enter the integer number of recent mentions to remember.
      • The default is “10”. The larger this number is, the more database space is needed to store the remembered mentions.
    • If there are no other options in the section or other sections to select, click on the “Update Members Options” button at the bottom of the panel to save the selection.
    • Otherwise, continue making selections.

If the autocomplete feature providing the drop down menu of forum members who can be mentioned is to be made available to post authors, see the Codex page for the Simple:Press Plugin: TinyMCE Editor for how the forum Admin and/or the forum user can select the editor for use on posts.

  • Selection of the editor as the default editor by the forum Admin is discussed in the “Plugin Administrative Options” section.
  • Selection of the editor by the post author regardless of the default editor selected is discussed in the “Plugin Usage” section.

To be complete for multilingual forums, the language translation files for this plugin should be installed or downloaded/properly placed in the appropriate forum-language folder for SP plugins using one of the procedures below in the “Plugin Language Translation” section of this page.

Plugin Language Translation

A plugin may not have language translation files, but in general each Simple:Press plugin has its own language translation files each with multiple pages for translating the forum plugin’s message strings.

Forum Plugin translation files are to reside in a unique forum folder location as defined by the “Simple:Press Plugin Language Files” entry on the “Integration – Storage Locations” forum Admin panel available through the forum Admin menu at Forum > Integration > Storage Locations.

  • The default location for forum plugin translation files is the folder “…/wp-content/sp-resources/forum-language/sp-plugins”.

Information regarding downloading language files, “mo’ language file placement, and translation (language localization) is found at Localization.

WARNING: On the Localization page, the Language Translation “.mo” Files Overview should be reviewed and well understood for naming convention and language translation file placement.

More information is available regarding translation files at Simple:Press Translations. which is the repository for Simple:Press language translation files. On the base page, select the “Getting Started Guide” link for basics about it’s use. On that page, select the “register a username here” link to obtain a password to the site. Use the “Contact Form” link to request the desired language if it is not currently available. The “Contact Form” link may also be used to volunteer to be a validator for a translation project.

This plugin’s available language translation files with translation statistics, and message translations can be viewed at Mentions within the repository for Simple:Press language translation files.

  • Installing this Simple:Press Plugin’s Language Translation “.mo” files
    The plugin’s language translations files for each language can be correctly located in two ways.

    • Using the Admin Word:Press “Site Language” and Simple:Press “Language Translation” Features
      WARNING: On the Localization codex page, the Language Translation “.mo” Files Overview should be reviewed and well understood for naming convention and language translation file placement.
        • Under the “Language Translation Selection Sequences” heading, the “Coordinated Language Translation File Download Using the Simple:Press ‘Language Translation’ Selection” section, follow the instructions at “Adding its Translation File(s) After Downloading/Activating a Simple:Press Theme or Simple:Press Plugin”.
          • Follow the instructions to select the “Site Language” and then get to the admin page with the “Integration – Language Translations” section where there should be an entry for “Mentions” along with an “Install” button.
          • Click on the “Install” button for this plugin to install the language translation file for the current “Site Language” language.
            • Note: If the message “No Translation Project Exists” is displayed rather than the “Install” button, a translation file for that language could not be found in GlotPress at this time. Consider posting in the Simple:Press forum if it is felt there needs to be one added.
          • Be sure to verify the locale (filename) for the “.mo” file matches the language code for the language as referenced in the “Warning” above. If it does not, change it to match.
          • As called out in the section, continue to change the “Site Language” language and repeat the process until all desired translation files for this plugin have been installed.

       

    • Manually Finding and Storing Simple:Press Plugin’s Language Translation ‘mo’ files
    • WARNING: On the Localization codex page, the Language Translation “.mo” Files Overview should be reviewed and well understood for naming convention and language translation file placement.
      • After reviewing the material discussed under the “Language Translation Selection Sequences” heading, the “Manual Installation of Simple:Press Language Translation Files section, follow the steps outlined at “Finding and Storing ANY Simple:Press Plugin’s Language Translation ‘mo’ files”.
      • Each time through the process at the step, “Scroll down the list and click on the name of the plugin whose language files are being sought to see the translation file Version Number available”, substitute “Mentions” for the phrase “the name of the plugin whose language files are being sought”.
      • Be sure to verify the locale (filename) for the “.mo” file matches the language code for the language as referenced in the “Warning” above. If it does not, change it to match.
      • Repeat the steps for each language it is desired to have a translation file (french, spanish, etc.) for the plugin on the website.

Plugin Usage

Forum Admins and forum user can tag or mention other forum users within posts.

Note:
If the autocomplete feature providing the drop down menu of forum members who can be mentioned is to be made available to post authors, see the Codex page for the Simple:Press Plugin: TinyMCE Editor for how the forum Admin and/or the forum user can select the editor for use on posts.

  • Selection of the editor as the default editor by the forum Admin is discussed in the “Plugin Administrative Options” section.
  • Selection of the editor by the post author regardless of the default editor selected is discussed in the “Plugin Usage” section.
  • Mentioning Another Forum User in a post
    • Click the “Add Topic” button or the “Add Reply” button to display the “Add Topic” post form or the “Add Reply” post form, respectively.
    • If the TinyMCE Editor IS NOT selected:
      • After beginning the post, “mention” another forum user by using the @ sign and their member name, (eg. @Steve Wiles).
    • If the TinyMCE Editor IS selected:
      • After beginning the post, “mention” another forum user by using the @ sign and their member name, (eg. @Steve Wiles).
        • Once the @ sign has been typed, a drop down menu of matched / possible members names will be displayed.
        • As letters of the member’s name are typed, the list of matched / possible members names is decreased.
      • From the drop down menu, select the correct member to be “mentioned” from the list.
    • After completing all other aspects of the post, click on the “Submit Topic” or “Submit Reply” to submit the post with a member mentioned.
      • The approved post displays the ‘@ member name’ (eg. @Steve Wiles) in red and underlined which is a link to the mentioned user’s profile.
      • The mentioned member receives the “mention notification” specified by the forum Admin, if the member has not “opted out” of receiving mention notification in their profile.

Forum Admins and forum user can “opt out” of receiving “mentions notifications” via a setting in their profile.

  • Logged-in User “Opting Out” of Receiving Mentions Notifications
    • In the forum page header, click the “Profile” button to display the logged-in user’s profile that can be edited.
    • Click on the “Options” tab to see the various ‘options’ sub-tabs.
    • Click on the “Edit Global Options” sub-tab to see the “Edit Global Options” panel.
    • To “Opt Out” of receiving Mentions notifications, click the check box to the right of “Opt out of receiving Mentions notifications” if there is not already a green check mark in the check box to select the check box.
      • The check box is selected if it contains a green check mark.
      • Clicking on a check box containing a green check mark, deselects the check box and removes the green check mark.
    • Click on the “Update Global Options” button at the bottom of the panel to save the selection.
      • The “opted out” forum user will no longer receive the Mentions notifications specified by the forum Admin.

Forum Admin and forum Users can remove the Simple:Press Mention Notification shown on the forum page header if that notification method is being used.

  • Deleting Simple:Press Mention Notification (if being used) from Forum Header
    • In the forum page header, look for the banner relating to “mentions”.
    • Click on the “(Remove Notice)” text at the end of the “mentions” notification.
      • The “mentions” notification is removed from the forum header.

Plugin Special Notes

The styling (CSS) of a plugin can be changed by copying the plugin’s ‘sp-mentions.css’ file to an active theme and editing it.

  • The plugin does NOT have to be reconfigured to use the copied/edited file.
  • It will automatically use the ‘sp-mentions.css’ copied to the theme’s folder.
Note:
It is strongly recommended that the plugin’s css file NOT be copied to a standard supplied Simple:Press theme, but to a Child or Custom theme.If the plugin’s css file is copied over to a standard supplied Simple:Press theme, it will be deleted and lost on any updates of that standard supplied theme.

  • Changing the Plugin Display CSS
    • The CSS for the Mentions Informational display is contained in the plugin’s “css” folder and is named ‘sp-mentions.css’.
      • The file is located within the plugin’s folder at > resources > css.
    • If one wishes to modify the plugin’s CSS for display, copy the plugin’s’sp-mentions.css’ file over to a Child or Custom theme’s folder and into theme’s “styles” folder.
    • Edit the copied over ‘sp-mentions.css’ file to incorporate the desired changes, and save the file.
    • Activate the uniquely named child theme on the site by clicking its “Activate Theme” button on the “Available Themes – Select Simple:Press Theme” forum Admin panel accessed from the forum Admin menu at Forum > Themes > Available Themes.

 

Template Tags Used in the Plugin

There are two (2) template tags available for this plugin that allow further customization of the plugin’s usage in themes or otherwise customize the website. Neither ‘sp_MentionsLatestTag()’ nor ‘sp_MentionsYourLatestTag()’ are incorporated into standard supplied Simple:Press themes.

  • If the template tags are NOT to be added to Simple:Press themes, nothing need be done.
  • If one or more of the template tags is to be incorporated, it is recommended that a Child or Custom theme is created first to accept the changes prior to installing this plugin rather than modifying a standard supplied Simple:Press theme.
  • In all cases the template tag should be called conditionally, if (function_exists(‘ ‘)) so that if the plugin is deactivated or does not exist, the website will continue to operate.

The Template Tag can be viewed by selecting its link below.

Action and Hooks Used in the Plugin

There are Actions and Hooks available in the Plugin’s Template Tag. The Template Tag’s Action and Hooks can be viewed by selecting its link below.

There are other Actions and Hooks available for this plugin to modify aspects of the plugin.
In file ‘sp-mentions-ahah.php‘:

  • apply_filters(‘sph_mentions_matches’, $spdb) – Allows modification of the $spdb parameters for the mentions plugin before they are output/returned.

In file ‘sp-mentions-components.php‘:

  • apply_filters(‘sph_mentions_notification_msg’, $who.’ ‘.__(‘mentioned you in the post’, ‘sp-mentions’), $newpost, $user->ID); – Allows modification of the message in a mentions notification when using the Simple:Press forum page notification before it is output/returned.
  • apply_filters(‘sph_mentions_pm_title’, __(‘You were mentioned in a post’, ‘sp-mentions’), $newpost, $user->ID) – Allows modification of the title of a mentions notification when using the Private Messaging system before it is output/returned.
  • apply_filters(‘sph_mentions_pm_message’, $who.’ ‘.__(‘mentioned you in the forum post’, ‘sp-mentions’).’: ‘.$newpost[‘url’], $newpost, $user->ID);) – Allows modification of the message in a mentions notification when using the Private Messaging system before it is output/returned.
  • apply_filters(‘sph_mentions_email_msg’, $msg, $newpost, $user->ID, $who) – Allows modification the message in a mentions notification when using e-mails before it is output/returned.
  • apply_filters(‘sph_mentions_email_replyto’, ”, $newpost, $user->ID) – Allows modification of the “reply to” portion of a mentions notification when using e-mails before it is output/returned.
  • apply_filters(‘sph_mentions_email_subject’, __(‘You were mentioned’, ‘sp-mentions’), $newpost, $user->ID, $who) – Allows modification of the subject line of the mentions notification when using e-mails before it is output/returned.
  • apply_filters(‘sph_ProfileUserMentionsOptOut’, $out) – Allows modification of the wording of the mentions “Opt Out” option in the profile of users before it is output/returned.

In file ‘sp-mentions-plugin.php‘:

  • apply_filters(‘sph_ProfileUserMentionsOptOutUpdate’, true) – Allows modification of the results of the user’s “opt out” of mention notification selection in the user’s profile before the results are acted upon.

Plugin and Template Tag Changelog

Since Simple:Press version 5.2.2.

Codex page template tags sync’d to code version 5.6.6 and plugin version 2.1.12.



Individual Template Tags


 

sp_MentionsLatestTag()

Description

sp_MentionsLatestTag() – This template displays the list of latest “Mentions” made in the forum.

Note:
The maximum number of the latest mentions displayed by this template tag is set by the value selected by the forum Admin in the “Mentions” section of the “Options – Member Settings” forum Admin panel accessed from the forum Admin menu at Forum > Options > Member Settings.

Usage

sp_MentionsLatestTag($args=”);

Arguments

$args – List of arguments for controlling display.
Type:
(string) (optional)
Default:
‘tagId’ => ‘spMentionsLatestTag’
‘tagClass’ => ‘spListTag’
‘listId’ => ‘spListItemTag%ID%’
‘listClass’ => ‘spListItemTag’
‘linkClass’ => ‘spLinkTag’
‘textClass’ => ‘spTextTag’
‘avatarClass’ => ‘spAvatarTag’
‘listTags’ => 1
‘itemOrder’ => ‘AMUTD’
‘linkScope’ => ‘forum’
‘beforeForum’ => __(‘Forum: ‘, ‘sp-mentions’)
‘afterForum’ => ‘<br />’
‘beforeTopic’ => __(‘Topic: ‘, ‘sp-mentions’)
‘afterTopic’ => ‘<br />’
‘beforeUser’ => ‘ ‘
‘afterUser’ => ‘<br />’
‘beforeMention’ => ”
‘afterMention’ => ‘ ‘.__(‘was mentioned by’, ‘sp-mentions’)
‘beforeDate’ => ”
‘afterDate’ => ”
‘avatarSize’ => 25
‘niceDate’ => 1
‘echo’ => 1

tagId‘: CSS ID for the Div.
tagClass‘: CSS Class for the Div.
listId‘: CSS ID for the list.
listClass‘: CSS Class for the list.
linkClass‘: CSS Class for the link.
textClass‘: CSS Class for the text.
avatarClass‘: CSS Class for the Avatar.
listTags‘: Flag to indicate whether to wrap the list in <ul> and <li> tags or use a div. A one (1) is true and the tags will be used. A zero (0) is false and a div will be used.
itemOrder‘: Controls which components are displayed and also the order in which they are displayed. Use the following codes to construct this parameter. No spaces or other characters can be used. Upper case (Capital) letters must be used.

    • F – Displays the forum name

 

    • T – Displays the topic name

 

    • A – Displays the mention’s author’s Avatar

 

    • U – Displays the mentions’s author’s display name

 

    • M – Displays the mentioned user’s display name

 

    D – Displays the date of the post

linkScope‘: Controls what items are made into links (‘a’ tags): This is entered as text.

Note:
The Topic will ALWAYS be formed as a link.

The following options are available:

    • forum – Display the Forum name as a link as well as the Topic.

 

    all – Make the entire entry a link to the Topic.

beforeForum‘: The text to display before the forum title.
afterForum‘: The text to display after the forum title.
beforeTopic‘: The text to display before the topic title.
afterTopic‘: The text to display after the topic title.
beforeUser‘: The text to display before the posting user’s name.
afterUser‘: The text to display after the posting user’s name.
beforeMention‘: The text to display before the mentioned user’s name.
afterMention‘: The text to display after the mentioned user’s name.
beforeDate‘: The text to display before the date.
afterDate‘: The text to display after the date.
avatarSize‘: The Pixel size of the avatar if the ‘itemOrder’ is set up to show the avatar.
niceDate‘: Flag to indicate whether to display the date of the post in the “nicedate” format. One (1) is true and causes the post’s date to be displayed in “nicedate” format with the post. Zero (0) is false and causes the post’s date to not be displayed in the “nicedate” format with the post. Examples of the “nicedate” format are “1 week ago” and “5 days ago”.
echo‘: Flag to indicate whether to write out the generated html display code or just return the html display code. One (1) is true and causes the html display code to be written to the display. Zero (0) is false and causes the html display code to be returned instead of written out.

Special Notes

This template tag is NOT in standard supplied Simple:Press themes.

If the template tag is to be added to a theme, it is suggested a Custom or Child theme be made to accept the template tag. Please see discussion at Template Tags Used in the Plugin.

A possible location for the template tag in a Custom or Child theme is in the footer, ‘spFoot.php’ or ‘spFootDesktop.php’ and ‘spFootMobile.php’, depending on the Simple:Press parent theme.

If used, the function should be called conditionally , if (function_exists(”)), so that if the plugin is deactivated or does not exist, the website will continue to operate.

The maximum number of the latest mentions displayed by this template tag is set by the value selected by the forum Admin in the “Mentions” section of the “Options – Member Settings” forum Admin panel accessed from the forum Admin menu at Forum > Options > Member Settings.

The function requires the use of file ‘sp-mentions-latest-mentions-tag.php’ located in the plugin’s Template Tag folder.

Examples

Using the defaults, display the latest “mentions” in the ‘pageBottomStatus’ section of the footer of a Child theme based on the Simple:Press Default theme after the ‘sp_WatchesWatchButton()’ call. Call the function conditionally. Separate the call from the previous call by adding a ‘sp_InsertBreak() call.

A. If not already done, download the Simple:Press Default Child Theme Framework to contain the template tag modification, and set it up including providing a unique name as discussed in the Creating a Child Theme page.
B. If not already in existence, add a “templates” folder in the child theme folder to contain the file to be modified.
C. If not already done, copy the ‘spFoot.php’ file from the Simple:Press Default Theme and place it in the Child Theme’s ‘template’ folder.
D. Modify the ‘spFoot.php’ file header to identify it as part of the Child Theme, add the change listed below, and save the file.

sp_InsertBreak(); 
if (function_exists('sp_MentionsLatestTag')) sp_MentionsLatestTag();

When complete, the file’s modified section might look something like:

if (function_exists('sp_WatchesWatchButton')) sp_WatchesWatchButton('tagClass=spButton spLeft', __sp('Watch'), __sp('Stop Watching'), __sp('Watch this topic'), __sp('Stop watching this topic'));
sp_InsertBreak();
if (function_exists('sp_MentionsLatestTag')) sp_MentionsLatestTag();
sp_GoToTop('tagClass=spRight spGoToTop&iconClass=spIcon', '', __sp('Go to top'));

E. Activate the uniquely named child theme on the site by clicking its “Activate Theme” button on the “Available Themes – Select Simple:Press Theme” forum Admin panel accessed from the forum Admin menu at Forum > Themes > Available Themes.

 

Actions and Hooks Used in the sp_MentionsLatestTag() Template Tag

  • apply_filters(‘sph_MentionsLatestTag_args’, $a) – Allows modification of the arguments to the template tag. $a contains the parsed arguments.
  • apply_filters(‘sph_MentionsLatestTag’, $out) – Allows modification of the display code just prior to being output/returned. $out will contain the html display code.

Changelog

See Plugin and Template Tag Changelog for Template Tag changes and Codex page syncing to code versions.


Individual Template Tags


 

sp_MentionsYourLatestTag()

Description

sp_MentionsYourLatestTag() – This template displays the list of latest “Mentions” that mention the logged in user.

Usage

sp_MentionsYourLatestTag($args=”);

Arguments

$args – List of arguments for controlling display.
Type:
(string) (optional)
Default:
‘tagId’ => ‘spMentionsYourLatestTag’
‘tagClass’ => ‘spListTag’
‘listId’ => ‘spListItemTag%ID%’
‘listClass’ => ‘spListItemTag’
‘linkClass’ => ‘spLinkTag’
‘textClass’ => ‘spTextTag’
‘avatarClass’ => ‘spAvatarTag’
‘listTags’ => 1
‘limit’ => 10
‘itemOrder’ => ‘AUTD’
‘linkScope’ => ‘forum’
‘beforeForum’ => __(‘Forum: ‘, ‘sp-mentions’)
‘afterForum’ => ‘<br />’
‘beforeTopic’ => __(‘Topic: ‘, ‘sp-mentions’)
‘afterTopic’ => ‘<br />’
‘beforeUser’ => ‘ ‘
‘afterUser’ => ‘__(‘mentioned you’, ‘sp-mentions’).<br />’
‘beforeMention’ => ”
‘afterMention’ => ”
‘beforeDate’ => ”
‘afterDate’ => ”
‘avatarSize’ => 25
‘niceDate’ => 1
‘echo’ => 1

tagId‘: CSS ID for the Div.
tagClass‘: CSS Class for the Div.
listId‘: CSS ID for the list.
listClass‘: CSS Class for the list.
linkClass‘: CSS Class for the link.
textClass‘: CSS Class for the text.
avatarClass‘: CSS Class for the Avatar.
listTags‘: Flag to indicate whether to wrap the list in <ul> and <li> tags or use a div. A one (1) is true and the tags will be used. A zero (0) is false and a div will be used.
limit‘: The maximum number of the latest mentions for a user displayed by this template tag.
itemOrder‘: Controls which components are displayed and also the order in which they are displayed. Use the following codes to construct this parameter. No spaces or other characters can be used. Upper case (Capital) letters must be used.

    • F – Displays the forum name

 

    • T – Displays the topic name

 

    • A – Displays the mention’s author’s Avatar

 

    • U – Displays the mentions’s author’s display name

 

    • M – Displays the mentioned user’s display name

 

    D – Displays the date of the post

linkScope‘: Controls what items are made into links (‘a’ tags): This is entered as text.

Note:
The Topic will ALWAYS be formed as a link.

The following options are available:

    • forum – Display the Forum name as a link as well as the Topic.

 

    all – Make the entire entry a link to the Topic.

beforeForum‘: The text to display before the forum title.
afterForum‘: The text to display after the forum title.
beforeTopic‘: The text to display before the topic title.
afterTopic‘: The text to display after the topic title.
beforeUser‘: The text to display before the posting user’s name.
afterUser‘: The text to display after the posting user’s name.
beforeMention‘: The text to display before the mentioned user’s name.
afterMention‘: The text to display after the mentioned user’s name.
beforeDate‘: The text to display before the date.
afterDate‘: The text to display after the date.
avatarSize‘: The Pixel size of the avatar if the ‘itemOrder’ is set up to show the avatar.
niceDate‘: Flag to indicate whether to display the date of the post in the “nicedate” format. One (1) is true and causes the post’s date to be displayed in “nicedate” format with the post. Zero (0) is false and causes the post’s date to not be displayed in the “nicedate” format with the post. Examples of the “nicedate” format are “1 week ago” and “5 days ago”.
echo‘: Flag to indicate whether to write out the generated html display code or just return the html display code. One (1) is true and causes the html display code to be written to the display. Zero (0) is false and causes the html display code to be returned instead of written out.

Special Notes

This template tag is NOT in standard supplied Simple:Press themes.

If the template tag is to be added to a theme, it is suggested a Custom or Child theme be made to accept the template tag. Please see discussion at Template Tags Used in the Plugin.

A possible location for the template tag in a Custom or Child theme is in the footer, ‘spFoot.php’ or ‘spFootDesktop.php’ and ‘spFootMobile.php’, depending on the Simple:Press parent theme.

If used, the function should be called conditionally , if (function_exists(”)), so that if the plugin is deactivated or does not exist, the website will continue to operate.

The function requires the use of file ‘sp-mentions-your-latest-mentions-tag.php’ located in the plugin’s Template Tag folder.

Examples

Using the defaults, display the latest “your mentions” in the ‘stats’ section of the footer of a Child theme based on the Simple:Press Default theme after the ‘sp_UserSelectionOptions()’ call. Call the function conditionally. Separate the call from the previous call by adding a ‘sp_InsertBreak() call.

A. If not already done, download the Simple:Press Default Child Theme Framework to contain the template tag modification, and set it up including providing a unique name as discussed in the Creating a Child Theme page.
B. If not already in existence, add a “templates” folder in the child theme folder to contain the file to be modified.
C. If not already done, copy the ‘spFoot.php’ file from the Simple:Press Default Theme and place it in the Child Theme’s ‘template’ folder.
D. Modify the ‘spFooter.php’ file header to identify it as part of the Child Theme, add the change listed below, and save the file.

sp_InsertBreak();
if (function_exists('sp_MentionsYourLatestTag')) sp_MentionsYourLatestTag();

When complete, the file’s modified section might look something like:

if (function_exists('sp_UserSelectOptions')) sp_UserSelectOptions('tagClass=spCenter spLabelSmall', __sp('Theme:'), __sp('Language:'));
sp_InsertBreak();
if (function_exists('sp_MentionsYourLatestTag')) sp_MentionsYourLatestTag(); // 4/18/16 KLW added for Mentions plugin
sp_InsertBreak();

E. Activate the uniquely named child theme on the site by clicking its “Activate Theme” button on the “Available Themes – Select Simple:Press Theme” forum Admin panel accessed from the forum Admin menu at Forum > Themes > Available Themes.

 

Actions and Hooks Used in the sp_MentionsYourLatestTag() Template Tag

  • apply_filters(‘sph_MentionsYourLatestTag_args’, $a) – Allows modification of the arguments to the template tag. $a contains the parsed arguments.
  • apply_filters(‘sph_MentionsYourLatestTag’, $out) – Allows modification of the display code just prior to being output/returned. $out will contain the html display code.

Changelog

See Plugin and Template Tag Changelog for Template Tag changes and Codex page syncing to code versions.


More Topics In SimplePress: Plugins


Copyright © 2006-2019 Simple:Press. All Rights Reserved.