The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[resolved] How do I show only the first name for the FB comment author? (4 posts)

  1. kokonad
    Posted 5 years ago #

    When the plugin imports comments from Facebook, how do I get it to show only the first name of the commenter?


  2. John Eckman
    Plugin Author

    Posted 5 years ago #

    You'd have to edit the plugin, as this isn't currently configurable in the options.

    The file you're looking for is wpbook/includes/wpbook_cron.php

    Lines 286-299 create a WordPress comment object based on data retrieved from Facebook.

    In particular, line 288 says:

    'comment_author' => $fb_user[name],

    Which you would change. Problem is that $fb_user[name] gets populated in an FQL query above at line 246, and it looks like the Facebook FQL table for profile only has "name" not "firstname" and "lastname" - see http://developers.facebook.com/docs/reference/fql/profile

    Instead you'd have to query the FB User table instead of or in addition to the Profile table.

    In other words, it ain't simple. ;)

  3. kokonad
    Posted 5 years ago #

    Ah, that makes sense. I was just curious though, if it could be done. This particular plugin - Facebook CommentsTNG - does it, but I had no idea of the amount of work that goes into it :)
    It's not a big thing at all - it's a personal choice that I prefer commenter names being displayed only with the first name :)

  4. BandonRandon
    Plugin Contributor

    Posted 5 years ago #

    Just a note, I've also helped contribute to Facebook CommentsTNG and I belive full name is on by default. The way we get data is to use the mobile version of Facebook then parse the comments. The way WPBook does it is using FQL (which may be better).

    You may be able to explode the $fb_user[name] field on space then use just the first piece. This of course rely on people to only have names like first last not fir st last

    Just an idea

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WPBook
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic