Last active
November 6, 2025 15:49
-
-
Save Crocoblock/7778d2082588d6af4ebdef4bc713175f to your computer and use it in GitHub Desktop.
JetFormBuilder. Update user meta on the Call a Hook action. Required for the case, when we need refresh user meta on Subscription cycle.
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 characters
| <?php | |
| /** | |
| * Key points: | |
| * - refresh_user_date - hook name for the JetFormBuild Call a Hook action | |
| * - user_date - meta field we need to update | |
| * - DAY_IN_SECONDS - subscription cycle | |
| */ | |
| add_action( 'jet-form-builder/custom-action/refresh_user_date', function( $request ) { | |
| if ( ! empty( $request['user_id'] ) ) { | |
| $new_exp = time() + DAY_IN_SECONDS; | |
| update_user_meta( $request['user_id'], 'user_date', $current_exp ); | |
| } | |
| } ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment