Setting Venue and Organizer sub-fields as required

Home Forums Calendar Products Community Events Setting Venue and Organizer sub-fields as required

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1017756
    Sean
    Participant

    Hi. We were following your guide for customizing the required fields for Community Events’ Submit an Event form and wanted to make a few Venue and Organizer sub-fields required. These include: Venue Address, Venue City, Venue State, Venue Zip Code, Organizer Email.

    However, we noticed in the forums that there might be some existing bugs with setting required fields.

    So, with that said:
    1) Is the code in your Required fields for events submission form guide still valid? (Looks like it hasn’t been updated since January)
    2) Are there any existing bugs that prohibit us from setting any of the standard fields or Venue/Organizer sub-fields as required? If so, are fixes set to be included in the 4.0 release?
    2) If there are no existing bugs, can you please confirm which Venue and Organizer sub-fields we can set as required fields?

    Thank you.

    #1017980
    Nico
    Member

    Howdy Karly,

    Welcome to our support forums and thanks for reaching out to us! Thanks also for searching the forums before posting ๐Ÿ™‚

    As you point out there seems to be some issues with the snippets provided in the article, which I’ll flag for review.

    Looks like Brian already helped a customer out on this, Can you tried the code they have put together here: https://theeventscalendar.com/support/forums/topic/make-organizer-email-required/#dl_post-1007511 ?

    Please let me know if that works for you as well,
    Best,
    Nico

    #1018646
    Sean
    Participant

    Hi Nico,

    Thank you for bringing that topic to my attention. I tried Brian’s code but am receiving the following error:

    Warning: Invalid argument supplied for foreach() in …/functions.php on line 58

    I’ve copied Brian’s code for that filter exactly, so I’m not sure why that error is appearing:

    add_filter( 'tribe_events_community_required_fields', 'tribe_community_required_fields_org_email', 10, 1 ); 
     
    function tribe_community_required_fields_org_email( $fields ) {
          
        $required_email = $_POST['organizer']['Email'];
          
        foreach( $required_email as $email) {
            if ( empty( $email ) )
                $fields[] = 'Organizer Email';
        }
          
        return $fields;
    }

    Please advise.

    #1019222
    Nico
    Member

    Hi Karly,

    Thanks for letting me know! I trusted the snippet worked. I’ve made a slight modification and it seems to be working for me know:


    add_filter( 'tribe_events_community_required_fields', 'tribe_community_required_fields_org_email', 10, 1 );

    function tribe_community_required_fields_org_email( $fields ) {

    if ( isset( $_POST['organizer']['Email'] ) ) {
    $required_email = $_POST['organizer']['Email'];

    foreach( $required_email as $email) {
    if ( empty( $email ) )
    $fields[] = 'Organizer Email';
    }
    }

    return $fields;
    }

    Please give it another try and let me know,
    Best,
    Nico

    #1019256
    Sean
    Participant

    Thank you very much Nico. That works for me too!

    #1019772
    Nico
    Member

    Hey Karly,

    Thanks for confirming this ๐Ÿ™‚ Glad to hear this is sorted now!

    Iโ€™ll go ahead and close out this thread, but if you need help with anything else please donโ€™t hesitate to create a new one and we will be happy to assist you.

    Best,
    Nico

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Setting Venue and Organizer sub-fields as required’ is closed to new replies.