Action Hook, only one user can book the same terms of taxonomy, video series
-
When a user chooses the taxonomy series only one user can choose the term Robin Hood other users can not choose Robin Hood. The action hook has to take the id of the user and put in termmeta.
It has to be in termmeta to be able to put the id of the user in the backend. in the normal page of term.
For the backend I already have a program that already does that.
The terms are placed in the Imput field
On the Backendo the user ID of the terms will be saved in the Term_meta user_ID
add_action('ACTIONHOOKSERIE12', 'funcaoserie12', 10, 3); function funcaoserie12($form_id, $post_id, $form_settings) { $getslugid = wp_get_post_terms($post_id, 'video-series'); $slugs = implode(', ', wp_list_pluck($getslugid, 'slug')); $user_id = get_current_user_id(); $terms = get_the_terms($term_id, 'video-series'); ?> <input class="textfield" id="video-series" type="text" data-required="no" data-type="text" name="video-series" value="<?php echo $slugs ?>" size="40" autocomplete="off"> <?php $idgo = isset($_POST['video-series']); global $wpdb; $option = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM wp_terms WHERE name = '$idgo1'", $id)); echo "$option"; $option1 = $wpdb->get_var($wpdb->prepare("SELECT meta_value FROM wp_termmeta WHERE meta_key = 'wpcf-user-id-in-term' AND term_id = $option", $id)); echo "$option1"; $user_id = get_current_user_id(); echo $user_id; $error = apply_filters('wpuf_add_post_validate', ''); if ($user_id == $option1) { echo 'Nome de Episodios Permitidos'; } else { } }
- This topic was modified 5 years, 4 months ago by .
- This topic was modified 5 years, 4 months ago by .
- This topic was modified 5 years, 4 months ago by .
- This topic was modified 5 years, 4 months ago by .
- This topic was modified 5 years, 4 months ago by .
- This topic was modified 5 years, 4 months ago by .
- This topic was modified 5 years, 4 months ago by .
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Action Hook, only one user can book the same terms of taxonomy, video series’ is closed to new replies.