• 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 manoodin.
    • This topic was modified 5 years, 4 months ago by manoodin.
    • This topic was modified 5 years, 4 months ago by manoodin.
    • This topic was modified 5 years, 4 months ago by manoodin.
    • This topic was modified 5 years, 4 months ago by manoodin.
    • This topic was modified 5 years, 4 months ago by manoodin.
    • This topic was modified 5 years, 4 months ago by manoodin.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator bcworkz

    (@bcworkz)

    It’s not clear what your question is. You can manage what terms are listed in a post edit screen meta box with the “pre_get_terms” action. The callback you posted is not appropriate for this action. The terms list table object has a number of hooks you can use to alter the table, but again, your callback is not appropriate. Writing a callback function out of context, then looking for a hook to apply it to is doing it backwards. Find hooks that let you do something, then write a callback to handle that specific hook.

    Thread Starter manoodin

    (@manoodin)

    My field and for content Form 7. I wanted only one user can choose the same term of the taxonomy series

    Moderator bcworkz

    (@bcworkz)

    You can keep track of which user owns which tag through a term meta field. Limit which terms the user sees through the “pre_get_terms” action, setting the meta_key and meta_value query vars to appropriate values. If you have more complex meta data requirements, use the “meta_query” query var instead.

    Save the current user into term meta when a new term is added with the “create_{$taxonomy}” action, where $taxonomy is the slug for your taxonomy. Despite the name, this fires for new terms, not new taxonomies.

    Thread Starter manoodin

    (@manoodin)

    And very complicated for me to understand. Could you do it for me?

    Moderator bcworkz

    (@bcworkz)

    Yes, it’s somewhat complicated, which equals somewhat time consuming, so I cannot help you with the code, sorry. You might consider hiring an expert through jobs.wordpress.net or jetpack.pro or a local WP meetup (but not through these forums, it’s against our guidelines). While it’s somewhat time consuming to do as a freebie, it shouldn’t be all that expensive to hire a pro. It’s not that complicated for an expert.

    Thread Starter manoodin

    (@manoodin)

    • This reply was modified 5 years, 4 months ago by manoodin.
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.