Support

Home Forums Event Espresso Premium Fatal Error

Fatal Error

Posted: September 27, 2023 at 6:37 am

Viewing 1 reply thread


Amy

September 27, 2023 at 6:37 am

I deactivated all of my plugins to get the Buddy Boss plugin to work properly. Now I’m trying to activate my customization file and I’m getting a fatal error. Maybe something changed with the new EE version?

My versions: 5.0.10.p. – everything else looks updated except WP users – 2.0.19.p and People add-on 1.0.9.p.

Here’s the fatal error:
Fatal error: Cannot redeclare espresso_event_venues() (previously declared in /nas/content/live/aandk/wp-content/plugins/event-espresso-core-reg/public/template_tags.php:1100) in /nas/content/live/aandk/wp-content/plugins/multisite-customizations/multisite-customizations.php on line 153

Line 153 is the start of the EE customization. Everything below 153 is EE customization. Maybe something was renamed?

153 function espresso_event_venues() { }

Here is the full customization file:
<?php
/*
Plugin Name: Multisite Customizations
Description: Customizations for Membership multisite
Version: 1.1
Author: Phil Pilkington
*/

/* set featured image in single events as full width
function ee_set_featured_image_as_background() {
global $post;
if ( ‘espresso_events’ == get_post_type() && ! is_post_type_archive() && has_post_thumbnail() ) {
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘full’ );
echo ‘<style>.entry-content{
background-image: url(‘ . $image[0] . ‘);
background-repeat: no-repeat;
background-size: cover 350px;
-moz-background-size: cover 350px;
}</style>’;
}
}
add_action( ‘wp_head’, ‘ee_set_featured_image_as_background’, 11 );
*/

//* Set Event Espresso to look for the ticket selector template in the espresso templates folder within the uploads folder for WordPress
//* from https://gist.github.com/lorenzocaum/a6610712a59cf29cca58

//* add_filter (‘FHEE__EE_Ticket_Selector__display_ticket_selector__template_path’, ‘ee_custom_ticket_selector_template_location’);

function ee_custom_ticket_selector_template_location(){
return WP_CONTENT_DIR . ‘/uploads/espresso/templates/ticket_selector_chart.template_show_remaining_tickets.php’;
}

/*
Only show the discount code fields if a code is passed in via URL parameter
from https://www.paidmembershipspro.com/hide-the-discount-code-fields/
*/
function my_pmpro_show_discount_code($show)
{
if(empty($_REQUEST[‘discount_code’]))
$show = false;

return $show;
}
add_filter(“pmpro_show_discount_code”, “my_pmpro_show_discount_code”);

/* add new profile fields to user profile – unnecessary to edit from backend so commented

add_action( ‘show_user_profile’, ‘my_show_extra_profile_fields’ );
add_action( ‘edit_user_profile’, ‘my_show_extra_profile_fields’ );

function my_show_extra_profile_fields( $user ) { ?>
<h3>Extra profile information from Theme My Login Customization</h3>
<table class=”form-table”>
<tr>
<th><label for=”twitter”>Twitter</label></th>
<td>
<input type=”text” name=”twitter” id=”twitter” value=”<?php echo esc_attr( get_the_author_meta( ‘twitter’, $user->ID ) ); ?>” class=”regular-text” /><br />
<span class=”description”>Please enter your Twitter username.</span>
</td>
</tr>
</table>
<table class=”form-table”>
<tr>
<th><label for=”cellphone”>Cellphone</label></th>
<td>
<input type=”text” name=”cellphone” id=”cellphone” value=”<?php echo esc_attr( get_the_author_meta( ‘cellphone’, $user->ID ) ); ?>” class=”regular-text” /><br />
<span class=”description”>Please enter your cellphone #.</span>
</td>
</tr>
</table>
<?php
}

add_action( ‘edit_user_profile_update’, ‘my_save_extra_profile_fields’ );
*/
add_action( ‘personal_options_update’, ‘my_save_extra_profile_fields’ );

function my_save_extra_profile_fields( $user_id ) {
if ( !current_user_can( ‘edit_user’, $user_id ) )
return false;

/* pnp default cellphone to bill phone if blank */
if ( $_POST[‘cellphone’] < ‘ 1’ ) {

$wtf = get_user_meta($user_id , ‘pmpro_bphone’);
$_POST[‘cellphone’] = $wtf[0];
}

update_usermeta( $user_id, ‘twitter’, $_POST[‘twitter’] );
update_usermeta( $user_id, ‘cellphone’, $_POST[‘cellphone’] );
update_usermeta( $user_id, ‘facebook’, $_POST[‘facebook’] );
update_usermeta( $user_id, ‘instagram’, $_POST[‘instagram’] );
update_usermeta( $user_id, ‘pinterest’, $_POST[‘pinterest’] );
update_usermeta( $user_id, ‘activities’, $_POST[‘activities’] );
}

/* paid Memberships pro customizations */
/* pnp check to see if the user is assigned to a */
/* non-subscription role that cannot view hidden content */

/* add link to update gravatar to member profile page */
/* https://www.paidmembershipspro.com/tag/user-profiles/ */

function my_pmpro_account_bullets_top_avatar()
{
global $current_user;
echo ‘<li class=”alignright” style=”display: inline-block; list-style: none; margin: -5rem 0 0 0;”>’ . get_avatar($current_user->ID, 200) . ‘‘;
}
add_action(“pmpro_account_bullets_top”,”my_pmpro_account_bullets_top_avatar”);
function my_pmpro_account_bullets_bottom_avatar()
{
global $current_user;
echo ‘

  • ‘ . __(‘Avatar’,’wp’) . ‘: ‘ . __(‘Update at Gravatar.com’,’pmpro’) . ‘
  • ‘;
    }
    add_action(“pmpro_account_bullets_bottom”,”my_pmpro_account_bullets_bottom_avatar”);

    /* display members only message */
    function display_members_only_msg() {
    $html = ‘<i>Members only</i>’ ;
    return $html ;
    }

    function display_protected_content() {

    if ( is_user_logged_in() ) {
    $user = wp_get_current_user();
    $user_role = $user->roles[0]; /* get user roles */
    /* if no role or expired don’t show content, otherwise do show content */
    if ( $user_role == ‘expiredmember’ or $user_role <= ‘ 1’) {
    return False;
    } else {
    return True;
    }
    }
    else { /* show content if first word of estract is ‘Public’ */
    if ( substr(get_the_excerpt(),0,6) == ‘Public’ ) {
    return True;
    } else {
    return False;
    }
    }
    }

    /* END paid Memberships pro customizations */

    /* PNP – EventEspresso Event Venu Date Time Override */
    /* PNP – added if statement to hide event time if user not logged in */

    function espresso_event_venues() { }

    function espresso_list_of_event_dates( $EVT_ID = FALSE, $dt_frmt = ”, $tm_frmt = ”, $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE ) {
    $dt_frmt = ! empty( $dt_frmt ) ? $dt_frmt : get_option(‘date_format’);
    $tm_frmt = ! empty( $tm_frmt ) ? $tm_frmt : get_option(‘time_format’);
    $datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID ,$show_expired );
    //d( $datetimes );
    if ( is_array( $datetimes ) && ! empty( $datetimes )) {
    global $post;
    $html .= ‘<h4>Event Date & Time:</h4>’; /* pnp add event date time title */
    $html .= $format ? ‘<ul id=”ee-event-datetimes-ul-‘ . $post->ID . ‘” class=”ee-event-datetimes-ul”>’ : ”;
    foreach ( $datetimes as $datetime ) {
    if ( $datetime instanceof EE_Datetime ) {
    if ( $format ) {
    $html .= ‘<li id=”ee-event-datetimes-li-‘ . $datetime->ID() . ‘” class=”ee-event-datetimes-li”>’;
    $datetime_name = $datetime->name();
    $html .= ! empty( $datetime_name ) ? ‘‘ . $datetime_name . ‘‘ : ”;
    $html .= ! empty( $datetime_name ) && $add_breaks ? ‘<br />’ : ”;
    $html .= ‘<b>Date:</b> <span class=”dashicons dashicons-calendar”></span>’ . $datetime->date_range( $dt_frmt ) . ”; /* pnp added date text */

    if ( display_protected_content() ) {
    /* PNP add if statement to hide time if user not logged in */
    $html .= ! empty( $datetime_name ) && $add_breaks ? ‘<br />’ : ”;
    $html .= ‘<br /><b>Time:</b> <span class=”dashicons dashicons-clock”></span>’ . $datetime->time_range( $tm_frmt ) ;
    $html .= ‘<br><br>’;
    /* pnp moved display of .ics calendar icon to protected area */
    $datetime_description = $datetime->description();
    $html .= ! empty( $datetime_description ) && $add_breaks ? ‘<br />’ : ”;
    $html .= ! empty( $datetime_description ) ? ‘ – ‘ . $datetime_description : ”;
    $html = apply_filters( ‘FHEE__espresso_list_of_event_dates__datetime_html’, $html, $datetime );
    $html .= ‘ Add to calendar’;
    } else {
    $html .= ‘<br><b>Time:</b> <i>Members Only</i>’;
    }
    $html .= ‘‘;

    } else {
    $html .= $datetime;
    $html = apply_filters( ‘FHEE__espresso_list_of_event_dates__datetime_html’, $html, $datetime );
    }
    }
    }
    $html .= $format ? ‘‘ : ”;
    } else {
    $html = $format ? ‘<p><span class=”dashicons dashicons-marker pink-text”></span>’ . __( ‘There are no upcoming dates for this event.’, ‘event_espresso’ ) . ‘</p><br/>’ : ”;
    }
    if ( $echo ) {
    echo $html;
    } else {
    return $html;
    }
    }
    /* END – PNP – EventEspresso Event Venu Date Time Override */
    ?>


    Tony

    • Support Staff

    September 27, 2023 at 10:55 am

    The issue here is your custom plugin is overriding a core template function (which is expected) but its loading after EE has already declared the function, so throws a fatal.

    I don’t believe the load order within EE has changed here, can you send me a copy of that plugin so I can compare it with a previous version of EE?

    Viewing 1 reply thread

    The support post ‘Fatal Error’ is closed to new replies.

    Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

    Event Espresso