Giter Site home page Giter Site logo

Comments (7)

MacKisco avatar MacKisco commented on June 4, 2024 1

This solution doesn't work either.
But, if I just comment the following line, it works (without your two new INIT lines):
$r[$start_at]['place'] = '';

Maybe because it's initialized as a String and then we try to put an array inside...
So if it still works in your version, it's a good solution good for me. Thank you

from grav-plugin-facebook.

 avatar commented on June 4, 2024 1

I had the same issue when I first starting using this. I believe it's caused by not having a place specified for the event. For example, if you're doing events at various locations (like a band or speaker) you'll always add the place. In my case I'm trying to show events happening at a single location (a bar or restaurant), they never need to add a location because all their events happen at their establishment. I'm not sure if it's the setting itself, or if it's because they're set to be the same - but it's something with that particular scenario.

Commenting out the place call in facebook.php solves it - code below. I'm looking at this thread today because I'm updating and I have to update this code every time I update the plugin. Even if this doesn't have a quick solution, Is it possible to override facebook.php? Just curious, everything else works beautifully, great job, love this plugin.

Comment out lines 273 to 285:

if (property_exists($val, 'place')) {
    if (property_exists($val->place, 'name')) {
        $r[$start_at]['place']['name'] = $val->place->name;
    }
    if (property_exists($val->place, 'location')) {
        $city = '';
        $country = '';
        if (property_exists($val->place->location, 'city')) $city = $val->place->location->city;
        if (property_exists($val->place->location, 'country')) $country = $val->place->location->country;
        $r[$start_at]['place']['location'] = $city.' '.$country;
    }
}   

from grav-plugin-facebook.

mikahanninen avatar mikahanninen commented on June 4, 2024

I will get back to this probably on the next weekend.

from grav-plugin-facebook.

mikahanninen avatar mikahanninen commented on June 4, 2024

I couldn't reproduce your problem but I added checks to that code. Check if release 1.7.0 works better for you.

from grav-plugin-facebook.

MacKisco avatar MacKisco commented on June 4, 2024

I've got the same error with 1.7.0 after cache clean.

I was able to make it work with the following change (from line 175):

if (property_exists($val, 'place')) { $r[$start_at]['place_name'] = $val->place->name; if (property_exists($val->place, 'location')) { $r[$start_at]['place_location'] = $val->place->location; } }

And of course I used "place_name" in my template facebook.event.html.twig.

from grav-plugin-facebook.

mikahanninen avatar mikahanninen commented on June 4, 2024

I would like to understand the reason of this error... it is probably initialization was missing for those 2 keys. Could you try clean plugin code and just add these 2 lines. I can't understand why I am not getting error you are getting - probably something to do with PHP versions, module versions etc..

            $r[$start_at]['event_link'] = $val->id;
            $r[$start_at]['name'] = nl2br($val->name);
            $r[$start_at]['place'] = '';
            $r[$start_at]['description'] = '';
            $r[$start_at]['cover'] = '';
            $r[$start_at]['place']['name'] = '';    // INIT 'name'
            $r[$start_at]['place']['location'] = ''; // INIT 'location'

from grav-plugin-facebook.

bzx avatar bzx commented on June 4, 2024

@cpfeifer Had the same exact issue, even though the events I was fetching do have location set (to the venue they're happening in). I commented the lines from your post and it works perfectly. Thanks!

from grav-plugin-facebook.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.