WordPress.org

Ready to get started?Download WordPress

Forums

Ajax Event Calendar
Getting a Warning in the create event form. (10 posts)

  1. erea77
    Member
    Posted 1 year ago #

    Getting this warning when trying to create an event:

    Warning: Creating default object from empty value in C:\xampp\htdocs\wordpress\wp-content\plugins\ajax-event-calendar\inc\admin-event.php on line 25

    Event may be getting created, but its not showing in the admin or the front-end.

    Has something to do with the event id from looking at the code.

    Help would be greatly appreciated.

    http://wordpress.org/extend/plugins/ajax-event-calendar/

  2. erea77
    Member
    Posted 1 year ago #

    This wouldn't have anything to do with me running this on localhost would it?

  3. erea77
    Member
    Posted 1 year ago #

    You can delete the other posts.

    I they weren't showing up so I didn't think they were being created.

    Sorry

  4. Shylmysten
    Member
    Posted 1 year ago #

    so how did you fix the error? I have the exact same problem. The Calendar in my page isn't showing the event...but the text widget of upcoming events is...

  5. Memphis007
    Member
    Posted 1 year ago #

    This is probably because you're running php > 5.3.1 and it doesn't like using objects before creating them, I had the same issues, I fixed those by editing the following files of the plugin :

    ajax-event-calendar.php
    Line 1028, 1035 and 1039 add :
    $permissions = new stdClass();
    inc/admin-event.php
    Line 25 add :
    $event = new stdClass();

    Done !

  6. sistunix
    Member
    Posted 1 year ago #

    Thanks a lot!

    editing the following files of the plugin :

    ajax-event-calendar.php
    Line 1028, 1035 and 1039 add :
    $permissions = new stdClass();
    inc/admin-event.php
    Line 25 add :
    $event = new stdClass();

    That worked for me too!

  7. etellewyn
    Member
    Posted 1 year ago #

    I am attempting to fix this same error -- Can you please give the full text of the lines of code I am looking for? The lines are coming over double-spaced so I'm not sure if I am looking at the same lines that you are. (For example, there is nothing at line 1028 in my file)

    Would really appreciate a hand, thanks!
    -barbara-

  8. Waltteri Turunen
    Member
    Posted 1 year ago #

    Thanks, Memphis007! Your solution worked for me also!

    @etellewyn:
    Find this function from ajax-event-calendar.php:

    function get_event_permissions($input, $user_id) {
        // users that are not logged-in see all events
        if ($user_id == -1) {
        $permissions->editable = false;
        $permissions->cssclass = '';
        } else {
            // users with aec_manage_events capability can edit all events
            // users with aec_add_events capability can edit events only they create
    	if ($input->user_id == $user_id || $user_id == false) {
    	    $permissions->editable = true;
    	    $permissions->cssclass = '';
    	} else {
    	    $permissions->editable = false;
    	    $permissions->cssclass = ' fc-event-disabled';
    	}
        }
        return $permissions;
    }

    and add these:

    function get_event_permissions($input, $user_id) {
        // users that are not logged-in see all events
        if ($user_id == -1) {
        $permissions = new stdClass(); //<--THIS
        $permissions->editable = false;
        $permissions->cssclass = '';
        } else {
            // users with aec_manage_events capability can edit all events
            // users with aec_add_events capability can edit events only they create
    	if ($input->user_id == $user_id || $user_id == false) {
    	    $permissions = new stdClass(); //<--THIS
                $permissions->editable = true;
    	    $permissions->cssclass = '';
    	} else {
                $permissions = new stdClass(); //<--THIS
    	    $permissions->editable = false;
    	    $permissions->cssclass = ' fc-event-disabled';
    	}
        }
        return $permissions;
    }

    And from the inc/admin-event.php:

    ...snip...
        global $current_user;
        // initialize form for new event
        get_currentuserinfo();	// wp data
        $event->id = '';
    ...snip...
    ...snip...
        global $current_user;
        // initialize form for new event
        get_currentuserinfo();	// wp data
        >$event = new stdClass(); //<--THIS
        $event->id = '';
    ...snip...
  9. etellewyn
    Member
    Posted 1 year ago #

    @TannerMirabel THANK YOU! This was exactly what I needed. Totally fixed the problem!

    Thanks a lot for taking the time to post this!

    most sincerely,
    -barbara-

  10. Gheuntak
    Member
    Posted 1 year ago #

    Thanks a Ton!

    This fixed my problem too...

    All the best

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic