Simple:Press Documentation

Plugin: CubePoints Integration

Plugin Description –

This Simple:Press plugin integrates the WordPress CubePoints points management system plugin by Jonathan Lau and petester into Simple:Press to allow users to be awarded / charged points for interactions in the forum.

Note:
The Simple:Press CubePoints Integration plugin requires the installation, activation, and set up first of the CubePoints plugin found by searching in the WordPress Plugin Directory before the CubePoints Integration plugin can operate correctly.

  • Please see the CubePoints Plugin Page for the details on the WP plugin’s installation, features, and operation.
  • If the Simple:Press Plugin: Polls is active, points for poll activity in the forum can be counted in the CubePoints system.
  • If the Simple:Press Plugin: Post Ratings is active, points for post rating activity can be counted in the CubePoints system.

Plugin Overview

  • The WordPress CubePoints plugin provides the basic point management system for the website.
  • The Simple:Press CubePoints Integration plugin provides
    • The ability for a forum Admin to define point values in the CubePoints point system via a Forum Admin panel for:
      • Posting/deleting forum topics and replies.
      • Forum Polling activities if the Simple:Press Plugin: Polls is active.
      • Forum Post Rating activities if the Simple:Press Plugin: Post Ratings is active.
    • Two (2) Template Tags displaying forum user CubePoints point totals to further customize the web pages.

Plugin Features

Installing and activating the WordPress CubePoints plugin provides the basic CubePoints points management system including:

  • A new “CubePoints” menu item on the WP Admin menu having sub-menu entries:
    • “Manage” linked to the “CubePoints – Manage” Admin panel where the points website members have in the CubePoints system can be viewed by the Admin.
    • “Configure” linked to the “CubePoints – Configure” Admin panel where general CubePoints system setup can be accomplished by the Admin.
    • “Logs” linked to the “CubePoints – Logs” Admin panel where the recent point transactions of the website members can be viewed by the Admin.
    • “Add Points”, and “Modules” linked to their respective Admin panels also support the CubePoints system.

Installing this Simple:Press plugin adds:

  • A new “CubePoints Integration” 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 “cubepoints” containing the plugin’s files.

Activating this plugin provides:

  • A change to the new “CubePoints Integration” 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 “CubePoints Integration” 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 “CubePoints” sub-menu entry in the forum Admin menu under “Components” linked to the new “CubePoints Integration” forum Admin panel where the plugin’s options can be set.
    • The “CubePoints” sub-menu entry can be access from the forum Admin menu at Forum > Components.
  • A new “CubePoints Integration” forum Admin panel where the plugin’s options can be set .
    • Points for the various forum activities can be set including those associated with the Simple:Press Plugin: Polls and Plugin: Post Ratings if those plugins are active.
    • Maximum daily point accrual can be set.
    • If points are taken away for posts/topics being removed.
    • Whether or not forum activities are shown on the WP “CubePoints – Logs” Admin panel.
    • Whether or not forum Admins and/or forum Moderators can gain points in the CubePoints system.
    • The “CubePoints Integration” forum Admin panel can be accessed from the Forum Admin menu at:
      • Forum > Components > CubePoints
      • Forum > Plugins > Available Plugins > CubePoints Integration > Options
  • Two (2) template tags for further customizing the web pages.

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

Plugin Requirements

The WordPress CubePoints plugin found by searching in the WordPress Plugin Directory must be downloaded, installed, and set up before the Simple:Press CubePoints Integration plugin can operate correctly.

  • Please see the CubePoints Plugin Page for the details on the WP plugin’s installation, features, and operation.
  • Upon its activation a new WP Admin menu item named “CubePoints” with sub-menu entries is added.

The Simple:Press Plugin: Polls must be installed, activated, and set up if polling activities are to count in the CubePoints system.

The Simple:Press Plugin: Post Ratings must be installed, activated, and set up if forum post rating activities are to count in the CubePoints system.

Simple:Press version 5.6.2 and above is required.

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

As part of the installation, an “CubePoints Integration” 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 “CubePoints Integration” forum Admin panel where its options can be set.

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_PostIndexCubePoints()’, which is incorporated into standard supplied Simple:Press themes and, ‘sp_CubePoints()’, which is NOT incorporated.

  • Nothing need be done if:
    • The placement and arguments for the incorporated template tag are NOT to be changed.
    • If the other template tag is not to be added to Simple:Press themes.
  • If the incorporated template tag is to be changed or the other 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 the WP CubePoints Plugin Page for the details on the WP plugin’s installation, features, and operation.

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

  • Plugin: Polls if polling activities are to count in the CubePoints system.
  • Plugin: Post Ratings if post rating activities are to count in the CubePoints system.
  • 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 “cubepoints“.
  • 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 “cubepoints.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 CubePoints Integration 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

Please see the WP CubePoints Plugin Page for the details on the WP plugin’s installation, features, and operation.

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

  • Go to the “CubePoints Options” section of the Admin panel.
    • Please click on the section’s “Help” link for more information on this section’s feature(s).
    • CubePoints Options Basic Set Up
Note:
If points are not be be awarded for an activity, put in zero (0) or leave the input box ‘blank’.
    • In the data input box to the right of “Points for new topic:” enter the integer number of points to award for this activity in the forum.
    • In the data input box to the right of “Points for new post:” enter the integer number of points to award for this activity in the forum.
      • If there are not points awarded for a new topic, this number of points will be awarded for a new topic post as well as a reply post.
    • In the data input box to the right of “Max daily points that can be accrued (zero for no limit – logging must be enabled):“, enter the integer maximum points that can be accrued by a member in a day.
      • Zero (0) is entered for no limit.
      • For the limiting feature to operate, the “CubePoints Logging Enabled?“, option below must be selected.
Note:
Check box options are selected or deselected as follows in the following 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 and puts a green check mark in that check box.
  • Clicking a check box containing a green checkmark deselects that option and removes the green check mark from that check box.
      • If there is not already a green check mark in the check box, click on the check box to the left of “Take points from user when posts/topics are deleted?” to select this option to take points away from users whose posts or topics are deleted.
      • If there is not already a green check mark in the check box, click on the check box to the left of “CubePoints Logging Enabled?” to select this option to have forum activities logged into the CubePoints system.
        • These logs will appear on the standard WP Cubepoints admin “Log” panel accessed from the WP Admin menu at CubePoints > Logs.
        • This feature MUST be selected if the “Maximum daily points” option above is non-zero and a limit is to be imposed on daily point accrual.
      • If there is not already a green check mark in the check box, click on the check box to the left of “Disable SP Admins from gaining points” to select this option to NOT allow SP Admins to accrue points in the CubePoints system.
      • If there is not already a green check mark in the check box, click on the check box to the left of “Disable SP Moderators from gaining points” to select this option to NOT allow SP Moderators to accrue points in the CubePoints system.
      • If there are no other options to select in the panel, click on the “Update” button at the bottom of the panel to save the settings. Otherwise, go on to specify the additional options.

 

    • Additional CubePoints Options Set Up if Plugin: Polls Is Active

The following options are added within the CubePoints Options section if the Simple:Press “Plugin: Polls” is active.

Note:
If points are not be be awarded for an activity, put in zero (0) or leave the input box ‘blank’.
      • In the data input box to the right of “Points for creating a poll:” enter the integer number of points to award for this activity in the forum.
      • In the data input box to the right of “Points for voting in a poll:” enter the integer number of points to award for this activity in the forum.
      • In the data input box to the right of “Points for users poll getting a vote:” enter the integer number of points to award for this activity in the forum.
      • If there are no other options to select in the panel, click on the “Update” button at the bottom of the panel to save the settings. Otherwise, go on to specify the additional options.

 

The following options are added within the CubePoints Options section if the Simple:Press “Plugin: Post Ratings” is active.

Note:
If points are not be be awarded for an activity, put in zero (0) or leave the input box ‘blank’.
    • In the data input box to the right of “Points for rating a post:” enter the integer number of points to award for this activity in the forum.
    • In the data input box to the right of “Points for user have posted rated:” enter the integer number of points to award for this activity in the forum.
    • If there are no other options to select in the panel, click on the “Update” button at the bottom of the panel to save the settings. Otherwise, go on to specify the additional options.

Changes are required in a Simple:Press Child Theme to display the CubePoint points using the ‘sp_CubePoints()’ template tag. See the template tag section on this page at Template Tags Used in the Plugin and the specific example at sp_CubePoints().

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 Cubepoints 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 “CubePoints Integration” 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 “Cubepoints” 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 list of Website users and their points in the CubePoint system on the WP “CubePoints – Manage” Admin panel.

  • The Admin panel can be access from the WP Admin menu at CubePoints > Manage.

Forum Admins can view the log of transactions providing points in the CubePoint system on the WP “CubePoints – Logs” Admin panel.

  • The Admin panel can be access from the WP Admin menu at CubePoints > Logs.

Forum Users do not actually use the plugin, but are awarded points for their actions in the forum based on the point values set up by the forum Admin on the “CubePoints Integration” forum Admin panel.

    • CubePoints Basic Forum Awards

Points may or may not be awarded for the following basic forum activities:

      • Posting a new Topic post
      • Posting a reply post

Points may or may not be deducted if:

    • A user’s post/topic is deleted.

Points may or may not be awarded for the following poll forum activities:

    • Creating a poll
    • Voting in a poll
    • A poll a user created getting a vote

Points may or may not be awarded for the following post rating forum activities:

    • Rating a post
    • A post a user created getting rated

Forum user can view a post author’s points in the CubePoints system in the user information section of the forum post.

    • Viewing a Post Author’s Points in the CubePoints System
      • Navigate to a post within a forum authored by the forum user of interest.
      • The post author’s points in the CubePoints system are shown along with the CubePoints icon in the post author’s information column of the post.
Note:
The words displayed before and after the CubePoints point total are those set up by the Admin on the WordPress “CubePoints – Configure” Admin panel, “Prefix for display of points:” and “Suffix for display of points:” entries, respectively.

  • The WP “CubePoints – Configure” Admin panel is accessed from the WP Admin menu at CubePoints > Configure.

Plugin Special Notes

The styling (CSS) of a plugin can be changed by copying the plugin’s ‘sp-cubepoints.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-cubepoints.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 file for the Cubepoints template tag ‘sp_PostIndexCubePoints()’ display is contained in the plugin’s “css” folder and is named ‘sp-cubepoints.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-cubepoints.css’ file over to a Child or Custom theme’s folder and into theme’s “styles” folder.
    • Edit the copied over ‘sp-cubepoints.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

The plugin has two (2) template tags, ‘sp_PostIndexCubePoints()’, which is incorporated into standard supplied Simple:Press themes and, ‘sp_CubePoints()’, which is NOT incorporated.

  • Nothing need be done if:
    • The placement and arguments for the incorporated template tag are NOT to be changed.
    • If the other template tag is not to be added to Simple:Press themes.
  • If the incorporated template tag is to be changed or the other 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 no other Actions and Hooks available for this plugin to modify aspects of the plugin.

Plugin and Template Tag Changelog

Since Simple:Press version 5.1.2.

Codex page sync’d to SP code version 5.6.7, SP plugin version 1.2.13, and WP plugin version 3.2.1.



Individual Template Tags


 

sp_PostIndexCubePoints()

Description

sp_PostIndexCubePoints() – This template displays the CubePoints points a forum user has. It needs to be used in the forum View topic loop and is valid for each post/user combination.

Note:
The words displayed before and after the CubePoints point total are those set up by the Admin on the WordPress “CubePoints – Configure” Admin panel, “Prefix for display of points:” and “Suffix for display of points:” entries, respectively.

  • The WP “CubePoints – Configure” Admin panel is accessed from the WP Admin menu at CubePoints > Configure.

Usage

sp_PostIndexCubePoints($args=”, $toolTip=”);

Arguments

$args – List of arguments for controlling display.
Type:
(string) (optional)
Default:
‘tagId’ => ‘spPostIndexCubePoints%ID%’
‘tagClass’ => ‘spPostUserCubePoints’
‘icon’ => ‘sp_CubePoints.png’
‘echo’ => 1
‘get’ => 0

tagId‘: CSS ID for the Div. %ID% is replaced by the post_id.
tagClass‘: CSS Class for the Div.
icon‘: Filename of the file containing the icon to be displayed.
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.

Special Notes

In standard supplied Simple:Press themes this template tag is included in the Topic View page (‘spTopicView.php’) file.
The exceptions are:

  • the reboot and barebones themes where the template tag is not included in the ‘spTopicView.php’ file, but is included in the ‘spTopicViewDesktop.php’, and ‘spTopicViewMobile.php’ files.

The function is called conditionally, if (function_exists(‘ ‘)), so that if the plugin is deactivated or does not exist, the website will continue to operate.

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

The function requires the use of file ‘sp-cubepoints-post-index-points.php’ located in the plugin’s Template Tag folder.

Examples

Display a post author’s CubePoint points with “tagClass” of “spPostUserCubePoints spCenter” and displaying the message “CubePoints” when the cursor is hovered over the icon. Call the function conditionally.

if (function_exists('sp_PostIndexCubePoints')) sp_PostIndexCubePoints('tagClass=spPostUserCubePoints spCenter', __sp('CubePoints'));

 

Actions and Hooks Used in the sp_PostIndexCubePoints() Template Tag

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


 

sp_CubePoints()

Description

sp_CubePoints() – This is a generic template tag that can be used anywhere and can display the CubePoint points of forum users in various ways.

Note:
The words displayed before and after the CubePoints point total are those set up by the Admin on the WordPress “CubePoints – Configure” Admin panel, “Prefix for display of points:” and “Suffix for display of points:” entries, respectively.

  • The WP “CubePoints – Configure” Admin panel is accessed from the WP Admin menu at CubePoints > Configure.

Usage

sp_CubePoints($args=”, $userid=”, $toolTip=”);

Arguments

$args – List of arguments for controlling display.
Type:
(string) (optional)
Default:
‘tagId’ => ‘spCubePoints’
‘tagClass’ => ‘spCubePoints’
‘icon’ => ‘sp_CubePoints.png’
‘echo’ => 1
‘get’ => 0

tagId‘: CSS ID for the Div.
tagClass‘: CSS Class for the Div.
icon‘: Filename of the file containing the icon to be displayed.
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.

$userid – User ID of the forum user whose CubePoint points are to be displayed.
Type:
(string) (optional)
For the current logged in user (or a guest), leave ‘$userid’ blank.
For a specific user, pass that user’s user_id in ‘$userid’.
Default:
None

$toolTip – Text to be displayed when the cursor is hovered over the icon.
Type:
(string) (optional)
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.

Typically this tag is added in a Custom or Child theme in the header, ‘spHead.php’ or ‘spHeadDesktop.php’ and ‘spHeadMobile.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-cubepoints-points.php” located in the plugin’s Template Tag folder.

Examples

1. With “tagClass” of “spCubePoints spLeft”, display the logged in users “CubePoints” points in the header of a Child theme based on the Simple:Press Default theme after the ‘sp_UserNotices()’ call. Display the message “My CubePoint Points” when the cursor is hovered over the icon. Call the function conditionally. Separate the call from the next section by adding a ‘sp_InsertBreak() call after it.

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 ‘spHead.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.

if (function_exists('sp_CubePoints')) sp_CubePoints('tagClass=spCubePoints spLeft', '', __sp('My CubePoints Points'));
sp_InsertBreak();

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

sp_UserNotices('', __sp('(Remove Notice)'));
if (function_exists('sp_CubePoints')) sp_CubePoints('tagClass=spCubePoints spLeft', '', __sp('My CubePoints Points'));
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.

2. Keeping everything else the same as in example 1 but instead display the CubePoint points for Bill Jones who has the user id of “5” and display the message “Bill Jones CubePoint Points” when the cursor is hovered over the icon.

if (function_exists('sp_CubePoints')) sp_CubePoints('tagClass=spCubePoints spLeft', '5', __sp('Bill Jones CubePoints Points'));
sp_InsertBreak();

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

sp_UserNotices('', __sp('(Remove Notice)'));
if (function_exists('sp_CubePoints')) sp_CubePoints('tagClass=spCubePoints spLeft', '5', __sp('Bill Jones CubePoints Points'));
sp_InsertBreak();

 

Actions and Hooks Used in the sp_CubePoints() Template Tag

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