acf_form on Month, Week and Single Views

Home Forums Calendar Products Events Calendar PRO acf_form on Month, Week and Single Views

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1364097
    inhouse
    Participant

    Hello, I’m working on a new feature which embeds an Advanced Custom Fields form (acf_form) for each event on the Month and Week view as well as the event detail page. The form works great on the detail page and Week view but not on the Month view.

    This same acf_form is in Week and Month: (/tribe-events/week/single-event.php, /tribe-events/month/single-event.php)

    
    <div id="tribe-events-event-<?php echo esc_attr( $event_id ); ?>" class="<?php tribe_events_event_classes() ?>" data-tribejson='<?php echo esc_attr( tribe_events_template_data( $post ) ); ?>'>
    	<h3 class="tribe-events-month-event-title <?php echo esc_attr( $event_id ); ?>"><a href="<?php echo esc_url( $link ) ?>" class="url"><?php echo $title ?></a></h3>
    	<?php acf_form(array(
    		//'post_id' => 'new_post',
    		'new_post' => false,
    		'post_title' => false,
    		'post_content' => false,
    		'field_groups' => array(5636),
    		'uploader' => 'basic',
    		'html_submit_spinner' => '<span class="acf-spinner"></span>',
    		'updated_message' => __("Attendance has been updated!", 'acf'),
    		'submit_value' => 'Update'
    	)); ?>
    </div><!-- #tribe-events-event-# -->
    

    I also confirmed that acf_form_head() is present in both views via the default-template.php file.

    I’m not sure what is different about the Month view compared to Week. The form updates a repeater field successfully on the Week view but on the Month view I just get scrolled to the top of the page like an anchor tag. The main difference I see in the 2 single-event.php templates is that in the month/single-event.php the $event_id variable is specified but the week/single-event.php does not.

    
    $day      = tribe_events_get_current_month_day();
    $event_id = "{$post->ID}-{$day['daynum']}";
    $link     = tribe_get_event_link( $post );
    $title    = get_the_title( $post );
    

    I tried specifying ‘post_id’ => $post->ID, and ‘post_id’ => $post, as tests but this didn’t work. Can anyone shine any light on this and let me know what’s different about these 2 templates and what we can do to solve this for the Month view? Any insight is appreciated!

    #1364647
    Victor
    Keymaster

    Hi There!

    Thanks for getting in touch. Let me try to help you with this topic.

    Please, let me first note that we are fairly limited in how much support we can give for custom development questions like this. That said, we always like helping out and at least point users into the right direction as much possible.

    I’m not really sure how the acf_form() function works, but you should be able to obtain the event id by using $post->ID inside the month/single-event.php template file. And if you are able to make it work in the week view, you could compare the output that the acf_form() function gives with the month view to see if any difference.

    The $event_id variable you see specified in the month view is to add the {$post->ID}-{$day[‘daynum’]} to the HTML id attribute for the div container, as you can see in line 196 of the month/single-event.php

    I hope that helps at least a bit. Do feel free to ask any follow up question.

    Best,
    Victor

    #1378061
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘acf_form on Month, Week and Single Views’ is closed to new replies.