Okay
  Public Ticket #3043620
Default Field settings
Closed

Comments

  •  1
    cultivatehub started the conversation

    I'd like to see the ability to set defaults for fields on the backend. For instance, I have things I want to be able to enable for all events but do not want the user to be able to change them. Such as:

    • featured event yes/no
    • counter enabled
    • comments enabled

    Basically if I can set those fields on the backend and have them not show on the front end at all, that would be ideal. 


    Would also love the ability to hide/show pretty much any field/button on the front end submission. Right now I turned several off with CSS but would be great to be able to control that easier with a on/off checkbox. 

    Last thing. Each section should have an ID I can target such as Guest and Schedule. I don't need this enabled at all and if I had an ID I could target that to hide with CSS or the above mentioned toggle switch would work. The ID would also let me control the background and styling a bit which would be very helpful for customizing the sections a bit. 


    Thanks for the great plugin. I'm hoping these features are useful to others as well!

  •  783
    Zhivko replied

    Hi,

    You could use hook for this. Example:

    /**
     * STEC HOOK: Enable comments, counter and flags as featured newly created events
     */ add_action('stec_after_insert_event', function ($result, $event, $is_update) {     if (false === $is_update) {         update_post_meta($event->get_id(), 'comments', 1);
            update_post_meta($event->get_id(), 'counter', 1);
            update_post_meta($event->get_id(), 'featured', 1);
                    wp_update_post(array(
                'ID' => $event->get_id(),
                'comment_status' => 'open'
            ));     } }, 10, 3);

    The hook should be placed in the theme or child-theme functions.php file.

    You can override the default submit form by creating file stec-submit-form.php in your theme or child-theme parent folder. I've attached an example file with the most fields removed.

    You can use the default form found in "stachethemes_event_calendar / view / front / forms / default-submit-form.php" for reference.

    Attached files:  stec-submit-form.zip


    Stachethemes Developer