WordPress.org

Ready to get started?Download WordPress

Forums

Simple Facebook Connect
Post title is not linked when published to Facebook (10 posts)

  1. Ivaylo Draganov
    Member
    Posted 3 years ago #

    Hi,

    This is a great plugin and I've been using it for a while and it seemed to work fine untill suddenly auto-publishing to Fan page seized. I've updated to the development version of SFC, but now I got another issue - the title of the post that goes to the fan page is not linked. That way there's no way to visit the original article - all I end up with is title+excerpt on my fanpage's wall.

    What is the reason for this and how fix it?

    And a quick question - since my website is used by several authors, do all of them need to grant the app permissions in order to publish their posts to the fanpage?

  2. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 3 years ago #

    Without seeing the fan page, I couldn't say for sure, but it doesn't do that for me.

    For auto-publishing, no, the people posting do not need to grant permissions.

    For manual publishing, yes, they do.

  3. Ivaylo Draganov
    Member
    Posted 3 years ago #

    Here's a screenshot of the published on a WP post:
    http://awesomescreenshot.com/0bdgqnd5d

    That's how it appears on the FB wall. A title with an excerpt, but no link.

  4. Ivaylo Draganov
    Member
    Posted 2 years ago #

    I'm keeping up with the development version but the issue still persists. I'm using this plugin on two sites with different sets of plugins but the behavior is the same on both sites - the published post on the FB wall is not linked, there's just a title and an excerpt.

    I think its a critical bug and should be addressed. I'm ready to cooperate with you if you need more information.

  5. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 2 years ago #

    Again, without actually seeing the site *in my browser*, there's no way to debug it. A screenshot is useless to me.

    You can email me login details if you want me to be able to see it. I can't reproduce this on my sites. It works there. So without seeing it live and in person, there's no way I can fix what I cannot see.

  6. Ivaylo Draganov
    Member
    Posted 2 years ago #

    I noticed that the 'href' is missing for some reason in the array passed to FB.ui:

    FB.ui({"method":"stream.publish","attachment":{"name":"Post title","href":"","description":"the excerpt[...]","media":[{"type":"image","src":"http:\/\/example.com\/files\/2011\/08\/example.jpg","href":""}]},"action_links":[{"text":"Share","href":"http:\/\/www.facebook.com\/share.php?u="}]});

    I took a look in your code and saw that you are using wp_get_shortlink to get the permalink. Jumping right into the Codex and then into WP source I found that this function is returning and empty string when no permalink structure is set. And since my sites are using the default "ugly" permalinks it was returning and empty string and messing up the FB publisher.

    I don't know why you chose to use this function instead of get_permalink. I tried to filter the permalink inside the plugin but I couldn't manage:

    /**
     * filter SFC shortlink
     */
    add_filter( 'sfc_publish_permalink', 'filter_sfc_shortlink', 10, 2 );
    
    function filter_sfc_shortlink ( $permalink, $id ) {
    
    	// if ( $permalink == '' )
    		$permalink == get_permalink( $id );
    
    	return $permalink;
    }

    So I ended up hacking sfc-publish.php by replacing wp_get_shortlink with get_permalink.

    It works for now, but could you please tell me how to accomplish that without hacking the plugin?

    Thanks!

  7. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 2 years ago #

    Huh. That sounds like a bug in WP to me. I'll take a look.

  8. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 2 years ago #

    However, I used the shortlink by request. Many people use plugins to override the shortlink, and some shortlink systems provide tracking information. Thus, people wanted shortlinks instead of longlinks.

    wp_get_shortlink should return a shortlink all the time. If it doesn't, that's a bug. I'll put in a ticket.

  9. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 2 years ago #

    Okay, so westi tells me it's not a bug. Regardless, SFC 1.0 will fix this.

    In the meantime, try adding this to the bottom of sfc-publish.php:

    // fix crazy shortlink nonsense
    add_filter('sfc_publish_permalink', 'sfc_publish_shortlink_fix', 10, 2);
    function sfc_publish_shortlink_fix($link, $id) {
    	if (empty($link)) $link = get_permalink($id);
    	return $link;
    }
  10. Ivaylo Draganov
    Member
    Posted 2 years ago #

    Yes, that worked! Only it should be get_permalink instead of get_the_permalink.

    Thanks Otto!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic