Okay
  Public Ticket #3483637
Custom Field in submit form
Closed

Comments

  •  3
    tourug started the conversation

    I want to add a custom field in the event submit form/ event backend, where people have to choose, if the event is "public" or "private". Like two radio buttons an one has to be choosen, before the event submit form could send. This custom selection should then also be visible in the front-end of the event, so everyone can see, if the event is pubic or private. (If possilbe, the name of the buttons should be "öffentlich" (which is German for "public") and "Nicht öffentlich" (which is german for "private)
    Thank you! really appreciate your great work!

  • %3Ch1%3EMonteTraf%3C%2Fh1%3E replied

    Lol

  •  894
    Zhivko replied

    Hi,

    I'd suggest you to create two categories: Private and Public, set their use permission to "Public" so that anyone can assign them to their events.

    1384119127.png

    Then via the builder insert the category element to your event submission form:

    3150929609.png



    Stachethemes Developer

  •   tourug replied privately
  •  894
    Zhivko replied

    I am afraid no, the event calendar is not visible in the tags like categories do but I will add your request in the upcoming release.


    Stachethemes Developer

  •  3
    tourug replied

    Thank you! Is there a workaround to make this possible until the relase? It doesn´t have to be like the categories,
    it would be ok, if the selected calender name appears in the event layout anywhere... ist there a shortcode to do this? 

  •  894
    Zhivko replied

    Are you familiar with JavaScript?


    Stachethemes Developer

  •  894
    Zhivko replied

    Anyway, this script will add the calendar as a tag.

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

    /**
     * Add calendar tag to event description
     */
    add_action('wp_footer', function () {
    ?>
        <script type="text/javascript">
            window.stecOnEventDescriptionRender = function({
                data,
                element
            }) {
                const appendContainer = element.closest('.stec-content-tabs-content').querySelector('.stec-tags-list');
                const calendarName = data.calendar.title;
                const calendarColor = data.calendar.color;
                const html = `
                    <stec-span class="calendar-tag" style="background-color: ${calendarColor}">
                        ${calendarName}
                    </stec-span>
                `;
                const oldElement = appendContainer.querySelector('.calendar-tag');
                if (oldElement) {
                    oldElement.remove();
                }
                appendContainer.innerHTML = html;
            }
        </script>
    <?php
    });
    

    Stachethemes Developer

  •  3
    tourug replied

    great! thank you so much. perfect and fasst support! 

    Ticket closed