mycred_transfer_render

Codex / / Functions / mycred_transfer_render

Navigation:

  1. Description
  2. Usage
  3. Parameters
  4. Examples
  5. Return

Description

Returns the Transfer form, allowing users to send creds to each other. Used by the mycred_transfer shortcode.

Important! If transfer is possible, this function will call on the ajax script and styling under wp_footer. If you want to use this function after that wp_footer has fired you will need to include these scripts and styles manually.

 

Usage

<?php echo mycred_transfer_render( $attr, $content ); ?>

 

Parameters

  • attr (array)
    Shortcode attributes. See the mycred_transfer shortcode for more information.
  • content (string)
    Optional content to insert inside the wrapper.

 

Examples

Example 1: Default usage.

<?php echo mycred_transfer_render(); ?>

Example 2: Show users balance in form.

<?php echo mycred_transfer_render( array( 'show_balance' => 1 ) ); ?>

Example 3: Automatically insert a form after the post’s content allowing transfers to the post author. Note, this example would need to be placed inside the loop!

<?php
$user_id = get_the_author_meta( 'ID' );
echo mycred_transfer_render( array( 'pay_to' => $user_id, 'show_balance' => 1 ) );
?>

You could also use the do_shortcode() function:

<?php
$user_id = get_the_author_meta( 'ID' );
echo do_shortcode( '[mycred_transfer pay_to="' . $user_id . '" show_balance="1"]' );
?>

 

Return

Returns the transfer form.

Last edited July 2, 2014