Okay
  Public Ticket #2277124
Require approval by admin... not for all user!
Closed

Comments

  • cnafc started the conversation

    Is it possible to authorize A USER to publish WITHOUT AUTHORIZATION OF THE ADMINISTRATOR on a calendar?

    the events proposed by some users of the front would like them to be published automatically without waiting for the administrator's confirmation

  •  877
    Zhivko replied

    Hi,

    It's possible. However, the user will have to refresh the page to see their event.

    Add this filter in your theme functions.php file:

    add_filter('stec_insert_post', function($data) {
    
        if ($data['post_type'] !== 'stec_event') {
            return $data;
        }     // SET TRUSTED USERS ID (e.g. 1,2,3,4,...)
        $trusted_users_ids = [1,2,3,4,5];     if (in_array(get_current_user_id(), $trusted_users_ids)) {
            $data['meta_input']['approved'] = 1;
        }     return $data;
    });

    Stachethemes Developer