Post Foursquare Mayor on your Site

Posted on by


UPDATE: AUGUST 2011 – It does still work. I’ve created a test page on my server, click here.

Continuing my education with Social Media API integrations I’ve created a small script to just show the Mayor of your Foursquare Venue. In the image to the right you will see the script working on the Cafe Alma sidebar.

This Gist will only output the text “The Current Mayor is” , the User Image at 25px and the User Name at 18px Bold. Feel free to wrap it in a div of your liking and style it.

YOU WILL NEED A FOURSQUARE OAUTH TOKEN – https://foursquare.com/oauth/
It also has been approved as a MODx Extra – http://modx.com/extras/package/foursquaremayorpost

  • Martin Koekenberg

    Hello,

    This script only displays a text: the current mayor is

    Is this script also working with the new api?

    Martin koekenberg

  • http://www.stpetersburgwebdesigner.com dubROD

    Hi Martin, I appreciate the feedback. I just update the post with a link to a sandbox page so you can always check it. Yes, it is currently working. Did you change Foursquare Oath Token?

  • JB

    Hello,

    thanks a lot for the post, this is what I’m looking for.
    But like Martin, it doesn’t work. I created a oauth token by registering the api, but still it seems I have a Json issue (Trying to get property of non-object in XXX/index.php on line 30, etc.)

    Maybe I’m doing something wrong, or did it simply stop working ?

    Thanks a lot for your feedback.

  • http://www.stpetersburgwebdesigner.com dubROD

    Hey JB. Sorry its not working for you. My test page linked up top is still working. If you want to email me your file ill look at it. email info@ this .com

  • JB

    Hello,

    I will send you an email, ’cause I spent a few days trying to find a way, but I still get a json problem.
    Thanks a lot for your help though.

    JB

  • JB

    Just to let you know, I finally found a way to make it work.
    I had to change the CURLOPT_URL with this one :

    https://api.foursquare.com/v2/venues/_HERE_V2_ID_OF_THE_VENUE_?client_id=_CLIENT_ID_&client_secret=_CLIENT_SECRET_

    thanks a lot for your script that helped me a lot, also to display other infos, such as number of checkins of the actual mayor ($checkins = $json->response->venue->mayor->count;) etc etc.

    Again thanks a lot, and hope the reply can help others.

    R.
    JB

  • http://www.stpetersburgwebdesigner.com dubROD

    Glad you got it to work. ya i probably should do another post with this b/c you can pull every bit of data from foursquare with it. Maybe this weekend.

  • Martin

    Hello,

    I’ve stil a problem with this script.
    No info is recieved.
    Do I have to use a client secret?
    And a long venue id?

  • http://www.facebook.com/mkoekenberg Martin Koekenberg

    Foursquare uses a new format of their Spot ID / venue ID. How is that working with this script. How can I create a OATH Token. it seems that is also changed.