Simple:Press Documentation

Plugin: Add User Identities

Plugin Description –

This Simple:Press plugin allows for adding and displaying of new user identities like the core Facebook or twitter ones that are not listed in the default identities section. This identity plugin is specifically for online identities.

Note:
If all that is wanted is a different field in users’ profiles, then Plugin: Custom Profile Fields should be used.

The forum Admin will need to put in an icon and a base url for the site. The user will have to enter an account (or destination page) for the base url site. After creating identities in the plugin, use the template function to display them. The template function call would be added where the icon is to be displayed, typically in the ‘spTopicView.php’ ( or ‘spTopicViewDesktop.php’ / ‘spTopicViewMobile.php’) template file of an SP child theme.

Plugin Overview

  • Provides a new forum Admin panel for creating the added user identities.
  • Creates a new entry in all member’s profile identities section where members can enter a special identity of theirs.
  • Displays special identity on any forum page using the template tag.
  • Includes one (1) template tag the forum Admin can add to a Child or Custom theme to display the user’s special identity possibly along with their user information on their posts.

Plugin Features

Installing this Simple:Press plugin adds:

  • A new “Add User Identities” 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 “identities” containing the plugin’s files.

Activating this plugin provides:

  • A change to the new “Add User Identities” 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 new “Profiles – User Identities” forum Admin panel where the plugin’s 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 “User Identities” sub-menu entry in the forum Admin menu under “Profiles” linked to the new “Profiles – User Identities” forum Admin panel where the plugin’s options can be set.
    • The “User Identities” sub-menu entry can be access from the forum Admin menu at Forum > Profiles.
  • A new “Profiles – User Identities” forum Admin panel where the plugin’s options can be set .
    • User Identity icons can be uploaded.
    • Names and base URLs for User Identities can be added.
    • The “Profiles – User Identities” forum Admin panel can be accessed from the Forum Admin menu at:
      • Forum > Profiles > User Identities
      • Forum > Plugins > Available Plugins > Add User Identities > Options
  • A new “forum-identities” folder in the website folder structure where the new icons for the user identities are stored.
    • If the defaults are used, the “forum-identities” folder can be accessed at “… > wp-content > sp-resources”.
  • A new “Identity icons folder” entry on the existing “Integration – Storage Locations” forum Admin panel where the location of the “forum-identities” folder is displayed.
  • The “Integration – Storage Locations” forum Admin panel can be access from the forum Admin menu at Forum >Integration > Storage Locations.

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

Plugin Requirements

This plugin requires Simple:Press version 5.6.2 or above.

This plugin requires that files containing the “user identity icon” for any online identities being added be available for uploading to the forum file system.

  • Depending on placement of the icon, typically 24px X 24px is a suitable size for the icons.

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

As part of the installation, an “Add User Identities” 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 new “Profiles – User Identities” forum Admin panel with the “User Identity Icon Upload” and “Add User Identities” sections.

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

The plugin has one (1) template tag, ‘sp_PostIndexIdentityDisplay()’, which is NOT incorporated into standard supplied Simple:Press themes.

  • If the template tag is not to be added to Simple:Press themes, nothing need be done.
  • If the template tag 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.

Plugin Installation and Activation

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 “identities“.
  • 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 “identities.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 Add User Identities 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 Add User Identities plugin section or b) under the Profiles entry on the forum menu on the left side forum admin page click the User Identities sub-menu item to get the “Profiles – User Identities” Admin panel with its “User Identity Icon Upload” and “Add User Identities” sections.

    • User Identity Icon Upload

This feature allows uploading a new User Identity icon/image file to use when displaying the identify for a user. The icon will populate the “Add User Identities” section where the associated “Name” and “Base URL” can be defined for the “online” identity.

      • Go to the “User Identity Icon Upload” section of the Admin panel.
        • Please click on the section’s “Help” link for more information on this section’s feature(s).
Note:
Files containing the “user identity icon” for the various online identities must be available for uploading. Depending on placement of the icon typically 24px X 24px is a suitable size.
      • Click on the “Browse” button to display the window showing available disks, folders, and files.
      • Navigation to the file containing the icon/image for a “user identity” to be added.
      • Perform the steps required by the browser to upload the file. For example:
        • Click on the file to select it.
          • For this example, “Simple-Press_icon.jpg” shown here as the black square with a megaphone .
        • Click on the “Open” button to initiate the upload.
      • When uploaded the icon is displayed along with the icon’s filename in the “Add User Identities” section.
    • Completion of Adding A User Identity
      • Go to the “Add User Identities” section of the Admin panel.
        • Please click on the section’s “Help” link for more information on this section’s feature(s).
      • Under the “Name” column type the name of the online website in the text input box in the same row as the uploaded icon.
        • For this example, “Simple:Press”.
      • Under the “Base URL” column type the Base URL of the online website in the text input box in the same row as the uploaded icon.
        • For this example, “www.simple-press.com”, will be come “http://www.simple-press.com”
      • If there are no other icon files and User Identities to add, click on the “Update Identities” button at the bottom of the page.
      • Otherwise, click the “Browse” button in the “User Identity Icon Upload” section to repeat the step to add another User Identity.
      • Repeat the steps until all desired User Identities have had their icon uploaded and the “Name” and “Base URL” defined.

Changes are required in a Simple:Press Child Theme to display the new User Identities if so desired in a user’s posts. The plugin’s template tag, ‘sp_PostIndexIdentityDisplay()’, can be added to a Simple:Press child theme’s ‘spTopicView.php’ (or ‘spTopicViewDesktop.php’ / ‘spTopicViewMobile.php’) file to display the added user identities and provide links to the user’s web page. The template tag can be added and customized multiple times, one for each new user identity added. See the template tag section on this page at Template Tags Used in the Plugin and the specific example at sp_PostIndexIdentityDisplay().

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 Identities 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 “Add User Identities” 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 “Identities” 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 can view the uploaded icons for added user identities in the ‘forum-identity’ folder.

  • Viewing Location of Uploaded User Identity Icons
    • From the forum Admin menu navigate to Forum > Integration > Storage Locations to view the “Integration – Storage Locations” admin panel.
    • Identify the location listed for the “Identity icons folder” where the icons for this plugin’s added user identities are stored.
      • By default they will be in the …/wp-content/sp-resources/forum-identities/ folder.
    • In the website file structure, navigate to the location specified for the “Identity icons folder” and open it to view the user identity icons that have been uploaded.

Individual forum users can set up their added user identities on their profile page.

Note:
Members do not have to enter an account name (or web page) for any added user identity if they do not have one or do not wish to have one displayed.
  • Users Adding Identities
    • In this example, assume the logged-in user wants to display the “About Us” page for the “Simple:Press” identity.
    • In the forum page header click on the “Profile” button to view all the profile tabs.
    • Click on the “Profile” tab to see the sub-tabs for the “Profile” tab.
    • Click on the “Edit Identities” sub-tab to see the “Edit Identities (XXXX)” panel where ‘XXXX’ is the logged-in user’s name.
    • Scroll down the page to see the identities added by the forum Admin using this plugin.
      • For this example, “Simple:Press:”.
    • In the text input box for the identity enter the account name (not the URL) for the account (or the page the link should go to) on the website.
      • For this example, “about” (without the enclosing ” “) because the user wants to display the Simple:Press “About Us” page.
    • Click the “Update Identities” button at the bottom of the panel.
    • Repeat the above steps as necessary to enter the account names appropriate for the user identities added by this plugin.

Forum users can view their or other user’s added user identity web page.

    • Forum Users Viewing an Added User Identity
Note:
This example assumes:

  • The forum Admin has added a new User Identity “Simple:Press:” with the uploaded black square icon having a megaphone as shown here.
  • The forum Admin has added this plugin’s sp_PostIndexIdentityDisplay() template tag for the “Simple:Press” identity to a Child theme’s ‘spTopicView.php’ file as shown in the template tag example below.
  • A forum user has input his Simple:Press account name (or page on the website where the link should go) in his profile as “about” so the link from the “Simple:Press” icon on his posts goes the the Simple:Press “About Us” page.
    • Navigate to a forum and post of a forum user who has added their account name (or page on the website where the ling should go) for the “Simple:Press” identity in their profile.
    • In the post author’s information section of the post, find and click upon the “Simple:Press” icon, a black square with the megaphone.
      • In this example, hovering over the “Simple:Press” icon the message “Visit our Simple:Press About Us page” will be displayed.
    • The link goes to the “About Us” page on the Simple:Press website at simple-press.com/about.

Plugin Special Notes

None

 

Template Tags Used in the Plugin

There is (1) template tag available for this plugin that allow further customization of the plugin’s usage in themes or otherwise customize the website. ‘sp_PostIndexIdentityDisplay()’ is NOT incorporated into standard supplied Simple:Press themes.

  • If the template tag is NOT to be added to Simple:Press themes, nothing need be done.
  • If the template tag 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-identities-admin-save.php‘:

  • do_action(‘sph_identities_save’) – Hook fired to save the added user identities.

Plugin and Template Tag Changelog

Since Simple:Press version 5.1.4.

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



Individual Template Tags


 

sp_PostIndexIdentityDisplay()

Description

sp_PostIndexIdentityDisplay() – This template can display the added User Identity icon along with a tooltip. The icon is linked to the added identity web page specified by a post’s author, typically.

Usage

sp_PostIndexIdentityDisplay($args=”, $tooltip=”, $identity);

Arguments

$args – List of arguments for controlling display.
Type:
(string) (optional)
Default:
‘tagId’ => ‘spPostIndexUser’.$slug.’%ID%’
‘tagClass’ => ‘spPostUser’.$slug
‘iconClass’ => ‘spImg’
‘targetNew’ => 1
‘noFollow’ => 0
‘echo’ => 1
‘get’ => 0

tagId‘: CSS ID for the Div. %ID% is replaced by the post ID.
tagClass‘: CSS Class for the Div.
iconClass‘: CSS Class for the icon to be displayed.
targetNew‘: Flag to indicate whether or not to open the link’s web page in a new window. A one (1) is true and the link’s web page will be opened in a new window. A zero (0) is false and the link’s web page will be opened on the existing page.
noFollow‘: Flag to indicate whether or not the link if taken will provide Search Engine Optimization (SEO) points to the destination web page. A one (1) is true and the web page will not get points. The link URL will have a ‘rel=”nofollow” ‘ added to it. A zero (0) is false and the web page will get points. A ‘rel=”nofollow” ‘ is NOT added the the link URL.
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.
get‘: Flag to indicate whether to short circuit the template tag display process and simply return data or to proceed with normal HTML display code generation. One (1) is true and the template tag display process is not done and data is returned. Zero (0) is false and normal html display code generation happens.

$toolTip – Text displayed when the cursor hovers over the User Identity icon.
Type:
(string) (optional) – The tooltip should be passed to the function to notify the logged-in users where the link will going.
Default:
None

$identity – The same text as entered under the “Name” column for the added user identity on the “Profiles – User Identities” forum Admin panel.
Type:
(string) (mandatory) – The identity name must be passed to the function for correct operation.
Default:
None

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 post author’s information section of a post in ‘spTopicView.php’ or ‘spTopicViewDesktop.php’ and ‘spTopicViewMobile.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 can be used multiple times with each function call customized with the a different added identity as set up on the “Profiles – User Identities” forum Admin panel. A customized function call can be used more than once per page. The different customized function calls can be stacked on one page, if desired.

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

Examples

1). Using the defaults, display the “Simple:Press” identity of the post author in posts of a Child theme based on the Simple:Press Default theme. When the “Simple:Press” icon is hovered over, provide the message, “Visit our Simple:Press About Us page”. Provide a link to the post authors “Simple:Press” web page that opens in a separate tab. Place the call in the “user-identities” section of the child theme’s ‘spTopicView.php’ file immediately after the call to ‘sp_PostIndexUserGooglePlus()’. Call the function conditionally.

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 ‘spTopicView.php’ file from the Simple:Press Default Theme and place it in the Child Theme’s ‘template’ folder.
d. Modify the ‘spTopicView.php’ file header to identify it as part of the Child Theme, add the change listed below, and save the file.

if (function_exists('sp_PostIndexIdentityDisplay')) sp_PostIndexIdentityDisplay('', 'Visit our Simple:Press About Us page', 'Simple:Press');

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

sp_PostIndexUserGooglePlus('', __sp('Interact with me on Google Plus'));
if (function_exists('sp_PostIndexIdentityDisplay')) sp_PostIndexIdentityDisplay('', 'Visit our Simple:Press About Us page', 'Simple:Press');

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.

2). Keeping everything else the same as in example 1, set up the template tag so the link opens in the same tab and the destination web page is given SEO points.
The change to add in the file is:

if (function_exists('sp_PostIndexIdentityDisplay')) sp_PostIndexIdentityDisplay('targetNew=0&noFollow=1', 'Visit our Simple:Press About Us page', 'Simple:Press');

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

sp_PostIndexUserGooglePlus('', __sp('Interact with me on Google Plus'));
if (function_exists('sp_PostIndexIdentityDisplay')) sp_PostIndexIdentityDisplay('targetNew=0&noFollow=1', 'Visit our Simple:Press About Us page', 'Simple:Press');

 

Actions and Hooks Used in the sp_PostIndexIdentityDisplay() Template Tag

  • apply_filters(‘sph_PostIndexUser’.$slug.’_args’, $a) – Allows modification of the arguments to the template tag. $a contains the parsed arguments.
  • apply_filters(‘sph_PostIndexUser’.$slug, $out, $a) – 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.