vfree
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
- This reply was modified 8 years, 7 months ago by vfree.
Yes,I understood it already.
For this I had to play, for example, with properties of class .um-member
Check which type of validation you have selected for the youtube video field. Firstly I have the type “website url” and the url sent to the function um_youtube_id_from_url($url) for getting video id wasn`t pure web url, it contains html tags.
So, I created action for custom field validation and put it in function.php:add_action('um_submit_form_errors_hook_','um_custom_validate_youtube_url', 998, 1); function um_custom_validate_youtube_url( $args ) { global $ultimatemember; $pattern = '/^(http(s)?:\/\/)?((w){3}.)?youtu(be|.be)?(\.com)?\/.+/'; $result = preg_match($pattern, $args[video], $matches); if (!$result) { $ultimatemember->form->add_error( 'video', 'This text is not relate to youtube url.' ); } }
Viewing 3 replies - 1 through 3 (of 3 total)