Okay
  Public Ticket #2592705
Remove New Organizer button from Front End
Closed

Comments

  •  1
    intel started the conversation

    Dear Zhivko

    is it possible to remove button +New Organizer from front end? 

    I don't want that other user can add new organizer, but instead need to choose predefined. 

    Best Regards

    Dzemal

  •  894
    Zhivko replied

    Hi,

    Well, you could do it like you've done it now via css display none.

    Additionally you could add server side check just in case someone unblock the button.

    Place the code in your theme or child-theme functions.php file:

    add_action('init', function() {
        function disable_new_organizers() {
            if ('insert_new_organizer' === filter_input(INPUT_POST, 'task')) {
                echo wp_json_encode(array(
                    'error'     => 1,
                    'error_msg' => 'New organizers are not permitted',
                    'data'      => []
                ));
                exit;
            }
        }     add_action("wp_ajax_nopriv_stec_public_ajax_action", function() {
            disable_new_organizers();
        }, 1);     add_action("wp_ajax_stec_public_ajax_action", function() {
            disable_new_organizers();
        }, 1);
        
    });

    This will prevent adding new organizers from the front-end.



    Stachethemes Developer