News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

SA Facebook Integration

Started by SMFHacks.com Team, February 12, 2010, 01:36:11 PM

Previous topic - Next topic

distante

#2340
SA™  I have a couple of doubts, see,

  • How can I add the login with facebook button to my theme (don't the default one) witch one is the function? because in the default theme it is showed but no in my modified theme.

  • If I already have a FB page, do you know if its possible to link this page to the application?

  • where Can I change the word "publish" in the topic's messages?
    Thanks a lot!

gafai

#2341
Hi
when try "connect with facebook" or "profile - facebook"
CurlException: 6: Could not resolve host: graph.facebook.com; Connection timed out
or "profile - facebook"
CurlException: 6: Could not resolve host: graph.facebook.com; Cannot allocate memory







Technical:
SA Facebook    2.0 RC2-1 Rev49
SMF: SMF 2.0.2
www.ja.citam.info

Skyflash

Hi. Sorry for my horrible english :(

i'm using your great plugin, and i think it have a trouble on the publishing system. The FB is correctly created, every opengraph is inserted in post (oh, yesterday i manually edited FacebookHooks.php ad added og:app_id to the tags :) )

But, when i press "Publish" link on a post, the post is published on FB without the picture i set in the options for og:image tag. Pls, look the attached picture.

Similar problem is the auto publishing function (i set tu auto publish on the fb fanpage), with the only difference that the grabbed picture is one of posting-related standard smf icons  :o (second attached image)

distante

Quote from: Kindred on February 08, 2012, 11:13:41 PM
So, after some additional testings, it would appearf that the embedding does cause issues...

actually, I don't think it ever will be.


every facebook "script" that I have seen chokes if there is ANY other javascript on the page.
This included embedding, highslide, jquery or just about anything that affects the content of the page.

It's a facebook problem, no a problem with the rest.


I fixed some of this problems with the (radical) option of delete a couple of references to .js files, and copy the content into the scripts.js file in the default_theme/scripts dir

distante

Quote from: shorepower on March 04, 2012, 08:38:52 AM
Quote from: SA™ on March 04, 2012, 02:20:37 AM
Quote from: shorepower on March 03, 2012, 12:50:29 PM
Quote from: SA™ on March 03, 2012, 05:46:55 AM
i have a feeling it is this part get_html_translation_table(HTML_ENTITIES); that is the issue

try this find
get_html_translation_table(HTML_ENTITIES);
replace with
self::translation_table_to_utf8(HTML_ENTITIES);

find
public static function facebook_showPub($data){
before add
static function translation_table_to_utf8($arTranslationtable)
    {
        //loop through the array and convert everything both keys and values
        foreach($arTranslationtable as $charkey => $char)
        {
            $charkey = utf8_encode($charkey);
            $arUTFchars[$charkey]= utf8_encode($char);
        }
        return $arUTFchars;
    }


this is untested though so pls back up before trying ill look into it more after work
Thx SA, I will test this tomorrow.  I have a complete setup with a test site, FB etc for test that I use before I take any modification into my main site. Still running rev36 on the main site :)

ok it seems just changing

static function facebook_htmlspecialchars($data){
   
$data = strip_tags($data);
$data = htmlspecialchars(htmlentities($data, ENT_QUOTES), ENT_QUOTES);
return $data;
}


to

static function facebook_htmlspecialchars($data){
   
$data = strip_tags($data);
$data = htmlspecialchars(htmlentities($data, ENT_QUOTES, "UTF-8"), ENT_QUOTES, "UTF-8");
return $data;
}


works for me

Works for me as well, perfekt. Fixed the UTF-8 problem and Swedish characters are now correct. Perhaps it's the same problem Cyber had.

Thx SA, good support as always

This wasn't working for me (spanish forum with utf) so I add an extra line, so the code become this:


static function facebook_htmlspecialchars($data){

   

$data = strip_tags($data);

$data = htmlspecialchars(htmlentities($data, ENT_QUOTES), ENT_QUOTES);
$data = htmlspecialchars_decode($data);
return $data;

}

shorepower

Quote from: distante on March 07, 2012, 12:15:05 PM
Quote from: shorepower on March 04, 2012, 08:38:52 AM
Quote from: SA™ on March 04, 2012, 02:20:37 AM
Quote from: shorepower on March 03, 2012, 12:50:29 PM
Quote from: SA™ on March 03, 2012, 05:46:55 AM
i have a feeling it is this part get_html_translation_table(HTML_ENTITIES); that is the issue

try this find
get_html_translation_table(HTML_ENTITIES);
replace with
self::translation_table_to_utf8(HTML_ENTITIES);

find
public static function facebook_showPub($data){
before add
static function translation_table_to_utf8($arTranslationtable)
    {
        //loop through the array and convert everything both keys and values
        foreach($arTranslationtable as $charkey => $char)
        {
            $charkey = utf8_encode($charkey);
            $arUTFchars[$charkey]= utf8_encode($char);
        }
        return $arUTFchars;
    }


this is untested though so pls back up before trying ill look into it more after work
Thx SA, I will test this tomorrow.  I have a complete setup with a test site, FB etc for test that I use before I take any modification into my main site. Still running rev36 on the main site :)

ok it seems just changing

static function facebook_htmlspecialchars($data){
   
$data = strip_tags($data);
$data = htmlspecialchars(htmlentities($data, ENT_QUOTES), ENT_QUOTES);
return $data;
}


to

static function facebook_htmlspecialchars($data){
   
$data = strip_tags($data);
$data = htmlspecialchars(htmlentities($data, ENT_QUOTES, "UTF-8"), ENT_QUOTES, "UTF-8");
return $data;
}


works for me

Works for me as well, perfekt. Fixed the UTF-8 problem and Swedish characters are now correct. Perhaps it's the same problem Cyber had.

Thx SA, good support as always

This wasn't working for me (spanish forum with utf) so I add an extra line, so the code become this:


static function facebook_htmlspecialchars($data){

   

$data = strip_tags($data);

$data = htmlspecialchars(htmlentities($data, ENT_QUOTES), ENT_QUOTES);
$data = htmlspecialchars_decode($data);
return $data;

}

Which PHP version are you running? I understand the from 5.4 UTF-8 is the standard decoding value and as the host I'm on is running 5.3.3 the UTF-8 flag that do be set
Ἐν οἴνῳ ἀλήθεια -- www.finewines.se

distante


SA™

@Skyflash

the auto publishing function only grabs an image from the post if there isnt one it uses the topic icon instead
the publish button should use the og image tag as that uses the fb_ui funtions to publish

@distante
you can use the social hooks in fb admin to show the login button on other themes
QuoteIf I already have a FB page, do you know if its possible to link this page to the application?
yes you can edit you page to make it link to you app
Quotewhere Can I change the word "publish" in the topic's messages?
facebook.english.php



http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

distante

Thanks, I will look the hooks

Also I'm translating the file into spanish, I will post it here later when I finish

Other thing I remember in a few pages back in this topic that someone post something about sharing post with youtube videos, Did you know how to fix this?

Because, for example, I can't publish anything before this post but with the ones after there's no problem.

Skyflash

Quote from: SA™ on March 07, 2012, 01:13:42 PM
@Skyflash
the auto publishing function only grabs an image from the post if there isnt one it uses the topic icon instead
the publish button should use the og image tag as that uses the fb_ui funtions to publish
But the fact is that the publish button don't uses the og:image specified :)
It grabs the first image found in the post, that is one of standard icons of SMF :(

How can i "fix" this?

Skyflash

Quote from: SA™ on March 07, 2012, 01:13:42 PM
@Skyflash
the auto publishing function only grabs an image from the post if there isnt one it uses the topic icon instead
the publish button should use the og image tag as that uses the fb_ui funtions to publish
You may test it, for example, in this post

Reading the source code:

<title>Aggiunta l'icona RSS su ogni forum</title>
<meta property="fb:app_id" content="305374082858920" />
<meta property="og:type" content="article" />
<meta property="og:image" content="http://www.doaitalia.it/fblogo_150x150.png" />
<meta property="og:site_name" content="Dragons of Atlantis Italia" />
<meta property="og:title" content="Aggiunta l'icona RSS su ogni forum" />
  <meta property="fb:admins" content="682839815" />
<meta property="og:url" content="http://www.doaitalia.it/novita-e-annunci/aggiunta-licona-rss-su-ogni-forum-t30.0.html" />


But when you click on Publish button, no image is added to the post :(

SA™

@Skyflash
yes cos it never has :D the publish auto publish doesnt use the og:image tag it works different the og:image tage is for like and share

you can search for in sources/facebook/facebookhooks.php
$attachment['picture'] = $context['fb_pub_img']; and chnage  $context['fb_pub_img'] to your own image


@distante
not sure yet im lookin into theese issue
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

distante

Quote from: SA™ on March 07, 2012, 01:38:06 PM
@Skyflash
yes cos it never has :D the publish auto publish doesnt use the og:image tag it works different the og:image tage is for like and share

you can search for in sources/facebook/facebookhooks.php
$attachment['picture'] = $context['fb_pub_img']; and chnage  $context['fb_pub_img'] to your own image

If there's no image in the post, $context['fb_pub_img'] returns null? or empty? because if that is how it works, then a If sentence will be better, like

Quote from:  "seudo code"
IF [there's no $context['fb_pub_img']
      then
$attachment['picture'] = whatever I want

Quote from: SA™ on March 07, 2012, 01:38:06 PM
@distante
not sure yet im lookin into theese issue

I just saw the forum of Skyflash and he have a youtube video there... so the problem will be with the AEVA lite mod?

Skyflash

Quote from: SA™ on March 07, 2012, 01:38:06 PM
@Skyflash
yes cos it never has :D the publish auto publish doesnt use the og:image tag it works different the og:image tage is for like and share
Sorry for my bad english, but i don't understood :(
Try explaining me like i'm a lamer :D

Quote
you can search for in sources/facebook/facebookhooks.php
$attachment['picture'] = $context['fb_pub_img']; and chnage  $context['fb_pub_img'] to your own image
This is understood. I have to change your code and set my image. Yes?

Other question: i'm a blogger and i use Wordpress from maaaaaany years (was 2005 :) )
FB plugins for WP grabs the first image is found, or the og:image set in preferences, or the default image of the post. So i can "play" with images, and set now in one post a picture, and in another post other picture.

Is possible to create something similar for a forum like SMF?

Skyflash

Quote from: distante on March 07, 2012, 01:44:36 PM
I just saw the forum of Skyflash and he have a youtube video there... so the problem will be with the AEVA lite mod?
No, same thing on all the posts in any section :)

But... probably i'm new that i'm SMF newbie :) ... but... HOW i have to "add" images in posts?
Now i'm using ILA mod, that permits me "embedding" images in fullsize in the location i want, with simple shortcodes.
There's any other methods?

SA™

QuoteIf there's no image in the post, $context['fb_pub_img'] returns null? or empty? because if that is how it works, then a If sentence will be better, like

no that check for an image in the post using the img tags if there isnt one it will use the topic ican instead this is still subject to chnage tho as i wanted it to also grab yt vids aswell
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

distante

#2356
Quote from: SA™ on March 07, 2012, 01:13:42 PM
QuoteIf I already have a FB page, do you know if its possible to link this page to the application?
yes you can edit you page to make it link to you app

SA, this have to be set in the apps facebook page or in the mod?, because the app page just give me the option to "create a community page for your app", and If I click that, the page is created, but I can't changed to my facebook fans page.

see:


I know this is not directly mod related, but maybe you know where can I point the app to my Fans Page.

;) Thanks!

Skyflash

Quote from: distante on March 07, 2012, 04:14:51 PM
SA, this have to be set in the apps facebook page or in the mod?, because the app page just give me the option to "create a community page for your app", and If I click that, the page is created, but I can't changed to my facebook fans page.
The page will not be "changed", but "redirected :)
After the linking, if a user clicks on "Go to the application" he'll be redirected to the fan page :)

Skyflash

#2358
Quote from: distante on March 07, 2012, 04:14:51 PM



I know this is not directly mod related, but maybe you know where can I point the app to my Fans Page.
In this box, you can create a new page OR link an existent page :D

distante

Quote from: Skyflash on March 07, 2012, 04:24:03 PM
Quote from: distante on March 07, 2012, 04:14:51 PM



I know this is not directly mod related, but maybe you know where can I point the app to my Fans Page.
In this box, you can create a new page OR link an existent page :D

I can't find the way to link, because, if I click in the name, it take's me to a new created page. And If a Click the X button, just erase that page, and show me a "create a page" buttom, and then it create a new one... it's an infinite loop!

Advertisement: