0

Ajax Event Calendar plugin is no longer update, but I receive this error.

PHP Warning: Declaration of aec_contributor_list::form() should be compatible with WP_Widget::form($instance) in /home/soso2358/public_html/wp-content/plugins/ajax-event-calendar/inc/widget-contributors.php on line 64

Below is the code for widget-contributors.php

<?php
class aec_contributor_list extends WP_Widget {

    function aec_contributor_list () {
        $widget_ops = array('description' => __('A list of calendar contributors linked to their organization websites', AEC_NAME));
        parent::WP_Widget(false, __('AEC Contributors', AEC_NAME), $widget_ops);
    }
    
    function widget ($args, $instance) {
        extract($args);
        $contributors = $this->db_query_users_by_role('calendar_contributor');
        echo $before_widget;
        $conts = sizeof($contributors);
        echo $before_title . sprintf(_n('(%d) Contributor','(%d) Contributors', $conts, AEC_NAME), $conts) . $after_title;
        if ($contributors) {
            echo '<ul>';
            foreach ($contributors as $contributor){
                $user = get_userdata($contributor);
                echo '<li><a href="' . $user->user_url . '" target="_blank">' .  $user->organization . '</a></li>';
            }
        }else{
            _e('No contributors as of yet.', AEC_NAME);
        }
        echo '</ul>';
        echo $after_widget;
    }

    function db_query_users_by_role ($roles) {
        global $wpdb;
        if (!is_array($roles)) {
            $roles = explode(",", $roles);
            array_walk($roles, 'trim');
        }
        $sql = '
            SELECT  ID, display_name
            FROM    ' . $wpdb->users . ' INNER JOIN ' . $wpdb->usermeta . '
            ON      ' . $wpdb->users . '.ID =       ' . $wpdb->usermeta . '.user_id
            WHERE   ' . $wpdb->usermeta . '.meta_key =  \'' . $wpdb->prefix . 'capabilities\'
            AND     (
        ';
        $i = 1;
        foreach ($roles as $role) {
            $sql .= ' ' . $wpdb->usermeta . '.meta_value    LIKE    \'%"' . $role . '"%\' ';
            if ($i < count($roles)) {
                $sql .= ' OR ';
            }
            $i++;
        }
        $sql .= ') ';
        $sql .= ' ORDER BY display_name ';
        $userIDs = $wpdb->get_col($sql);
        return $userIDs;
    }

    
    /** @see WP_Widget::form */
    function form () {              
        _e('No options available.', AEC_NAME);
    }
}
add_action('widgets_init', create_function('', 'return register_widget("aec_contributor_list");'));
?>

1 Answer 1

1

WP_Widget::form() expects to receive an array as a parameter, but the plugin's form() function doesn't have it.

You can probably fix it like this:

/** @see WP_Widget::form */
function form ( $instance ) {              
    _e('No options available.', AEC_NAME);
}

Be aware, though, that if the plugin's not supported by its developers anymore, there won't be any security updates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.