• [MOD] Facebook Connector V1.0 & V2.0 5 0 5 1
Currently:  

Author Topic: [MOD] Facebook Connector V1.0 & V2.0  (Read 263254 times)

0 Members and 1 Guest are viewing this topic.

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Facebook Connector V1.0
« Reply #30 on: July 09, 2010, 06:43:08 PM »
no problem...

its my v-server..

how can i install the extension

Not sure, I was using wamp server for my testing and it had a checkbox that I clicked on to enable the JSON on the server. Maybe google?
Buddy Duke
www.budduke.com

Offline TechnoRocker

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: [MOD] Facebook Connector V1.0
« Reply #31 on: July 09, 2010, 06:47:13 PM »
okay i try it...

hope i find anything

edit: okay JSON bug fixey

but the login work still not

edit2:

there isn't a new entry in the database
« Last Edit: July 10, 2010, 01:48:08 AM by TechnoRocker »

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Facebook Connector V1.0
« Reply #32 on: July 13, 2010, 08:48:43 PM »
To let everyone know that the issue that TechnoRocker was having was fixed.
It seemed a couple of entries in the global.php file were missing
Buddy Duke
www.budduke.com

Offline leoseo

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: [MOD] Facebook Connector V1.0
« Reply #33 on: July 16, 2010, 07:22:45 PM »
Is it possible to use the user's facebook display pic as his avatar with his comments?
That'd be cool.

And thank you very much for the mod, it is brilliant.

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Facebook Connector V1.0
« Reply #34 on: July 17, 2010, 01:03:31 AM »
Is it possible to use the user's facebook display pic as his avatar with his comments?
That'd be cool.

[MOD ADDON] facebook avatar addon

This add on will display the facebook users profile picture as their avatar in the comments section of 4images.
see attached file to see how it will look.

I looked through the policy on facebook and they are wanting the user to be able to turn off/on this option so I had to give them the option in thier control panel on 4images.
The add on does not store anything on your server so facebook should not be upset over anything.

I tried to make it as simple as possible but there a a few files that will be changed (backup first)

details.php
includes/sessions.php
includes/db_field_definitions.php
lang/english/main.php
templates/yourtemplatefolder/member_editprofile.html

unzip attached file and place installer in your gallery root drive and run it once and the delete it (backup your database first!)
or if you know how to user phpadmin on your database you can just do this.
Code: [Select]
ALTER TABLE `4images_users` ADD `user_fbavatar` TINYINT( 1 ) NOT NULL DEFAULT '1'
in your details.php file...
look for
Code: [Select]
$sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq")."
insert at end of the line before the last " mark
Code: [Select]
get_user_table_field(", u.", "user_fbavatar").get_user_table_field(", u.", "fb_userid").
finished line should look something like this...
Code: [Select]
$sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq").get_user_table_field(", u.", "user_fbavatar").get_user_table_field(", u.", "fb_userid")."
look for
Code: [Select]
elseif ($comment_row[$i][$user_table_fields['user_level']] == ADMIN) {
          $comment_user_info = $lang['userlevel_admin'];
        }
insert after
Code: [Select]
        //facebook avatar addon
        if ($comment_row[$i][$user_table_fields['user_fbavatar']] && $comment_row[$i][$user_table_fields['fb_userid']]){
            $comment_user_info .='<br /><img src="http://graph.facebook.com/'.$comment_row[$i][$user_table_fields['fb_userid']].'/picture" /><br />';
        }
        //end facebook avatar addon

in the includes/sessions.php file...
look for near the top of the file
Code: [Select]
  "user_icq" => "user_icq",
  "fb_userid" => "fb_userid"
replace with
Code: [Select]
  "user_icq" => "user_icq",
  "fb_userid" => "fb_userid",
  "user_fbavatar" => "user_fbavatar" //facebook avatar addon

in the includes/db_field_definitions.php file
look for
Code: [Select]
?>insert before
Code: [Select]
$additional_user_fields['fb_userid'] = array($lang['fb_userid'], "text",1);
$additional_user_fields['user_fbavatar'] = array($lang['user_fbavatar'], "radio",1);


in the lang/english/main.php file
look for
Code: [Select]
?>insert before
Code: [Select]
//facebook avatar addon
$lang['fb_userid']="Facebook User ID:";
$lang['user_fbavatar']= "Use your facebook pic as an avatar:";

in the templates/yourtemplatefolder/member_editprofile.html file (yours may be different, looking to place this below the invisible selection)
look for
Code: [Select]
          <tr>
            <td class="row1"><b>{lang_invisible}</b></td>
            <td class="row1">
              <input type="radio" name="user_invisible" value="1" {user_invisible_yes} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <input type="radio" name="user_invisible" value="0" {user_invisible_no} />
              {lang_no}
            </td>
          </tr>

insert after
Code: [Select]
  {if fb_userid}
          <tr>
            <td class="row2"><b>{lang_user_fbavatar}</b></td>
            <td class="row2">
              <input type="radio" name="user_fbavatar" value="1" {user_fbavatar_yes} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <input type="radio" name="user_fbavatar" value="0" {user_fbavatar_no} />
              {lang_no}
</td>
          </tr>
  {endif fb_userid}

Your users using facebook will now have avatars under their names in the comment section of 4images!
« Last Edit: July 18, 2010, 12:53:06 AM by budduke »
Buddy Duke
www.budduke.com

Offline Bittschi

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: [MOD] Facebook Connector V1.0
« Reply #35 on: July 17, 2010, 03:44:34 AM »
Hello,

I am facing this error on index-page:
Code: [Select]
Parse error: syntax error, unexpected T_CONST in /var/www/html/web36/html/ohg/galerie/facebook/fbmain.php  on line 6
I guess this happened because the Install-File didn't work properly in the way it was described here. Nothing has been added to the DB.
What will I have to do? How do I manually add this in phpmyadmin?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Facebook Connector V1.0
« Reply #36 on: July 17, 2010, 04:33:08 AM »
Welcome to 4images forum.

Your server didn't meet minimum requirements that highlighted with red in the installation instructions.

YOU MUST be running PHP Version 5 or greater with CURL and JSON running on your server for this mod to work.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Bittschi

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: [MOD] Facebook Connector V1.0
« Reply #37 on: July 17, 2010, 03:07:04 PM »
I'm sorry but my phpinfo says:

Code: [Select]
PHP Version 5.2.4

cURL support enabled
cURL Information libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.1.2 libidn/0.5.6

json support enabled
json version 1.2.1


So this will not be the problem. I repeat the install didn't work. I have now commented the lines but would be great if I can get it workig, though.


Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Facebook Connector V1.0
« Reply #38 on: July 17, 2010, 05:06:57 PM »
I'm sorry but my phpinfo says:

Code: [Select]
PHP Version 5.2.4

cURL support enabled
cURL Information libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.1.2 libidn/0.5.6

json support enabled
json version 1.2.1


So this will not be the problem. I repeat the install didn't work. I have now commented the lines but would be great if I can get it workig, though.



sorry for your troubles...
please read all posts in this thread...
mainly...
http://www.4homepages.de/forum/index.php?topic=27396.msg148725#msg148725
you will need to replace your file with the one in that post and
you will need to add the database entries manually, not sure why some sql database are complaining when the installer runs
this post will show you what it should look like...
http://www.4homepages.de/forum/index.php?topic=27396.msg148729#msg148729
Buddy Duke
www.budduke.com

Offline leoseo

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: [MOD] Facebook Connector V1.0
« Reply #39 on: July 17, 2010, 07:12:28 PM »
Thanks for the response.

I noticed this mod is problematic with non-english characters like ŠČ,ş,ö etc, it is a problem, it doesn't fetch those characters. It is a problem especially if the person's name starts with a such character. Any idea how to fix this?

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Facebook Connector V1.0
« Reply #40 on: July 17, 2010, 07:27:11 PM »
Thanks for the response.

I noticed this mod is problematic with non-english characters like ŠČ,ş,ö etc, it is a problem, it doesn't fetch those characters. It is a problem especially if the person's name starts with a such character. Any idea how to fix this?

if you change the line in the lang/whatever/main.php file
Code: [Select]
$lang['fbl_lang'] = "en_US";// please see http://www.facebook.com/translations/FacebookLocales.xmlto the language that you are trying to input does it fix the problem.

As far as I can see, it does not filter out any characters unless facebook is doing it on their end...
Buddy Duke
www.budduke.com

Offline leoseo

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: [MOD] Facebook Connector V1.0
« Reply #41 on: July 17, 2010, 07:39:22 PM »
I have already done it when I set it up  :? I can set up a username with non-english characters through system's registration feature but this happens when the username is fetched from facebook.  :?

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Facebook Connector V1.0
« Reply #42 on: July 17, 2010, 07:54:40 PM »
I have already done it when I set it up  :? I can set up a username with non-english characters through system's registration feature but this happens when the username is fetched from facebook.  :?

Are the users able to login with their facebook account using the non-english characters? Is it just when their names are being displayed in the login area?

i looked through the bugs on facebooks developer's site and allot of people are complaining about non-english characters when posting, ect...

UPDATE:
maybe found error in one of my pages...
Can you test this for me?
in the facebook\fbstatus.php file
look for
Code: [Select]
$tempuser = preg_replace("/[^a-z0-9]/i","",strtolower( $fbme['first_name'].$fbme['last_name'] ));replace with
Code: [Select]
//$tempuser = preg_replace("/[^a-z0-9]/i","",strtolower( $fbme['first_name'].$fbme['last_name'] ));
$tempuser= un_htmlspecialchars(trim(strtolower( $fbme['first_name'].$fbme['last_name'] )));
$tempuser=ereg_replace("( ){2,}", " ", $tempuser);

Can you let me know if that fixes your issue or not?
Buddy Duke
www.budduke.com

Offline leoseo

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: [MOD] Facebook Connector V1.0
« Reply #43 on: July 17, 2010, 08:48:48 PM »
It works ok, I also noticed that only changing this part

Quote
$tempuser = preg_replace("/[.*]/i","",strtolower( $fbme['first_name'].$fbme['last_name'] ));

also works, the system fetches the information and displays correctly if you have the webpage charset in utf8. My charset is not utf8 (it's iso-8859-9) so it displays corruptly(like this ŞıkıdımÇıkık) but this is a different problem for me I guess it'd take too much effort to change that so I'll use it the old way, or do you have any idea how to fetch the info in a different encoding than utf8?

And thank you very much for your answers, I really appreciate.

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Facebook Connector V1.0
« Reply #44 on: July 18, 2010, 01:09:37 AM »
For Everyone,
I just updated an earlier post to include an add on that will give you avatars...
http://www.4homepages.de/forum/index.php?topic=27396.msg149116#msg149116


@ leoseo,
It works ok, I also noticed that only changing this part

Quote
$tempuser = preg_replace("/[.*]/i","",strtolower( $fbme['first_name'].$fbme['last_name'] ));

also works, the system fetches the information and displays correctly if you have the webpage charset in utf8. My charset is not utf8 (it's iso-8859-9) so it displays corruptly(like this ŞıkıdımÇıkık) but this is a different problem for me I guess it'd take too much effort to change that so I'll use it the old way, or do you have any idea how to fetch the info in a different encoding than utf8?

And thank you very much for your answers, I really appreciate.

Can you attach your language files and anything else that help me in understanding your problem better?  I can try to play with what you are talking about, it is kinda interesting...
I saw that I can change my keyboard to different turkish keyboards, are your users using the turkish-F or the turkish-Q keyboard?
Buddy Duke
www.budduke.com