WordPress.org

Ready to get started?Download WordPress

Forums

FBF Facebook page Feed Widget
avatar with combined page-feeds does not work (2 posts)

  1. MrMaestro
    Member
    Posted 1 year ago #

    When creating a widget (or post, does not matter) based on multiple feeds (which is a GREAT feature btw) the avatar is not displayed.

    The generated html will look something like this:
    <img src="http://graph.facebook.com/213782675400785,355978507813883/picture?type=square" alt="/">

    As you can see the pageId's are combined. Am i doing something wrong or does this need a fix?

    http://wordpress.org/extend/plugins/fbf-facebook-page-feed-widget/

  2. MrMaestro
    Member
    Posted 1 year ago #

    ok... I did some hacking...
    I am not a PHP developer whatsoever, so if anyone writes some prettier code I will definitely use it, but for now this will work just fine :)

    I made two edits:
    edit 1:
    drop events (does not show anything AND I'm not able to determine from which stream they are from)

    foreach ($blocks as $block) {
    		//SM20130403
    		if($pos = strpos($block->get_link(), "facebook.com/events/") > 0){
    			continue;
    		}

    The second edit does the real work:

    # Shows avatar of Facebook page
    			if ($options['show_avatar'] != '') {
    				//SM20130403 - show correct avatar when dealing with multiple streams
    				//get PageId from <link> (which is quite different everytime, but one thing is consistent: somewhere in it, there is the pageID OR the name
    				//<link>http://www.facebook.com/<name>/posts/500704613287898</link>
    				//<link>https://www.facebook.com/photo.php?fbid=451008858310847&set=a.377736818971385.85607.<pageID>&type=1</link>
    				//except for events (but those should be skipped anyway, because they always have an empty description
    				//<link>http://www.facebook.com/events/285542108245850/permalink/285542111579183/</link>
    				$currentPageID = $options['pageID'];
    				$link = $block->get_link();
    				if($pos = strpos($link, "/posts/") > 0){
    					$querystring_array = explode('/',$link);
    					$currentPageID = $querystring_array[3]; //actually, it is the name, but we will live with that :)
    				}else{
    					 foreach($rss_array as $feed_link_id){
    						if($pos = strpos($link, $feed_link_id) > 0){
    							$currentPageID = $feed_link_id;
    							break;
    						}
    					}
    				}
    
    				//SM20130403 $returnMarkup .="<div class=\"facebook_page-avatar\"><img src=\"http://graph.facebook.com/".$options['pageID']."/picture?type=".$avatar_size."\"  alt=".$block->author." /></div>";
    				$returnMarkup .="<div class=\"facebook_page-avatar\"><img src=\"http://graph.facebook.com/".$currentPageID."/picture?type=".$avatar_size."\"  alt=".$block->author." /></div>";
    			}

    Dropping of the events does have one side-effect: the number of posts to show does not work correct anymore. Since I can live with that I did not create a counter or something like that. Maybe for the next developer :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.