Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter arro08

    (@arro08)

    Thank you David! Unfortunately my coding knowledge is quite limited, and I have no idea how to use the advice you just gave. Could you help me implement it in the code I use to put the posts on the first page?

    This code: https://pastebin.com/pSDY5x32

    I got it to work! Using the beta version and turning on comments inside Facebook did the trick. Can’t get it to work with the stable version though, but this will do. Thanks @bandonrandon for all the help.

    Thread Starter arro08

    (@arro08)

    Ok, I had to turn on comments inside Facebook to get avatars to work, so linking there to comment is alright. Thanks for the help!

    Thread Starter arro08

    (@arro08)

    > I don’t think that your fb wall post have accessable unique permalinks.
    Yes they do. You can find them if you go to your notifications page. If someone has commented on a post, there will be a link directly to that post. I assume WPBook has to know the id of a certain post since it retrieves comments from it?

    I solved the comment form problem by changing comments_template('comments.php') to comments_template(). Now I just need to get the link to the FB-post to work.

    I don’t allow comments inside the FB-application, so a link to the post inside the app is not an option.

    Thread Starter arro08

    (@arro08)

    Sorry for making this so unclear. Removing the form is not the problem, but how do I add a link to the excerpt automatically posted in my FB-profile by WPBook? Is there a way to retrieve that URL and link back to the excerpt?

    Hmm… after removing the comment form in the comments.php, it still shows up under the blog posts. Nothing I do in comments.php has any effect. I replaced the whole thing with <?php echo "Stupid"; ?> and everything still shows up as usual.

    The single.php calls like this <?php comments_template('comments.php'); // Get wp-comments.php template ?>

    What happened here? This is the theme I’m using: https://www.ads-software.com/extend/themes/clear

    @bandonrandon Thanks for answering!

    > If you aren’t using WPBook …
    I am using WPBook to post excerpts from my blog to my FB-profile, and to import comments from that excerpt back to WordPress. This is where I’d want the FB-avatars as well. Do I need Simple Facebook Connect as well for this?

    > … you are using a custom version of the function that is set to default to Devotionmagazine’s deafult gravatar …
    I know, I’m going to change that but first I just want to get it working.

    > Another thing is make sure you wrap your echo get_fb_avatar with <?php ?>
    Of course, I did that before as well, just forgot to post it.

    > Also check to see if gravatars are turned on inside your wp-admin.
    Check!

    > You should be able to just add this to functions.php and not mess with comments.php as long as you have the get_gravatar hook in your comments.php

    Added that to the functions.php and indeed it made a difference. I now see no avatars at all on the blog. I’m basically using this theme: https://www.ads-software.com/extend/themes/clear. The avatar part looks like this:
    <?php echo get_avatar( $comment, $size = '28', $default = 'default' ); ?>

    I tried to change that to get_gravatar (as you wrote) but no luck. Also tried to remove everything between the paranthesises, same result.

    I can’t get this to work (to get avatars to show up on my blog). I put this I my themes functions.php:

    function get_fb_avatar($email,$url) {
    if(preg_match("@^(?:https://)?(?:www\.)?facebook@i",trim($url))){
            $parse_author_url = (parse_url($url));
            $parse_author_url_q = $parse_author_url['query'];
                if(preg_match('/id[=]([0-9]*)/', $parse_author_url_q, $match)){
                    $fb_id = "/".$match[1];}
                else{ $fb_id = $parse_author_url['path'];
                }
            $grav_url= "https://graph.facebook.com".$fb_id."/picture?type=square";
            }
            else{
                $grav_url = "https://www.gravatar.com/avatar/" .
                    md5(strtolower($email))."?d=https://www.devotionmagazine.se/wp-content/themes/deadline/images/gravatar.png";
            }
        $grav_img = "<img src='".$grav_url." ' align='left' class='entry_author_image'/>";
            return $grav_img;
    
        }

    This was already there (and is now underneath the code above):

    if ( function_exists('register_sidebar') ) {register_sidebar();register_sidebar();}

    In my themes comments.php I put this:
    echo get_fb_avatar(get_comment_author_email(),get_comment_author_url());

    Any ideas?

Viewing 7 replies - 1 through 7 (of 7 total)