Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vince844/980904182e98cd1519f96dc1b655db71 to your computer and use it in GitHub Desktop.
Save vince844/980904182e98cd1519f96dc1b655db71 to your computer and use it in GitHub Desktop.
MyCred update user points on Gravity Form submission
add_action( 'gform_after_submission_1', 'karibusana_update_mycred_user_balance', 10, 2 ); // Change 1 with the form ID
function karibusana_update_mycred_user_balance ($entry, $form) {
// Change 23 to the ID of the form field you want
$orderID = rgar($entry, '23');
$user_id = get_current_user_id();
// switch to mycred_add if you want to add points instead of subtract
if (function_exists('mycred_subtract')) {
mycred_subtract(
'Riduzione punti per invio form',
$user_id,
$orderID,
'Totale Punti: ' . $orderID
);
}
}
@shahalaanjum
Copy link

this function is not subtracting the balance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment