mycred_transfer

Description

This shortcode will generate the transfer form, allowing users to send points to other users. Will not render anything for users that are excluded from myCRED.

User must be logged in to use this shortcode.

Requires the Transfer add-on to be enabled.

Available since version 1.1

Shortcode Attributes

Attribute Type Required Default Description
button string No - The transfer button label.
pay_to int No - Option to pre-select a particular user that should receive all transfers made from this shortcode. If not used, the user would need to nominate the recipient.
placeholder string No - The user field's placeholder text.
show_balance string No 0 Option to show (1) the users current balance under the transfer form or not to show (0).
balance_label string No "Balance" The users balance label (if set to be shown).
show_limit string No 0 Option to show (1) the users remaining transfer limit under the transfer form or not to show (0).
ref string No "transfer" Option to process transfers under a unique reference instead of the default transfer reference.
amount int or float No - Option to pre-set the amount the user must transfer. If not used, the user must nominate the amount.
types string No - The point type(s) users can transfer using this shortcode. By default this will be the point types you have selected to enable for transfers. Can either be a single point type key or a comma separated list of keys.
excluded string No - Message to show for users who are set to be excluded from using the nominated point type.
recipient_label string No "Recipient" The transfer recipient field label.
amount_label string No "Amount" The amount field label.

CSS Styling

// Transfer wrapper
div.mycred-transfer-cred-wrapper { }

// If Login template is used
div.mycred-transfer-cred-wrapper p.mycred-transfer-login { }

// If Insufficient Funds template is used
div.mycred-transfer-cred-wrapper p.mycred-transfer-low { }

// If Over Transfer Limit template is used
div.mycred-transfer-cred-wrapper p.mycred-transfer-over { }

// The transfer Form
form.mycred-transfer {}

// Styling of the jQuery autocomplete dropdown
ul.ui-autocomplete { }
ul.ui-autocomplete li { }
ul.ui-autocomplete li:first-child { }
ul.ui-autocomplete li a { }
ul.ui-autocomplete li:hover { }

Examples

Example 1: Default usage.

[mycred_transfer]

Example 2: Allow transfers of custom point types.

[mycred_transfer types="mycred_default,mypointtype"]

Example 3: All transfers goes to the user with the numeric ID of 1.

[mycred_transfer pay_to=1]

Example 4: Rename transfers to “Donations“ and pre-set transfers to a dedicated user that will collect the donations (example user ID 123)

[mycred_transfer ref="donation" button="Donate" pay_to=123]
Note: In a normal scenario Central Deposit does not get involved when there is a transfer between different users. When the user enables Central Deposit and custom reference shortcode attribute the points are deducted and central account receives a deposit. In order to avoid this situation use the below code snippet.
add_filter( 'mycred_central_banking_ignore', 'ignore_central_deposit', 10 );
function ignore_central_deposit( $arg ){
   // pass ref in this code which has to be ignore
   $arg[] = 'custom_reference';
   return $arg;
}