Home › Forums › Calendar Products › Community Events › Add Event Title Filled
- This topic has 9 replies, 2 voices, and was last updated 8 years, 9 months ago by Geoff.
-
AuthorPosts
-
July 21, 2015 at 9:48 am #988499CappyParticipant
Ok, I am stumped again. When I click on add events from the front end, the title is prefilled with “Nov 30, -0001” I tried different accounts, and still the same. It is template related as it doesn’t show on 2015, but I can’t figure out what would cause this.
Thank you!
<!-- Event Title --> <div class="events-community-post-title"> <label class="" for="post_title"></label> <input type="text" value="Nov 30, -0001" name="post_title"></input> </div>
July 21, 2015 at 12:59 pm #988591GeoffMemberHey there, Cappy!
Oh man, that’s definitely not good–sorry for the trouble here.
It’s honestly really hard for us to troubleshoot this sort of thing because it seems directly related to the theme and we’re not exactly sure how the theme was written or built. Would it be possible to reach out to the theme author in this case to see if that gives us a start we can use to troubleshoot further?
Cheers!
GeoffJuly 22, 2015 at 8:47 am #988899CappyParticipantHi Geoff,
Can you tell me what file to look in to find the string that searches for the information to fill that value?
Thank you!
Cappy
July 22, 2015 at 1:52 pm #989077GeoffMemberSure! The template where you can find that call is in the Community Events plugin directory under: /views/community/edit-event.php.
This should what to look for:
<div class="events-community-post-title"> <?php tribe_community_events_field_label( 'post_title', sprintf( __('%s Title:', 'tribe-events-community'), $events_label_singular ) ); ?> <?php tribe_community_events_form_title(); ?> </div><!-- .events-community-post-title -->
Cheers!
GeoffJuly 23, 2015 at 9:12 pm #989761CappyParticipantHi Geoff,
I am completely baffled. I can’t even find Nov 30, -0001 anywhere in the database or the files, so I can’t figure where it might be getting that text from. Do you have any ideas what might cause this?
Thank you,
Cappy
July 24, 2015 at 8:10 am #989922GeoffMemberHi Cappy,
That string may not be contained in the database itself, but generated dynamically by a called function.
Unfortunately, I think this is something the theme author would be better suited to answer. Let me know if any questions come up from the author that we can help answer and I’d be happy to help as best I can.
Thanks,
GeoffJuly 29, 2015 at 7:28 am #991400CappyParticipantHi Geoff,
I hired someone to fix the issue, and he said he found the error in the plugin, not the theme. Here is what he changed. Can you confirm this as an error, or will what he changed cause an issue? Thank you!
[7/29/15, 8:23:13 AM] Richestsoft: public function formTitle( $event = null ) {
$title = get_the_title( $event );
if ( empty( $title ) && ! empty( $_POST[‘post_title’] ) ) {
$title = stripslashes( $_POST[‘post_title’] );
}?>
<input type=”text” name=”post_title” value=”<?php esc_attr_e( $title ); ?>”/>
<?php
}to
public function formTitle( $event = null ) {
if(!empty($event))
{
$title = get_the_title( $event );
}
if ( empty( $title ) && ! empty( $_POST[‘post_title’] ) ) {
$title = stripslashes( $_POST[‘post_title’] );
}?>
<input type=”text” name=”post_title” value=”<?php esc_attr_e( $title ); ?>”/>
<?php
}/the-events-calendar-community-events/src/Tribe/Main.php
public function formTitle( $event = null ) { $title = get_the_title( $event ); if ( empty( $title ) && ! empty( $_POST['post_title'] ) ) { $title = stripslashes( $_POST['post_title'] ); } ?> <input type="text" name="post_title" value="<?php esc_attr_e( $title ); ?>"/> <?php } to public function formTitle( $event = null ) { if(!empty($event)) { $title = get_the_title( $event ); } if ( empty( $title ) && ! empty( $_POST['post_title'] ) ) { $title = stripslashes( $_POST['post_title'] ); } ?> <input type="text" name="post_title" value="<?php esc_attr_e( $title ); ?>"/> <?php }
July 29, 2015 at 7:59 am #991424GeoffMemberHey there, Cappy!
Thanks for the heads up. The template does use get_the_title() here, which is something we’ve used for quite some time and typically returns and empty string on non-posts. I’m super glad that the changes you made fix this specific case where the WP filter the_title is returning a value where it probably should not.
Your solution should not cause an issue for you at all. Just be sure to carry the change forward if and when the plugins update so the work is not lost.
Cheers!
GeoffJuly 29, 2015 at 10:12 am #991498CappyParticipantThanks Geoff! I will make sure to keep the changes handy in case of updates.
Cheers!
Cappy
July 29, 2015 at 2:24 pm #991571GeoffMemberMy pleasure! Happy to be of service and cheers to you as well. 🙂
Geoff
-
AuthorPosts
- The topic ‘Add Event Title Filled’ is closed to new replies.