Home › Forums › Calendar Products › Events Calendar PRO › Same Issue as: code deprecated in Functions.php
- This topic has 6 replies, 2 voices, and was last updated 6 years, 10 months ago by Robert Safran.
-
AuthorPosts
-
June 12, 2017 at 8:34 pm #1296972Robert SafranParticipant
I updated to release 4.5.4 of the The Events Calendar and version 4.4.10 of The Events Calendar Pro in preparation for the WordPress 4.8 version that flywheel is forcing on me by June 22nd. I’m getting errors:
Notice: Undefined variable: event in /www/wp-content/themes/sharewisdom/functions.php on line 1388 Notice: /www/wp-content/plugins/the-events-calendar/src/deprecated/TribeEvents.php is deprecated since version 3.10! Use Tribe__Events__Main instead. in /www/wp-includes/functions.php on line 3959
Any help appreciated.
Thanks…June 13, 2017 at 8:26 am #1297199Robert SafranParticipantI updated all occurrences of TribeEvents in my custom functions.php file with Tribe__Events__Main and it didn’t make any difference. Not sure what else I can do.
Here’s the function that includes line 1388 which is the if ($event ) {
function episode_cat_sb() {
ob_start();
$event_cat_ids = array();
if ( $event ) {
$event_cats = wp_get_object_terms( $event->ID, Tribe__Events__Main::TAXONOMY );
foreach ( $event_cats as $event_cat ) {
$event_cat_ids[] = $event_cat->term_id;
}
} else {
$event_cats = array();
}
$args = array(
‘hide_empty’ => false,
‘orderby’ => ‘name’,
‘order’ => ‘ASC’,
‘exclude’ => $event_cat_ids,
);$cats = get_terms( TribeEvents::TAXONOMY, $args );
$cats = array_merge( $event_cats, $cats );
$cats = apply_filters( ‘tribe_community_events_event_categories’, $cats );echo ‘<div class=”sidebar_episode_categories_list”>’;
foreach ($cats as $cat) {
echo ‘<div class=”sidebar_episode”><a href=”‘;
echo home_url();
echo ‘/episodes/category/’.esc_attr($cat->slug).’/?tribe_paged=1&tribe_event_display=past”‘;
echo ‘>’.esc_attr($cat->slug).’</div>’; }echo ‘</div>’;
return ob_get_clean();
}
June 13, 2017 at 10:47 pm #1297640Robert SafranParticipantMy wonderful web developer resolved all the issues in our functions.php file. All is working now on WordPress 4.8.
June 14, 2017 at 2:10 pm #1298126AndrasKeymasterRobert, that is great to hear! Sounds like you have an awesome developer at hand, congrats!
Could you share what was the solution he implemented? It might be useful for others searching the forum.
Thanks and cheers,
AndrasJune 14, 2017 at 3:22 pm #1298159Robert SafranParticipantThis second functions snippet contains the modifications from my developer.
/*Original function*/
function episode_cat_sb() {
ob_start();
$event_cat_ids = array();
if ( $event ) {
$event_cats = wp_get_object_terms( $event->ID, TribeEvents::TAXONOMY );
foreach ( $event_cats as $event_cat ) {
$event_cat_ids[] = $event_cat->term_id;
}
} else {
$event_cats = array();
}
$args = array(
‘hide_empty’ => false,
‘orderby’ => ‘name’,
‘order’ => ‘ASC’,
‘exclude’ => $event_cat_ids,
);$cats = get_terms( TribeEvents::TAXONOMY, $args );
$cats = array_merge( $event_cats, $cats );
$cats = apply_filters( ‘tribe_community_events_event_categories’, $cats );echo ‘<div class=”sidebar_episode_categories_list”>’;
foreach ($cats as $cat) {
echo ‘<div class=”sidebar_episode”><a href=”‘;
echo home_url();
echo ‘/episodes/category/’.esc_attr($cat->slug).’/?tribe_paged=1&tribe_event_display=past”‘;
echo ‘>’.esc_attr($cat->slug).’</div>’; }echo ‘</div>’;
return ob_get_clean();
}
/*The new working function*/
function episode_cat_sb() {
ob_start();
$event_cat_ids = array();
$event = array();
if ( $event ) {
$event_cats = wp_get_object_terms( $event->ID, Tribe__Events__Main::TAXONOMY );
foreach ( $event_cats as $event_cat ) {
$event_cat_ids[] = $event_cat->term_id;
}
} else {
$event_cats = array();
}
$args = array(
‘hide_empty’ => false,
‘orderby’ => ‘name’,
‘order’ => ‘ASC’,
‘exclude’ => $event_cat_ids,
);$cats = get_terms( Tribe__Events__Main::TAXONOMY, $args );
$cats = array_merge( $event_cats, $cats );
$cats = apply_filters( ‘tribe_community_events_event_categories’, $cats );echo ‘<div class=”sidebar_episode_categories_list”>’;
foreach ($cats as $cat) {
echo ‘<div class=”sidebar_episode”><a href=”‘;
echo home_url();
echo ‘/episodes/category/’.esc_attr($cat->slug).’/?tribe_paged=1&tribe_event_display=past”‘;
echo ‘>’.esc_attr($cat->slug).’</div>’; }echo ‘</div>’;
return ob_get_clean();
}
June 15, 2017 at 3:05 pm #1298828AndrasKeymasterAwesome Robert, thanks a lot for sharing!
Since the issue is resolved I am going to close this ticket, but if you need anything else related to this topic or another please post a new one in the forum and we will be happy to help you out.
Cheers,
AndrasPS: If you like our plugins, and you didn’t yet do so 🙂 we would be happy to receive a review in the wordpress.org repository. Thanks!
https://wordpress.org/support/plugin/the-events-calendar/reviews/PS2: We’d be also grateful if you would give us feedback on your satisfaction with support. Just click on one of the classy looking emojis below. 🙂 If you can spare a few words, that’s even better. Doublethanks!
-
AuthorPosts
- The topic ‘Same Issue as: code deprecated in Functions.php’ is closed to new replies.