Simple:Press Documentation

Plugin: MyCred Integration

Plugin Description

Plugin: MyCred Integration – This Simple:Press plugin extends the WordPress MyCRED plugin (an adaptive points management system that lets users be awarded / charged for interacting with the website) to provide MyCred support for the Simple:Press Best Answer In Topics (Answers Topics), User Birthdays (Birthdays), Polls, Forum Post Rating (Post Rating), and Thanks and Points for Best Post (Post Thanks) plugins if they are installed and activated.

Note: The initial activation of the WordPress myCRED plugin allows set up for users to earn/have deducted myCRED points for adding or removing Simple:Press forum topics and/or replies as well as myCRED log entry text for these activities. The basic WordPress myCRED set up for Simple:Press topics/replies is accomplished by selecting the “Simple:Press” item under the “Hooks” sub-menu in the admin myCRED menu. Those basic activities are not associated with this plugin.

Plugin Features

Once installed and activated the myCred points to be earned and log template entries for the supported and activated Simple:Press plugins can be set up by selecting the “Hooks” sub-menu entry from the WordPress admin “myCRED” menu item provided when the WordPress “myCRED” plugin was activated.

  • This plugin’s activation results in the new entry “Simple:Press Extensions” being added in the “Hooks” sub-menu.
  • Opening the “Simple:Press Extension” provides the panel where the points and log text for the supported and activated Simple:Press plugins can be set up. Default values are supplied for each supported plugin when the plugin is activated.

There are no new top level Forum Admin menu items nor Forum Admin panels associated with adding this plugin.

A Forum/Plugin/Available Plugins sub-menu item “myCred Extended Integration” is added for this plugin’s activation, deactivation, deletion, uninstall, and a link to the WordPress “MyCredHooks” page where criteria for the supported and activated Simple:Press plugins can be set up.

Plugin Requirements

The WordPress myCRED plugin is required and must first be downloaded, installed, activated, and set up. Upon its activation a new Admin menu item named “myCRED” is added. Please see WordPress page myCRED for WordPress for more information.

Simple:Press version 5.5.7 and above is required.

The Simple:Press plugin must be installed and activated before it is operational.

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

There are no Options to be set through the Simple:Press plugin. The myCRED set up for the supported and activated Simple:Press plugins can be accessed by selecting “MyCred Hooks” from the selections immediately above to activate the link to the WordPress myCRED Hooks page.

  • A supported plugin must be installed and activated for its myCRED parameters to be shown.
  • Defaults for each of the supported and activated Simple:Press plugins are provided there.
  • The defaults can be changed.

One (1) of the two (2) plugin’s template tags, PostIndexMyCred, is conditionally included in all current themes. If the default positions and layouts are acceptable for this template tag and the other template tag, sp_MyCred, is not going to be used, nothing need be done. If the sp_MyCred template tag is going to be added into a theme, it is suggested that it be added conditionally as shown in its example so that the forum page will not crash if the MyCred Integration plugin is deactivated or removed. If any template tag changes are going to be made, it is recommended that a Child or Custom Theme is created incorporating the changes first before installing this plugin. Information on creating and installing themes is located on our Creating a Custom Theme page.

Plugin Installation and Activation

Please see Using Plugins on how to obtain and install the Simple:Press myCred Integration plugin.

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” and then “Plugins” from the drop down Forum Admin menu. On the Simple:Press Administration panel select the “myCred Extended Integration” plugin on the “Plugin Management” panel and click on “Activate”. The “Activate/Delete” label changes to “Deactivate/Uninstall/MyCred Hooks”. To deactivate the plugin, click on “Deactivate”. The “Deactivate/Uninstall/MyCred Hooks” label changes to “Activate/Delete”.

Plugin Administrative Options

There are no Administrative Options associated with this Simple:Press plugin.

There are no new permissions associated with this Simple:Press plugin that need to be set.

All myCred Administrative Options are set up under the WordPress myCRED plugin using the Admin “myCRED” menu item. Please see WordPress page myCRED for WordPress for more information.

  • Simple:Press Plugins Supported
    • Note: Before the myCRED parameters are available through the admin menu at myCRED/Hooks/Simple:Press Extensions for a supported plugin, the plugin must be installed, activated, and set up. Deactivating the supported plugin removes its parameters from the choices.
    • The following Simple:Press plugins are supported by the WordPress myCRED and Simple:Press myCred plugins:
  • Accessing parameters for supported and activated Simple:Press plugins
    • After one of the supported Simple:Press plugins is installed, activated, and set up, its myCRED parameters can be set up or changed by either:
      • Going to the admin menu entry myCRED/Hooks and selecting “Simple:Press Extensions” to show parameters for all supported and activated Simple:Press plugins. Find the parameters associated with the Simple:Press plugin of interest and change their values as desired.
      • Going to the admin menu entry Forum/Plugins/Available Plugins, clicking on “MyCred Hooks” under “myCred Extended Integration” section to go to the myCRED Hooks page and select “Simple:Press Extensions” to show parameters for all supported and activated Simple:Press plugins. Find the parameters associated with the Simple:Press plugin of interest and change their values as desired.

Plugin Language Translation

A plugin’s message strings can be translated from English to other languages and then the translation displayed if language translation files are available. Some plugins may not have such files.

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

More information is available regarding translation files at Simple:Press Translations. 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.

The myCred Integration plugin’s available language translation files with translation statistics, and message translations can be viewed at MyCred Integration Translations. Select the Version link to see the languages available. Select the link for the desired language to see forum messages and their available translations. If available, export the file for the selected language to its proper forum language sub-folder as a “mo” file using the export link at the bottom of the page displaying the actual message translations for the language selected.

The default location for Simple:Press plugin language files is …/wp-content/sp-resources/forum-language/sp-plugins. If this path is changed, it is important to note that the plugin’s language file needs to reside in the language sub-folder for sp plugins wherever it has been moved and however it has been renamed. See Storage Locations for more information.

Plugin Usage

Forum users, please see the WordPress page myCRED for WordPress for any available information on viewing myCRED information in forum Topic View post entries and myCRED history as a selection under “Profile” in the site Dashboard menu.

Admins, please see the WordPress page myCRED for WordPress for any available information on initial set up of the WordPress myCRED plugin as well as setting up myCRED log entries, Hooks, Add-ons, Ranks, viewing and changing settings, and viewing myCRED totals and Rank on admin User panels.

  • MyCRED parameters for the supported Simple:Press plugins are controlled through the Admin menu at myCRED/Hooks/Simple:Press Extensions. Be sure to check the “Enable” box on the panel.
  • Note: MyCRED parameters governing basic Simple:Press forum topic/reply posts are controlled through the Admin menu at myCRED/Hooks/Simple:Press. Be sure to check the “Enable” box on the panel.

Plugin Special Notes

This Simple:Press plugin required that the WordPress “myCRED” plugin is installed, activated, and set up first. The support for a supported Simple:Press plugins will not be available until that Simple:Press plugin is installed, activated, and set up. A Custom or Child theme should be developed before this plugin is installed if its template tags are to be modified.

Template Tags Used in the Plugin

There are two (2) Template Tags available for this plugin that allows the admin to further customize it’s usage or otherwise customize the website. The Template Tag can be viewed by selecting its link below.

Actions and Hooks Used in the Plugin

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

There are other Actions and Hooks available for this plugin.

  • apply_filters(‘add_sp_mycred_extension’, $this->defaults)- Allows incorporation of a supported plugin’s parameters to the “Simple:Press Extension” item of the Admin menu under myCRED/Hooks where myCRED parameters for supported Simple:Press plugins are controlled. Used in file sp-mycred-component-class.php.
  • apply_filters(‘sanitise_sp_mycred_extension’, $new_data, $data, $this) – Allows incorporation of a supported plugin’s defaults for its parameters if any field associated with that plugin is left empty in the “Simple:Press Extension” panel. Used in file sp-mycred-component-class.php.
  • do_action(‘prefs_sp_mycred_extension’, $this) – Hook fired to display the myCRED parameter values for the supported and activated Simple:Press plugins when myCRED/Hooks/Simple:Press Extension panel is displayed. If no supported plugins  are activated, “No supported Simple:Press plugins currently active” is displayed  . Used in file sp-mycred-component-class.php.

Plugin and Template Tag Changelog

Since Simple:Press version 5.4.2

Codex page sync’d to code version 5.5.2.



Individual Template Tags

The two (2) Template Tags available for Plugin: MyCred Integration are detailed below.


 

sp_MyCred

Description

sp_MyCred() – Displays a User’s myCRED earned credit information.

Usage

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

Arguments

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

‘tagID’: CSS ID for the Div.
‘tagClass’: CSS Class for the Div.
‘icon’: Filename of file used for the “MyCred” icon.
‘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 – ID of user whose myCred parameters are to be displayed.
Type:
(string) (optional)
Default:
None
Note: For a currently logged in user (or guest) leave $userid blank. For a specific user, pass the $userid.

$ToolTip – Text shown when hovering over the icon.
Type:
(string) (optional)
Default:
None

Special Notes

This function is supplied in the members’ myCred Integration plugin, but is not supplied in themes. If the sp_MyCred template tag is going to be added into a theme, it is suggested that it be added conditionally as shown in its example so that the forum page will not crash if the MyCred Integration plugin is deactivated or removed.  This template tag can be used anywhere in themes, but it is strongly suggested that a Custom or Child Theme be made to contain it.

Examples

In the horizontal center of the Group View header, display the MyCred icon and the logged in user’s total MyCred points with “My Credits” being shown when hovering the cursor over the icon. Make displaying the MyCred information conditional so that the webpage will not crash if the Simple:Press MyCred Extended Integration plugin is removed or deactivated.

if (function_exists('sp_MyCred')) sp_MyCred('tagClass=spMyCred spCenter', '', __sp('My Credits'));

is added to Custom or Child theme’s spGroupView.php file in the ‘groupHeader’ section to have:

sp_GroupOpenClose('tagClass=spIcon spRight&default=open', 'Open forum listing', 'Close forum listing');
sp_GroupHeaderRSSButton('tagClass=spLink spRight&iconClass=spIcon spRight', '', __sp('Subscribe to the RSS feed for this forum group'));
if (function_exists('sp_MyCred')) sp_MyCred('tagClass=spMyCred spCenter', '', __sp('My Credits'));

 

Actions and Hooks Used in the sp_MyCred Template Tag

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

Description

sp_PostIndexMyCred() – Displays MyCred Information in Topic View.

Usage

sp_TopicTagsList($args=”, $label=”, $toolTip=”);

Arguments

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

‘tagID’: CSS ID for the Div. %ID% contains the post ID.
‘tagClass’: CSS Class for the Div.
‘icon’: Filename of file used for ‘MyCred” icon.
‘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.

$label – Text shown with the icon.
Type:
(string) (optional)
Default:
None

$toolTip – Text shown when hovering over the icon.
Type:
(string) (optional)
Default:
None

Special Notes

This function is supplied in the members’ MyCred Integration plugin. It needs to be used in the post loop in the Topic View file, spTopicView.php, of themes. It is valid for each post/user combination.

Examples

For each post display the credits earned along with label “MyCred” next to MyCred icon and “MyCred” when hovering over the icon with the cursor.

sp_PostIndexMyCred('tagClass=spPostUserMyCred spCenter', __sp('MyCred'), __sp('myCred'));

 

Actions and Hooks Used in the sp_PostIndexMyCred Template Tag

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