Created
February 19, 2024 17:21
-
-
Save gdarko/25d0d8f0bcf776ed25d196bd214bb3c7 to your computer and use it in GitHub Desktop.
WPForms after upload hook.
This file contains 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 | |
/** | |
* Saves uploaded video through WPForms to current user meta. | |
* | |
* @param $hook_data | |
* | |
* What $hook_data contains: | |
* | |
* $hook_data = array( | |
* 'vimeo_title' => $vimeo_title, | |
* 'vimeo_description' => $vimeo_description, | |
* 'vimeo_id' => $vimeo_id, | |
* 'vimeo_size' => $file_size, | |
* 'source' => array( | |
* 'software' => 'WPForms', | |
* 'entry_id' => $entry_id, | |
* 'field_id' => $field_id, | |
* 'form_id' => $form_id, | |
* ), | |
* ); | |
* | |
* @return void | |
*/ | |
function _save_to_user_meta23423423($hook_data) | |
{ | |
if ( ! is_user_logged_in()) { | |
return; | |
} | |
update_user_meta(get_current_user_id(), 'uploaded_video', [ | |
'vimeo_title' => $hook_data['vimeo_title'], | |
'vimeo_description' => $hook_data['vimeo_description'], | |
'vimeo_id' => $hook_data['vimeo_id'] | |
]); | |
} | |
add_action('dgv_frontend_after_upload_wpforms', '_save_to_user_meta23423423'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment