Integrate Have other plugins charge or reward virtual credits

Reward Points

do_action("moolamojo_transaction", true, 100, "clicked widget", $user_id, "widgets_table", $widget_id);

Explanation of the parameters:

  1. "moolamojo_transaction" - the name of the action. Don't change this.
  2. true - reward or charge. When true - reward, when false - charge.
  3. 100 - the amout of virtual credits to charge or reward
  4. "clicked widget" - short textual description of the action. Optional
  5. $user_id - the ID of the user performing the action. Optional - when empty, current user will be used.
  6. "widgets_table" - DB table name to create relation. Optional.
  7. $widget_id - DB table record ID to create relation. Optional.

Charge Points

do_action("moolamojo_transaction", false, 50, "downloaded widget", $user_id, "widgets_table", $widget_id);

Explanation of the parameters:

  1. "moolamojo_transaction" - the name of the action. Don't change this.
  2. false - reward or charge. When true - reward, when false - charge.
  3. 50 - the amout of virtual credits to charge or reward
  4. "downloaded widget" - short textual description of the action. Optional
  5. $user_id - the ID of the user performing the action. Optional - when empty, current user will be used.
  6. "widgets_table" - DB table name to create relation. Optional.
  7. $widget_id - DB table record ID to create relation. Optional.

Check User Balance

$balance = get_user_meta($user_id, 'moolamojo_balance', true);

Catch Button Action

add_action('moolamojo-submitted', 'my_custom_action');
			        
function my_custom_action($atts) {
 // do something here
}

The plugin will sent back to your action all the attributes passed to the shortcode so you can use any custom attributes.