Support » Plugin: Facebook Events Widget » How do I Use this plugin to get events from a facebook Group Page

  • Resolved mirefoot

    (@mirefoot)


    I have a client who wants to display his facebook events from his facebook group page.

    Using your link to where you got the code from I have created this which I run in a PHP Code text widget. I would much prefer to use your entire widget but it doesn’t work with groups.

    My problem, which I think you have solved, but I can’t work out why, is that I can’t update the access token so after it expires (2 hours) the code doesn’t work unless I get a new access code. Can you help and if you wish, please use the code I have provided so you can update your plugin to give the option to get events from groups as well as from individual fan pages.

    The Facebook group page is this that I am trying to get the events from:
    https://www.facebook.com/groups/68663437095/events/

    <?php
    header ('Content-type: text/html; charset=utf-8');
    $limit = 5;
    
    $group_id = '68663437095';
    $url1 = 'https://graph.facebook.com/'.$group_id;
    $des = json_decode(file_get_contents($url1));
    
    $url2 = "https://graph.facebook.com/68663437095/events?access_token=CAACEdEose0cBAORQs8KFqo6Fw1ZA78alt8CgH3pyKgEVWdbsxWmBhjwVqOOSqst51fb1ZCHK0Dtz8CmTDCZByqoJMoaXcEU6qjN4IO1JWExSwuHzVRmNU5JEkzpdcSuhPd8StyYSObAhXU4DKngmnHtvF018wZAmsg8GEFXNatcZAZBBMbJmsUOvwSOa7DubIZD";
    $data = json_decode(file_get_contents($url2));
    ?>
    
    <style type="text/css">
         .wrapper {
     width:200px;
     border:1px solid #ccc;
     font-family: "lucida grande",tahoma,verdana,arial,sans-serif;
     background-color: black;
     float:left;
     }
    
     .top {
     margin:5px;
     border-bottom:2px solid #e1e1e1;
     float: left;
     width:290px;
     }
    
     .single {
     margin:5px;
     border-bottom:1px dashed #e1e1e1;
     float:left;
     }
    
     .img {
     float:left;
     width:60px;
     text-align:center;
     margin:5px 5px 5px 0px;
     border-right:1px dashed #e1e1e1;
     }
    
     .text {
     width:220px;
     float:left;
     font-size:10px;
     }
    
     a {
     text-decoration: none;
     color: #3b5998;
     }
    </style>
    
    <div style="width: 250px; padding-bottom:15px;"><br/>
        <div style="width: 190x;  margin-left:15px;">
            <a target="_parent" style="font-size:40px;" href="http://www.facebook.com/groups/fumcbixby/"> <?=$des->name?></a>
            <div style="width:100%; margin: 5px">
                <?=$des->description?>
            </div>
        </div><br/>
        <?
        $counter = 0;
    
        foreach($data->data as $d) {
            if($counter==$limit)
            break;
        ?>
        <div style="width: auto; background-color:white; margin-left:15px; margin-bottom:15px; padding:5px">
            <div style="float: left; width:120px;">
            	<img src="https://graph.facebook.com/<?= $d->id?>/picture">
            </div>
            <div>
            	<h2>Name <?= $d->name?></h2>
                <h3>Location <?= $d->location?></h3>
                <p>Start<?= date('F j, Y H:i',strtotime($d->start_time))?></p>
                <p>End<?= date('F j, Y H:i',strtotime($d->end_time))?></p>
                <a href= "https://www.facebook.com/events/<?= $d->id?>/?suggestsessionid=fc8548e2f42ad507b812ce9e80189592">Visit Event</a>
            </div>
        </div>
        <?
        $counter++;
        }
        ?>
    </div>

    http://wordpress.org/plugins/facebook-events-widget/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How do I Use this plugin to get events from a facebook Group Page’ is closed to new replies.