Last active
August 23, 2017 00:05
-
-
Save joshuaiz/b7cfbe4d56220555d397319413feae9e to your computer and use it in GitHub Desktop.
Revisions
-
joshuaiz revised this gist
Aug 23, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ function update_usar_sponsorship_amount($entry, $form) { // get required GF fields $team = rgar( $entry, "14"); // GF radio buttons (select Team to sponsor) $amount = rgar($entry, "2"); // donation amount // query through users @@ -12,7 +12,7 @@ function update_usar_sponsorship_amount($entry, $form) { foreach ( $users as $user ) { $userteam = $user->display_name; $currentAmount = $user->sponsorship_amount; // $amount = $currentAmount + $amount; // this doesn't work because $amount isn't a number // if selected Team name matches user display name, update that user if ( $userteam == $team ) { -
joshuaiz revised this gist
Aug 23, 2017 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,8 +3,8 @@ function update_usar_sponsorship_amount($entry, $form) { // get required GF fields $team = rgar( $entry, "14"); // GF radio button field $amount = rgar($entry, "2"); // donation amount // query through users $users = get_users(); @@ -13,6 +13,8 @@ function update_usar_sponsorship_amount($entry, $form) { $userteam = $user->display_name; $currentAmount = $user->sponsorship_amount; // $amount = $currentAmount + $amount; // this doesn't work // if selected Team name matches user display name, update that user if ( $userteam == $team ) { update_user_meta( $user->ID, 'sponsorship_amount', $amount ); } -
joshuaiz revised this gist
Aug 22, 2017 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ <?php add_action("gform_after_submission_6", "update_usar_sponsorship_amount", 10, 2); function update_usar_sponsorship_amount($entry, $form) { @@ -16,4 +17,6 @@ function update_usar_sponsorship_amount($entry, $form) { update_user_meta( $user->ID, 'sponsorship_amount', $amount ); } } } ?> -
joshuaiz created this gist
Aug 22, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ add_action("gform_after_submission_6", "update_usar_sponsorship_amount", 10, 2); function update_usar_sponsorship_amount($entry, $form) { // get required GF fields $team = rgar( $entry, "14"); $amount = rgar($entry, "2"); // query through users $users = get_users(); // loop through users foreach ( $users as $user ) { $userteam = $user->display_name; $currentAmount = $user->sponsorship_amount; // $amount = $currentAmount + $amount; // this doesn't work if ( $userteam == $team ) { update_user_meta( $user->ID, 'sponsorship_amount', $amount ); } } }