4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: budduke on June 13, 2010, 09:38:56 PM

Title: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on June 13, 2010, 09:38:56 PM
Facebook Connector VERSION 2.0 CAN BE FOUND HERE...
http://www.4homepages.de/forum/index.php?topic=27396.msg160225#msg160225 (http://www.4homepages.de/forum/index.php?topic=27396.msg160225#msg160225)

[MOD] Facebook Connector V1.0

DO NOT INSTALL VERSION 1 OF THIS MOD!
The Version one instructions are here for users to remove all entries from their galleries before installing version 2.
As of December 13th, facebook no longer supports the code that it is ran under.
I am currently working on version 2.0 of this mod using the new code but still have some testing to do with it first.
I am hoping to have it up and running by the end of January 2012.

This mod will give your users the ability to login to your 4images site using their Facebook account.
YOU MUST be running PHP Version 5 or greater with CURL and JSON running on your server for this mod to work.
check your phpinfo() or your provider to find out. My provider upgraded my account for free to the new PHP.

this mod is based on the facebook php-sdk kit that is available at...
http://github.com/facebook/php-sdk/ (http://github.com/facebook/php-sdk/)
the package is new and constantly being updated, I will try to stay on top of it but no guarantee that this mod will work if they make any drastic changes to their code.

I used the folowing tutorials to help me create this mod, (I have to give them the credit, they did most of the hard work)
http://www.barattalo.it/facebook-connect-tutorial/ (http://www.barattalo.it/facebook-connect-tutorial/)
http://www.pakt.com/pakt/?id=5e17b48f5679ab47&t=How_to_add_Facebook_Connect_to_your_website_using_the_PHP_API (http://www.pakt.com/pakt/?id=5e17b48f5679ab47&t=How_to_add_Facebook_Connect_to_your_website_using_the_PHP_API)
http://thinkdiff.net/facebook/php-sdk-graph-api-base-facebook-connect-tutorial/ (http://thinkdiff.net/facebook/php-sdk-graph-api-base-facebook-connect-tutorial/)

This mod adds a login button to your userbox on your site.
When a user logs in for the first time with facebook, it will check their e-mail to see if they already have an account on your site and connect the facebook account to that account if found.
If the account is not found, it will auto-create an account on your site using their facebook fullname and adding numbers after it if needed.
it will also transfer their e-mail and website information to 4images database in the process. (facebook now allows this as long as you do not SPAM your visitors, they will disable your app if anyone complains)
It will not e-mail authenticate their account, I figure facebook already did this so it already lets them have full user access when logging in.
After installed and running, it is compatable with most of the facebook social addons if you wish to have them displayed on your site.
Is language friendly, check on the insert in the language/main.php file called $lang['fbl_lang'] for more information.
The Mod will ask your users for their facebook e-mail and website to add to the 4images database.
It will also ask for permission to post any share/like requests to there facebook profiles.

The only issue I have found is that facebook is wanting you to use SSL for comunications between them and your site, so far they have not inforced the issue and I am not sure how to add support for that,
so I modified the facebook.php file to turn the ssl verification off. Everyone on facebook is complaining about it also so hopefully they will not force the SSL issue or I think your entire gallery will have to be
behind a SSL certificate for it to work in the future but for now you should be good.

DEMO...
http://www.budduke.com (http://www.budduke.com)

Version history...
V1.0 - initial release. (using a modified version 2.0.4 of the php-sdk kit)

You first need to go to Facebooks website and create an app under your account.
http://www.facebook.com/developers/createapp.php (http://www.facebook.com/developers/createapp.php)
click on the "set up new application" button.
In the set up page you have different fields to enter, but only these are needed (see attached pdf file in zip download to see my settings)
On the Basic tab; "name of the application" and your developer contact.
On the Connect tab; "Connect url", you should enter the root of your gallery, for the example: "http://www.yourwebsite.com/gallery/"
               "Base Domain", you should enter the root of your site, for the example: "www.yourwebsite.com"
Take note of the "application ID", "API key", and the "secret" (write down or be ready to copy this information. (DO NOT SHARE THIS INFO WITH ANYONE!)


Backup your database before adding this mod. It makes changes to your USERS table.
These are the modified files that you will need to backup before modifying.
categories.php
details.php
global.php
index.php
lightbox.php
login.php
member.php
postcards.php
register.php
rss.php
search.php
top.php
includes\page_header.php
includes\sessions.php
lang\english\main.php
your template\details.html
your template\header.html
your template\member_editprofile.html
your template\user_loginform.html
your template\user_logininfo.html

Lets get started...

Download and unzip the file attached and place the facebook folder with it's content in the root of your gallery.
Place the facebook_install.php file in the root of your gallery and run it to add the fields to your user table. (DELETE THIS FILE AFTER YOU RUN IT!)
Protect the facebook folder anyway you can, I placed an index.php file in it that will reroute anyone directory browsing to your homepage (replace with your website path in the index.php file)
or delete it if you are using another method to keep people out.

Copy the "application ID", "API key", "secret", and "base domain" information into the top of the FBMAIN.PHP file.

Now, onto modifying your current files...

in the categories.php, lightbox.php, member.php, register.php, rss.php, top.php, index.php, postcards.php, search.php, and details.php files...
find
Code: [Select]
$user_access = get_permission();insert after
Code: [Select]
include_once(ROOT_PATH.'facebook/fbstatus.php');//MOD facebook connect
in the login.php file...
find
Code: [Select]
if ($site_sess->login($user_name, $user_password, $auto_login)) {insert after
Code: [Select]
//MOD facebook connect
if ($fbme){
$fb_userinfo=$site_sess->return_user_info();
if ($fb_userinfo['user_email'] !== $fbme['email']){
redirect($facebook->getLogoutUrl(array('next' => dirname(curPageURL()).'/'.$url)));
}
}
//END MOD facebook connect

Also in the details.php file...
find
Code: [Select]
"prepend_head_title"        => $image_name . " - ",insert after
Code: [Select]
"facebook_title"        => $image_name,
in the global.php file...
find
Code: [Select]
if (!defined('ROOT_PATH')) {
  die("Security violation");
}
insert after
Code: [Select]
if (!defined("IN_CP")) include_once(ROOT_PATH.'facebook/fbmain.php'); //MOD facebook connect

find
Code: [Select]
?>insert before
Code: [Select]
//MOD facebook connect
$fb_status=0;
//END MOD facebook connect

in the lang/english/main.php file...
find
Code: [Select]
?>insert before
Code: [Select]
//-----------------------------------------------------
//--- Facebook connect -------------------------------------
//-----------------------------------------------------
$lang['fbl_confirm'] = "\"To logout of Facebook also Select 'OK'\"";
$lang['fbl_lang'] = "en_US";// please see http://www.facebook.com/translations/FacebookLocales.xml
$lang['fbl_change_password'] = "Attention Facebook Users!";
$lang['fbl_passmessage'] = "If your account was created when you signed in with your Facebook account, then your password was randomly created.<br> You will need to <b>logout</b> of this site and click on <b>'forgot password'</b> to have a new one sent to you.";
$lang['fbl_sharing'] = "Facebook Sharing";

in the includes\page_header.php file...
find
Code: [Select]
$site_template->register_vars($array);insert after
Code: [Select]
//MOD facebook connect
if (strstr($site_sess->url($script_url."/".$self_url),'?')){
$fbstatus="&fb_status=1";
}else{
$fbstatus="?fb_status=1";
}
$site_template->register_vars(array("fb_status"=>$fbstatus));
//END MOD facebook connect

find
Code: [Select]
//-----------------------------------------------------
//--- User Box ----------------------------------------
//-----------------------------------------------------
insert before
Code: [Select]
//MOD facebook connect
$fbl_loggedin = ($fbme)?1:0;
$fb_url = $site_sess->url($script_url."/".$self_url);
if (strpos($fb_url,"&")){
$fb_url=substr($fb_url,0,strpos($fb_url,"&"));
}
$site_template->register_vars(array(
    "fb_appid" => FBAPPID,
"fbl_loggedin" => $fbl_loggedin,
"fbl_confirm" => $lang['fbl_confirm'],
"fbl_lang" => $lang['fbl_lang'],
"fbl_passmessage" => $lang['fbl_passmessage'],
"fbl_sharing" => $lang['fbl_sharing'],
"fb_url" => $fb_url)
);
unset($fbl_loggedin,$fb_url);
//END MOD facebook connect

in the includes\sessions.php file...
find
Code: [Select]
"user_icq" => "user_icq"replace with
Code: [Select]
"user_icq" => "user_icq",
  "fb_userid" => "fb_userid"
 
find
Code: [Select]
function logout($user_id) {insert before
Code: [Select]
//MOD facebook connect
  function fb_login($user_name = "", $user_password = "", $auto_login = 0, $set_auto_login = 1) {
    global $site_db, $user_table_fields;

    if (empty($user_name) || empty($user_password)) {
      return false;
    }
    $sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_password")."
            FROM ".USERS_TABLE."
            WHERE ".get_user_table_field("", "user_name")." = '$user_name' AND ".get_user_table_field("", "user_level")." <> ".USER_AWAITING;
    $row = $site_db->query_firstrow($sql);

    $user_id = (isset($row[$user_table_fields['user_id']])) ? $row[$user_table_fields['user_id']] : GUEST;
    if ($user_id != GUEST) {
      if ($row[$user_table_fields['user_password']] == $user_password) {
        $sql = "UPDATE ".SESSIONS_TABLE."
                SET session_user_id = $user_id
                WHERE session_id = '".addslashes($this->session_id)."'";
        $site_db->query($sql);
        if ($set_auto_login) {
          $this->set_cookie_data("userpass", ($auto_login) ? $user_password : "");
        }
        $this->start_session($user_id, 1);
        return true;
      }
    }
    return false;
  }
//END MOD facebook connect

The following modifications are using the default template as a model...
yours may be different...


in the your_template_folder\header.html file...
find
Code: [Select]
<html dir="{direction}">insert after
Code: [Select]
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">

find
Code: [Select]
{if has_rss}insert before
Code: [Select]
<script language="JavaScript">
<!--
function fb_confirm_entry()
{
FB.getLoginStatus(function(response){
if (response.session){
input_box=confirm({fbl_confirm});
if (input_box==true){FB.logout(function(response){});}}});
}
-->
</script>

find
Code: [Select]
<body bgcolor="#FFFFFF" text="#0F5475" link="#0F5475" vlink="#0F5475" alink="#0F5475">
<br />
insert after
Code: [Select]
   <div id="fb-root"></div>
        <script type="text/javascript">
            window.fbAsyncInit = function() {
                FB.init({appId: '{fb_appid}', status: true, cookie: true, xfbml: true});

                /* All the events registered */
                FB.Event.subscribe('auth.login', function(response) {
                    // do something with response
                    login();
                });
                FB.Event.subscribe('auth.logout', function(response) {
                    // do something with response
                    logout();
                });
            };
            (function() {
                var e = document.createElement('script');
                e.type = 'text/javascript';
                e.src = document.location.protocol +
                    '//connect.facebook.net/{fbl_lang}/all.js';
                e.async = true;
                document.getElementById('fb-root').appendChild(e);
            }());

            function login(){
                document.location.href = '{self_full}{fb_status}';
            }
            function logout(){
                document.location.href = '{self_full}{fb_status}';
            }
</script>

in the your_template_folder\member_editprofile.html file...
at the end of the document or after the change password form insert this code
Code: [Select]
{if fbl_loggedin}
<br />
  <table width="100%" border="0" cellspacing="0" cellpadding="1">
    <tr>
      <td valign="top" class="head1">
        <table width="100%" border="0" cellpadding="4" cellspacing="0">
          <tr>
            <td colspan="2" valign="top" class="head1">{fbl_change_password}</td>
          </tr>
          <tr>
            <td class="row1">{fbl_passmessage}</td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
{endif fbl_loggedin}

in the your_template_folder\user_loginform.html file...
find
Code: [Select]
» <a href="{url_register}">{lang_register}</a><br>&nbsp;</td>insert after
Code: [Select]
 </tr><tr><td valign="top" align="center">
{if fbl_loggedin}
<table width="100%" border="0"><tr><td align="right">
<fb:profile-pic uid='loggedinuser' facebook-logo='false'></fb:profile-pic></td><td valign="center" align="left"> Welcome,<BR> <fb:name uid='loggedinuser' useyou='false'></fb:name>
</td></tr></table>
{endif fbl_loggedin}
 <fb:login-button size="small" length="long" autologoutlink="true" perms="email,user_website,publish_stream"></fb:login-button>
</td>

in the your_template_folder\user_logininfo.html file...
find
Code: [Select]
» <a href="{url_logout}">{lang_logout}</a><br>&nbsp;</td>replace with
Code: [Select]
» <a href="{url_logout}" onclick="fb_confirm_entry()">{lang_logout}</a></td>
 </tr><tr><td valign="top" align="center">
{if fbl_loggedin}
<table width="100%" border="0"><tr><td align="right">
<fb:profile-pic uid='loggedinuser' facebook-logo='false'></fb:profile-pic></td><td valign="center" align="left"> Welcome,<BR> <fb:name uid='loggedinuser' useyou='false'></fb:name>
</td></tr></table>
{endif fbl_loggedin}
 <fb:login-button size="small" length="long" autologoutlink="true" perms="email,user_website,publish_stream"></fb:login-button>
 </td>
     
You can now integrate the social plugins that Facebook offers for your 4images site...
they can be found here... http://developers.facebook.com/plugins (http://developers.facebook.com/plugins)

I added the "Like and the Share" buttons to my details pages of my site with the following code...
in the your_template_folder\details.html file...
find
Code: [Select]
<tr>
                            <td valign="top" class="row2"><b>{lang_keywords}</b></td>
                            <td valign="top" class="row2">{image_keywords}</td>
                          </tr>
insert before
Code: [Select]
 <tr>
                            <td valign="top" class="row1" width="33%">
<b>{fbl_sharing}</b><br><br><center><fb:share-button  type="button_count" href="{fb_url}">
<meta name="title" content="{facebook_title}"/>
<meta name="description" content="{image_description}"/>
<link rel="image_src" href="{facebook_image}" />
</fb:share-button></center></td>
                            <td valign="top" class="row1">
<fb:like width="66%" href="{fb_url}">
<meta name="title" content="{facebook_title}"/>
</fb:like>
</td>
                          </tr>

The
Code: [Select]
<meta name="title" content="{facebook_title}"/> is using the imagename for its title.
If you are using a better dynamic title on your detail pages I would suggest replacing the {facebook_title} with the variable for that mod for a better title for your image.

There are allot of issues with the like/share buttons as of creating this mod,
sometimes they show thumbnails, sometimes not. sometimes adds correctly, sometimes not.
The issues are with facebook and not with anything I have done. (Do not ask me to fix anything regarding those issues unless you can prove it is in my code causing the problem!)

There are some unusual things that happen from time to time, and if anyone can look my coding over and see if it is secure I would appriciate it.
I also would have like putting the include statements in the global.php file instead of all the others but it never worked when I did that so if anyone can help there it would make future changes easier.


Title: Re: [MOD] Facebook Connector V1.0
Post by: V@no on June 14, 2010, 12:16:43 AM
Thanks for sharing this mod.

The fist step could be simplified by adding this into global.php instead of all main files:
if (!defined("IN_CP")) include_once(ROOT_PATH.'facebook/fbmain.php'); //MOD facebook connect
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on June 14, 2010, 01:10:55 AM
Thanks for sharing this mod.

The fist step could be simplified by adding this into global.php instead of all main files:
if (!defined("IN_CP")) include_once(ROOT_PATH.'facebook/fbmain.php'); //MOD facebook connect


Thanks V@no!
I have changed my original post...
Hopefully nobody already started on it. If they did they will need to remove the
Code: [Select]
include_once(ROOT_PATH.'facebook/fbmain.php'); //MOD facebook connectfrom all the files above except the global.php file...
Title: Re: [MOD] Facebook Connector V1.0
Post by: webvision on June 14, 2010, 01:52:27 AM
I have one thing to say excellent!
Title: Re: [MOD] Facebook Connector V1.0
Post by: GaYan on June 14, 2010, 05:03:50 AM
 :D Sir, normally you keep silent for a bit , and when you return.. Boom  :mrgreen: .. you share he best modes for the 4images,, you are aming the best of best sir ! Keep it up! Great Mod !  :wink:
Title: Re: [MOD] Facebook Connector V1.0
Post by: Lucifix on June 14, 2010, 09:05:40 AM
This looks very promising... but I have a question:

What would happened when you signup with facebook account and your username is already taken?

I have also noticed that there is error with logout link. When you want to logout from gallery some FB code show up.
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on June 14, 2010, 12:09:12 PM
This looks very promising... but I have a question:

What would happened when you signup with facebook account and your username is already taken?

I have also noticed that there is error with logout link. When you want to logout from gallery some FB code show up.
first question: It will add numbers to the end of the name until it gets a username that does not already exist.

second one: do you have php warnings being suppressed? I do know it makes a call to facebook to see if you are attached or not but I rechecked the code to make sure I removed that array that you say is showing up. Can you provide me with a link to see if it is the same thing?
Title: Re: [MOD] Facebook Connector V1.0
Post by: qBass17 on June 17, 2010, 12:26:01 PM
Added to: Mods Works Perfektly at 1.7.7 / Mods Laufen Perfekt mit 1.7.7 (http://www.4homepages.de/forum/index.php?topic=24888.0)
Title: Re: [MOD] Facebook Connector V1.0
Post by: Lucifix on June 17, 2010, 12:35:05 PM
This looks very promising... but I have a question:

What would happened when you signup with facebook account and your username is already taken?

I have also noticed that there is error with logout link. When you want to logout from gallery some FB code show up.
first question: It will add numbers to the end of the name until it gets a username that does not already exist.

second one: do you have php warnings being suppressed? I do know it makes a call to facebook to see if you are attached or not but I rechecked the code to make sure I removed that array that you say is showing up. Can you provide me with a link to see if it is the same thing?

Thx for you answers, here is attached screenshot of that error that i was talking about...
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on June 17, 2010, 05:51:38 PM
@ Lucifix,
Interesting, You are using firefox.
I tested a bunch of combinations of logins/out on ie8 without any issues.
I do not have firefox on my work computer, will have to look at it this weekend. I tested firefox a few time while creating it but never saw that error.
Can you give me any step by step how you logged in/out? Was it strait facebook login/out both ways?

I did find one bug, I opened another browser window and logged into facebook and then logged into my site in another browser window under a different username then the facebook one, it gave me a blank page. Will be looking into that also this weekend...

Update: I have tested it here at home...
IE8, chrome, comodo dragon, and opera all seem to work fine (chrome locked up once when I was logging in, not sure why)
firefox, you are correct, when you login using facebook and then I logged out from my site the normal way and saying "Yes, I want to log out of facebook" I get the error you attached. Will have to do some digging, not sure why only firefox is doing that  :?:

UPDATE #2:
The version of files that I had on my site was one version behind the ones I posted. The files in the zip file in the post are the correct ones. I changed the files on my site to the same ones I posted and firefox is working correctly now...
The only issue I still see the the one bug I mentioned above, will look into that this weekend
Title: Re: [MOD] Facebook Connector V1.0
Post by: relu on July 03, 2010, 10:43:40 AM
When running facebook_install.php i get Installation status

       1. Error:

          ALTER TABLE `4images_users` ADD `fb_userid` VARCHAR(255) NOT NULL, ADD `fl_facebook` ENUM(\'new\',\'normal\',\'registered\') NOT NULL DEFAULT \'registered\'

What i should check?
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 03, 2010, 03:15:49 PM
@ relu,

I would go into your phpadmin and see if the fields "fb_userid" and "fl_facebook" have been added...

I have never had an issue with that installer file unless your sql version does not support something...
Title: Re: [MOD] Facebook Connector V1.0
Post by: jonnyo on July 05, 2010, 10:03:30 PM
When running facebook_install.php i get Installation status

       1. Error:

          ALTER TABLE `4images_users` ADD `fb_userid` VARCHAR(255) NOT NULL, ADD `fl_facebook` ENUM(\'new\',\'normal\',\'registered\') NOT NULL DEFAULT \'registered\'

What i should check?

Ive goten this aswell, and in phpadmin no tables have been created under 4images_users..
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 05, 2010, 10:12:18 PM
@ jonnyo and relu,
What version of PHP are your running?
phpinfo() in the admin panel will give you the answer.
Title: Re: [MOD] Facebook Connector V1.0
Post by: jonnyo on July 05, 2010, 10:17:32 PM
it says: PHP Version 5.2.13
ended up adding the tables manualy,not sure if right tho..

but still getting:
Code: [Select]
Parse error: syntax error, unexpected T_CONST in /home/jonnyo/public_html/CSSS/facebook/fbmain.php on line 5
took lines 5 to  8 out and loads ok. but cant connect due to no keys..
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 05, 2010, 10:33:22 PM
it says: PHP Version 5.2.13
ended up adding the tables manualy,not sure if right tho..

but still getting:
Code: [Select]
Parse error: syntax error, unexpected T_CONST in /home/jonnyo/public_html/CSSS/facebook/fbmain.php on line 5
took lines 5 to  8 out and loads ok. but cant connect due to no keys..

I thought you would say that, I saw the same thing in 5.2.12 but seems to be fixed in 5.3.
Install the attached fbmain.php file overwriting the one on your system and this should work.
I did not make the fbmain, I just copied it straight from facebook. Not sure why the error...

Update:
You will also need to make a change in the includes\pageheader.php file
look for
Code: [Select]
"fb_appid" => FBAPPID,replace with
Code: [Select]
"fb_appid" => $fbappid,
This should take care of your invalid/disabled appid problem.
Sorry, I was awhile back when I tested this code

Title: Re: [MOD] Facebook Connector V1.0
Post by: jonnyo on July 05, 2010, 10:42:04 PM
it says: PHP Version 5.2.13
ended up adding the tables manualy,not sure if right tho..

but still getting:
Code: [Select]
Parse error: syntax error, unexpected T_CONST in /home/jonnyo/public_html/CSSS/facebook/fbmain.php on line 5
took lines 5 to  8 out and loads ok. but cant connect due to no keys..

I thought you would say that, I saw the same thing in 5.2.12 but seems to be fixed in 5.3.
Install the attached fbmain.php file overwriting the one on your system and this should work.
I did not make the fbmain, I just copied it straight from facebook. Not sure why the error...



thanks for that, the site working fine as it seems now, but still no luck looging in with facebook,
Code: [Select]
Invalid API key specified

The application you are trying to access does not exist or has been disabled.
any thoughts?
how do i know if its been disabled?
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 05, 2010, 11:28:57 PM
Quote
Invalid API key specified

The application you are trying to access does not exist or has been disabled.

Please see my post right before yours. I have updated it to include a modification that should fix your problem.
That way, anyone else with that problem does not have to look all over to find the answer.

Sorry about the trouble...
Title: Re: [MOD] Facebook Connector V1.0
Post by: jonnyo on July 06, 2010, 12:14:28 AM
Quote
Invalid API key specified

The application you are trying to access does not exist or has been disabled.

Please see my post right before yours. I have updated it to include a modification that should fix your problem.
That way, anyone else with that problem does not have to look all over to find the answer.

Sorry about the trouble...

nice, it works a treat now, thank you!
and adding the tables manualy work too.
(http://uploader.j-m-e.net/files/dataase.jpg)

Thanks again.
Title: Re: [MOD] Facebook Connector V1.0
Post by: TechnoRocker on July 09, 2010, 04:22:30 PM
Is it right ?

look attach
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 09, 2010, 05:07:00 PM
@ TechnoRocker,
Yes that is correct...
Title: Re: [MOD] Facebook Connector V1.0
Post by: TechnoRocker on July 09, 2010, 05:17:11 PM
okay...but now comes an other error >.<....

Invalid API key specified


The application you are trying to access does not exist or has been disabled.


my gallery: clay-class.net..

do i musst upload the folder "facebook" to the root folder of my gallery or just the files ?
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 09, 2010, 05:21:41 PM
@ TechnoRocker,
Yes, upload the entire folder to the root of your gallery and the files will be inside that folder.

That error may be what another user was complaining about.
Depending on the version of PHP5 there is a couple of issues that I have no control over but hopefully looking at this post and replacing the file and changing the code will fix your issue.
http://www.4homepages.de/forum/index.php?topic=27396.msg148725#msg148725 (http://www.4homepages.de/forum/index.php?topic=27396.msg148725#msg148725)

You should try to use the original code unless you see the described error when running...
Title: Re: [MOD] Facebook Connector V1.0
Post by: TechnoRocker on July 09, 2010, 06:08:57 PM
when i upload the facebook folder to my root folder i get a blank page =(

edit:

look now.. another fail

edit2:

the facebook login doesen't work
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 09, 2010, 06:18:33 PM
@TechnoRocker,

I saw this in the error...
facebook needs the JSON PHP extension.

Can you confirm that is part of your PHP5 install?

Make sure you made all additions/changes from the main post of this mod.
Title: Re: [MOD] Facebook Connector V1.0
Post by: TechnoRocker on July 09, 2010, 06:22:49 PM
I saw this in the error...
facebook needs the JSON PHP extension.

Can you confirm that is part of your PHP5 install?

I dont know.. =(..

where can i look at it?

Make sure you made all additions/changes from the main post of this mod.

I think i did it right
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 09, 2010, 06:25:27 PM
I saw this in the error...
facebook needs the JSON PHP extension.

Can you confirm that is part of your PHP5 install?

I dont know.. =(..

where can i look at it?

In the admin area of 4images.
Click on phpinfo() and do a search for JSON to see if it is there anywhere...
Title: Re: [MOD] Facebook Connector V1.0
Post by: TechnoRocker on July 09, 2010, 06:29:23 PM
I can't find anything

http://clay-class.net/php.php
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 09, 2010, 06:39:36 PM
I can't find anything

http://clay-class.net/php.php

You will need to ask your provider if they can add that extension to your PHP...
Sorry, that is a facebook requirement and not 4images.
Title: Re: [MOD] Facebook Connector V1.0
Post by: TechnoRocker on July 09, 2010, 06:41:25 PM
no problem...

its my v-server..

how can i install the extension
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke 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?
Title: Re: [MOD] Facebook Connector V1.0
Post by: TechnoRocker 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
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke 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
Title: Re: [MOD] Facebook Connector V1.0
Post by: leoseo 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.
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke 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!
Title: Re: [MOD] Facebook Connector V1.0
Post by: Bittschi 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?
Title: Re: [MOD] Facebook Connector V1.0
Post by: V@no 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.
Title: Re: [MOD] Facebook Connector V1.0
Post by: Bittschi 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.

Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke 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 (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 (http://www.4homepages.de/forum/index.php?topic=27396.msg148729#msg148729)
Title: Re: [MOD] Facebook Connector V1.0
Post by: leoseo 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?
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke 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...
Title: Re: [MOD] Facebook Connector V1.0
Post by: leoseo 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.  :?
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke 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?
Title: Re: [MOD] Facebook Connector V1.0
Post by: leoseo 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.
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke 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 (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?
Title: Re: [MOD] Facebook Connector V1.0
Post by: piczilla on July 18, 2010, 11:22:26 PM
Okay,

I looked all over facebook developers how to do this. Then I realized I could look at the forums. I was so glad when I found it!
One problem, I get the error below

"ALTER TABLE `4images_users` ADD `fb_userid` VARCHAR(255) NOT NULL, ADD `fl_facebook` ENUM(\'new\',\'normal\',\'registered\') NOT NULL DEFAULT \'registered\'"

I added it in phpmyadmin with the correct specs, but it keeps giving me this error! I attached a screenshot of what my phpmyadmin looks like.

Thanks,
Coulton

Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 18, 2010, 11:36:36 PM
Okay,

I looked all over facebook developers how to do this. Then I realized I could look at the forums. I was so glad when I found it!
One problem, I get the error below

"ALTER TABLE `4images_users` ADD `fb_userid` VARCHAR(255) NOT NULL, ADD `fl_facebook` ENUM(\'new\',\'normal\',\'registered\') NOT NULL DEFAULT \'registered\'"

I added it in phpmyadmin with the correct specs, but it keeps giving me this error!

Thanks,
Coulton



Yes, facebook's website for developers is very hard to understand...

My question to you is, what error? :?:
it looks like it placed the fields into your database correctly...
Title: Re: [MOD] Facebook Connector V1.0
Post by: piczilla on July 18, 2010, 11:38:38 PM
Yes, facebook's website for developers is very hard to understand...

My question to you is, what error? :?:
it looks like it placed the fields into your database correctly...

The same error I got before I added the stuff in the database.

ALTER TABLE `4images_users` ADD `fb_userid` VARCHAR(255) NOT NULL, ADD `fl_facebook` ENUM(\'new\',\'normal\',\'registered\') NOT NULL DEFAULT \'registered\'

I even emptied my cache and tried it in a different browser.
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 18, 2010, 11:43:25 PM
I am assuming you are still trying to run the installer?
If so, just delete that file because you have the fields entered into your database correctly...

Title: Re: [MOD] Facebook Connector V1.0
Post by: piczilla on July 19, 2010, 12:21:04 AM
Thanks! Installed it and now it's starting to act funny. The login to facebook button doesn't appear and the logout doesn't want to work. Thoughts?

Thanks,
Coulton

PS: here is the link http://insanestream.com/piczilla/
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 19, 2010, 12:23:23 AM
You need to follow the steps in this link...
http://www.4homepages.de/forum/index.php?topic=27396.msg148725#msg148725 (http://www.4homepages.de/forum/index.php?topic=27396.msg148725#msg148725)
Title: Re: [MOD] Facebook Connector V1.0
Post by: piczilla on July 19, 2010, 12:52:23 AM
Just did, now the facebook logout button shows all the time whether logged in or not and does not work.
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 19, 2010, 01:01:36 AM
The design of your page is messed up.
You need to go in and clean allot of things up...
just what I saw was that you places some of the javascript stuff in more then once and in the wrong area...

other things that I do not normally see on sites is that you have your <css> styles and a <table> command all coming before your <html> command.
most pages start with
<html>
<head> this is where you meta and javascripts should reside except for the one that has the fb-root it needs to be at the top of your body
</head>
<body> which is where your table should begin and the rest of your page stuff
</body>
</html>


I am getting the login button on my browser but nothing happens when I press it.
I see there is also a login button in your comment area through that app, not sure how it will interact with the mod.

but I would start be cleaning everything up and/or starting over with a fresh copy of your template that you are using...

If you give me a link to the template you are using, I may have time later this week to look at it but am getting off the computer for tonight.

UPDATE:
I think you need to remove this code from your page to get it to work correctly...
Code: [Select]
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
  FB.init({appId: '<<REMOVED FOR SECURITY>>', status: true, cookie: true, xfbml: true});
  FB.Event.subscribe('auth.sessionChange', function(response) {
    if (response.session) {
      // A user has logged in, and a new cookie has been saved
    } else {
      // The user has logged out, and the cookie has been cleared
    }
  });
</script>

This is the one in your <HEAD></HEAD> area...
I think it is conflicting with this mod. I believe it was installed when you added your comments from facebook.
My mod should accomplish the same thing and your comments should still work.

Let me know if you are still having troubles.
Title: Re: [MOD] Facebook Connector V1.0
Post by: piczilla on July 20, 2010, 04:33:31 AM
The design of your page is messed up.
You need to go in and clean allot of things up...
just what I saw was that you places some of the javascript stuff in more then once and in the wrong area...

other things that I do not normally see on sites is that you have your <css> styles and a <table> command all coming before your <html> command.
most pages start with
<html>
<head> this is where you meta and javascripts should reside except for the one that has the fb-root it needs to be at the top of your body
</head>
<body> which is where your table should begin and the rest of your page stuff
</body>
</html>


I am getting the login button on my browser but nothing happens when I press it.
I see there is also a login button in your comment area through that app, not sure how it will interact with the mod.

but I would start be cleaning everything up and/or starting over with a fresh copy of your template that you are using...

If you give me a link to the template you are using, I may have time later this week to look at it but am getting off the computer for tonight.

UPDATE:
I think you need to remove this code from your page to get it to work correctly...
Code: [Select]
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
  FB.init({appId: '<<REMOVED FOR SECURITY>>', status: true, cookie: true, xfbml: true});
  FB.Event.subscribe('auth.sessionChange', function(response) {
    if (response.session) {
      // A user has logged in, and a new cookie has been saved
    } else {
      // The user has logged out, and the cookie has been cleared
    }
  });
</script>

This is the one in your <HEAD></HEAD> area...
I think it is conflicting with this mod. I believe it was installed when you added your comments from facebook.
My mod should accomplish the same thing and your comments should still work.

Let me know if you are still having troubles.


Thanks for everything. I actually uploaded the back-ups, cleaned the code out a bit, then redid the mod and it worked. And as for the comments, I am going to remove it and add the comments that came with 4images using the facebook profile picture mod. The only reason I used facebook comments in the first place is because the profile pictures.

Thanks again,
Coulton
Title: Re: [MOD] Facebook Connector V1.0
Post by: alemam on July 21, 2010, 05:47:29 PM

after login Can not view member information

And form login non-hidden

after login in user facebook

see photo

(http://games.mofadlty.com/Untitled-3.gif)
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 21, 2010, 07:54:07 PM
@ alemam,
Sometimes it takes a second or two to get in...
I would recheck all inserts in the mod.
Can you provide a link so I can see what is happening?
Does it create a user account for the user that logged in with facebook?
Title: Re: [MOD] Facebook Connector V1.0
Post by: alemam on July 21, 2010, 09:11:49 PM
this my link http://games.mofadlty.com

not  create a user account for the user that logged in with facebook
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 21, 2010, 10:13:08 PM
@ alemam,
When I looked at the source of your page I saw this...
Code: [Select]
            function login(){
                document.location.href = 'http://games.mofadlty.com/?fb_status=1';
There should be an index.php in front of the ? symbol...

This is what mine looks like on my original page...
Code: [Select]
            function login(){
                document.location.href = 'http://www.budduke.com/index.php?sessionid=6c29a7e2d7b7b4708db6f8fda913354c&fb_status=1';

Something is not right, in the pageheader.php file it should pass self_full which should be the full path including the session if needed...
Do a search for self_full in the pageheader.php file to see if anything is changed in that area.
Title: Re: [MOD] Facebook Connector V1.0
Post by: alemam on July 22, 2010, 11:02:57 AM
it's good my _   page_header.php

danlowd my page_header.php

http://games.mofadlty.com/page_header.zip

this form your source siter

Code: [Select]
            function login(){
                document.location.href = 'http://www.budduke.com/index.php?fb_status=1';
            }
            function logout(){
                document.location.href = 'http://www.budduke.com/index.php?fb_status=1';



Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 22, 2010, 12:17:08 PM
@akemam,

I will need to see all the files that where changed, if you can zip all them together for me to look at...
Title: Re: [MOD] Facebook Connector V1.0
Post by: alemam on July 22, 2010, 12:44:21 PM


http://games.mofadlty.com/games_fc.zip

Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 22, 2010, 03:07:58 PM
@alemam,
You can try this modified login.php file...
Not sure why you removed some of the code that was there...
http://www.budduke.com/files/login.zip (http://www.budduke.com/files/login.zip)

If this does not work then I think it something to do with your google-friendy mod or something else I am overlooking.
If you could temporarly remove the google friendly code, if it is easy enough, to see if everything works at that time and let me know.

Also, did you add the code too ALL these pages?
categories.php, lightbox.php, member.php, register.php, rss.php, top.php, index.php, postcards.php, search.php, and details.php ?
Title: Re: [MOD] Facebook Connector V1.0
Post by: alemam on July 22, 2010, 04:12:58 PM
yes i do something with your google-friendy mod in sessions.php and functions.php

you can see all files form here   http://games.mofadlty.com/files.zip


and i test new files and only edit [MOD] Facebook Connector V1.0

and same problem


very sorry for the inconvenience
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 22, 2010, 05:24:43 PM
Before I look through these files, can you make sure that you added the code too ALL these pages?
categories.php, lightbox.php, member.php, register.php, rss.php, top.php, index.php, postcards.php, search.php, and details.php ?
Code: [Select]
include_once(ROOT_PATH.'facebook/fbstatus.php');//MOD facebook connect
I looked at the index.php file and did not see it. Without that code it will not check to see if you are logged in or not.
Title: Re: [MOD] Facebook Connector V1.0
Post by: alemam on July 22, 2010, 06:24:43 PM
Thanks!

The problem was I did not pay attention to this choice

it's working now

I am going to translate into Arabic How of installation...

Thank you very much for the help
Title: Re: [MOD] Facebook Connector V1.0
Post by: piczilla on August 03, 2010, 02:15:23 AM
Hey,

I have an idea. I don't know if it will be hard to integrate, but here it goes:

I have tons of friends on facebook that upload their photography through there. I was wondering if there was a way for them to connect with my site and transfer their images over to my site. Is that possible?

Coulton
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on August 04, 2010, 02:02:05 AM
I have an idea. I don't know if it will be hard to integrate, but here it goes:

I have tons of friends on facebook that upload their photography through there. I was wondering if there was a way for them to connect with my site and transfer their images over to my site. Is that possible?

I knew when I was creating this mod I was opening up a can of worms  :lol:

I think the answer is yes, it can be done, but not sure. I compared other gallery scripts (not 4images) and I found a couple of tries at it and I guess it is working for them.
Looking at the API calls that you can make to facebook, it should be possible.
Looking at Facebook's policies...
http://developers.facebook.com/policy (http://developers.facebook.com/policy)
Quote
2.You may cache data you receive from the Facebook API in order to improve your application’s user experience, but you should try to keep the data up to date. This permission does not give you any rights to such data (including the right to transfer) absent explicit consent from the users who own the data.
3.Users give you their basic account information when they connect with your application. For all other data, you must obtain explicit consent from the user who provided the data to us before using it for any purpose other than displaying it back to the user on your application. A user’s friends’ data can only be used in the context of the user’s experience on your application.

It looks like you are able to pull images from your own account, not friends or groups unless you are the owner of that photo as long as you have something posted on the 4images side that the user gives consent to do so and Facebook is also wanting in their policy for the user to be able to quickly and easily remove the images from your site if they choose to.

My vision of how this should look on the 4images side would be...
when the user is in a category that they have rights to upload to there would be an extra button at the top 'import from facebook album' and then they would see a list of their albums and then a list (thumbnails) of the photos in the album to choose from and then import them.
On the flip side, maybe a button on the details or lightbox page that has 'export to facebook album' and kinda doing the same thing.

Is that what you had in mind?

It sounds like an interesting adventure for the next version of this mod. I am already working on a way to track the likes/shares per image so you can have them on your TOP page like the ratings and downloads so I will add this to the list.

I will be honest, I am not on the computer much in the summer, computer room is 100degrees with 90% humidity, so I am on my computer very little till the heat passes so don't expect this to happen overnight unless someone else wants to take it on...

If anyone has any other ideas for the facebook integration, now would be a good time to ask...

I will post if I was successful or not when I get to that point.
Title: Re: [MOD] Facebook Connector V1.0
Post by: Lucifix on August 04, 2010, 02:58:22 PM
I'm testing MOD and till now everything is working just fine. But my concerns are that when user register with FB account he doesn't agree with Term of Services of my website. I mean OK, who does read that? But what would happened if anything goes wrong and user said that he didn't have change to read them and so he can't agree with them.

I saw great integration with FB connection on this side:
http://www.workstir.com

When you sign in with FB account you must still fill some of the information: like password, username, ..., and agree with TOS.

Check it out, maybe someone will have idea how to integrate this in 4images gallery.
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on August 05, 2010, 01:10:06 AM
@ Lucifix,
I am glad you described what it should do because when I logged in with my facebook account the dialog just disappeared. I did not see any of the other stuff you was talking about until I clicked on the account tab. I would think this would be possible.

My thought are that a site should be easy for people to sign up and not cumbersome. I feel asking for all that info again would turn me away because why would I sign in with facebook if I have to fill the stuff in anyway, I might as well just signed up the old fashion way.

I do agree with you that they should have to agree to your terms for your site also before allowed access. It should not be allot of work to make happen. I am just torn about the user having to create a username/password when they just logged in with their username/password for facebook. I may make it so the admin can decide which way to do it. I also cheated their system by using a different e-mail then what I use for facebook and they did not catch it, so that site has a bogus e-mail for my account when they should have just pulled the e-mail from facebook which could lead to spammers maybe...

I do have the one extra field in the user database that may be used for this purpose because the user is set as 'new' when they sign in with facebook, maybe another screen could show up when they log in that after agreeing to terms then it would change them from 'new' to 'registered' and then things should be good legally for you.

It is on the list of things to update...
Title: Re: [MOD] Facebook Connector V1.0
Post by: Lucifix on August 05, 2010, 02:02:04 PM
Yes I agree with you that you should give users to many options when they register. And that is all about Facebook connection! Right now I'm without idea how/where to insert option that new user must agree with TOS on site. Maybe little popup window on first connect that would warn user about TOS?
Title: Re: [MOD] Facebook Connector V1.0
Post by: Lucifix on August 18, 2010, 11:46:15 AM
Am I the only one who is having problems with login through Facebook account? When I click on Facebook login button nothing happens. So I need to refresh site to see that I'm logged in. I tried this in IE, FF and Chrome.
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on August 18, 2010, 04:31:38 PM
Am I the only one who is having problems with login through Facebook account? When I click on Facebook login button nothing happens. So I need to refresh site to see that I'm logged in. I tried this in IE, FF and Chrome.

Are you using google friendly links?
I do know the current mod places ?fbstatus=1 at the end to tell the script that you just logged in. if it does not see it on the link then it has to wait to a refresh.

I am going to be going through the mod in the next couple weeks to cleanup the code a little more, maybe I can find a way of using session variables instead of the link code...
Title: Re: [MOD] Facebook Connector V1.0
Post by: rekorderek on October 22, 2010, 05:31:26 PM
Hi Budduke,

I would like to congratulate the time, you're a genius!
4images shaping the system for more than 1 month and is now stuck at work.

The access control system I would like to integrate the facebook-el 4images, but I can not find the file install_facebook.php.
I'm looking for here: http://github.com/facebook/php-sdk/
but unfortunately there is not.

Could you help me? I pay for the course.
thanks,
Jean Mitchel, from Hungary
Title: Re: [MOD] Facebook Connector V1.0
Post by: Lucifix on October 22, 2010, 06:39:41 PM
Hi Budduke,

I would like to congratulate the time, you're a genius!
4images shaping the system for more than 1 month and is now stuck at work.

The access control system I would like to integrate the facebook-el 4images, but I can not find the file install_facebook.php.
I'm looking for here: http://github.com/facebook/php-sdk/
but unfortunately there is not.

Could you help me? I pay for the course.
thanks,
Jean Mitchel, from Hungary

Check 1st post for attachments (at the bottom)
Title: Re: [MOD] Facebook Connector V1.0
Post by: rekorderek on October 22, 2010, 09:11:23 PM
Thank You Lucifix, Budduki

"this mod is based on the facebook php-sdk kit that is available at...
http://github.com/facebook/php-sdk/
Place the facebook_install.php file in the root of your gallery and run it to add the fields to your user table. (DELETE THIS FILE AFTER YOU RUN IT!)" from 1. post

http://developers.facebook.com/plugins - here, unfortunately I can not find the code install_facebook.php, fbmain.php

I'm looking for a whole day, but I do not know what to do, pls help me
Title: Re: [MOD] Facebook Connector V1.0
Post by: Lucifix on October 22, 2010, 09:14:37 PM
If you look at the end of 1st post you'll see attached file Facebook_connect.zip

If you unzip it you'll find install_facebook.php

Here you go, to make it easier:
http://www.4homepages.de/forum/index.php?action=dlattach;topic=27396.0;attach=5471
Title: Re: [MOD] Facebook Connector V1.0
Post by: rekorderek on October 25, 2010, 06:32:09 AM
Thank you very much.
Selective according to their sight, as I returned several hours and could not find the first comment. It is incredible that we have, thank you very much. This forum is worthy of recognition at the international level. I am glad that you are. :)
Title: Re: [MOD] Facebook Connector V1.0
Post by: rekorderek on November 22, 2010, 08:23:38 PM
Hi,
Great module, thanks for Bud!
Character encoding problem with my site.
UTF8 was when I went to the fbmain.php file, then the user's name appears correctly on facebook. accented characters appear together in a nickname, but the other accented characters in place of '? " question mark appears - this is a bug
Ansi mode without boom when I went to the file, then strange characters appear instead of accented characters.
Anybody got any idea?
Thank you very much progress, too!

ansi:
(http://altalanos.info/fb.png)

utf8 with question mark
(http://altalanos.info/utf8.png)
Title: Re: [MOD] Facebook Connector V1.0
Post by: tramfahrer on November 25, 2010, 07:06:27 PM
Hi i made the changes like on the first page, but i get HTTP 500 error ??

whats wrong ... ??

Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on November 25, 2010, 11:31:55 PM
Hi i made the changes like on the first page, but i get HTTP 500 error ??

whats wrong ... ??


I need more information, When are you getting the http 500 error?
Did you recheck all steps?
Does your site meet the requirements posted at the top of the mod?
Do you have a link that I can see the problem in action?
Title: Re: [MOD] Facebook Connector V1.0
Post by: tiberiur on November 27, 2010, 04:50:46 PM
i try to install Facebook Connector v1.0 mod on my 4gallery site but i get an error.
When i running facebook_install.php the installation status say:

Code: [Select]
   1. Error:

      ALTER TABLE `4images_users` ADD `fb_userid` VARCHAR(255) NOT NULL, ADD `fl_facebook` ENUM(\'new\',\'normal\',\'registered\') NOT NULL DEFAULT \'registered\'

myphp version is: PHP Version 5.2.9

Can you help me guys?
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on November 28, 2010, 12:22:10 AM
i try to install Facebook Connector v1.0 mod on my 4gallery site but i get an error.
When i running facebook_install.php the installation status say:

Code: [Select]
  1. Error:

      ALTER TABLE `4images_users` ADD `fb_userid` VARCHAR(255) NOT NULL, ADD `fl_facebook` ENUM(\'new\',\'normal\',\'registered\') NOT NULL DEFAULT \'registered\'

myphp version is: PHP Version 5.2.9

Can you help me guys?

Some servers are having problems running the installer I created so you may have to add the field manually..
See this post http://www.4homepages.de/forum/index.php?topic=27396.msg148838#msg148838 (http://www.4homepages.de/forum/index.php?topic=27396.msg148838#msg148838)
and look at the bottom to see how it should look in your phpadmin
Title: Re: [MOD] Facebook Connector V1.0
Post by: tiberiur on November 28, 2010, 06:35:14 PM
How can I add them manually?

Thanks
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on November 30, 2010, 12:35:27 AM
How can I add them manually?

Thanks
By asking that question I am assuming you have not worked with your database administration interface for you site before...
I would hate for you to try things that could destroy your entire site if you did them wrong.
Let me think about this a little more and see if I can come up with a different database installer file for you to try...

I wish one of my test servers gave the same symptoms so I knew when I had it fixed but all of my servers run the installer just fine
Title: Re: [MOD] Facebook Connector V1.0
Post by: tramfahrer on December 02, 2010, 07:29:39 PM
Hi i made the changes like on the first page, but i get HTTP 500 error ??

whats wrong ... ??


I need more information, When are you getting the http 500 error?
Did you recheck all steps?
Does your site meet the requirements posted at the top of the mod?
Do you have a link that I can see the problem in action?


after the first Step, i made the changes I get the 500 Error...
i check all steps
my phpversion allows CURL an that other feature ,,,,

www.tram-und-bahnbilder.de is my site ...
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on December 02, 2010, 09:16:02 PM
@ tramfahrer,
I did not see the facebook connector on that link you sent.
Can you setup a test site with the mod installed and send me a link?
Title: Re: [MOD] Facebook Connector V1.0
Post by: tramfahrer on December 02, 2010, 09:25:34 PM
@ tramfahrer,
I did not see the facebook connector on that link you sent.
Can you setup a test site with the mod installed and send me a link?

i made the changes back... 
the testsite comes in a few days ...
Title: Re: [MOD] Facebook Connector V1.0
Post by: comicart on December 19, 2010, 06:05:50 AM
I installed this successfully (I think) I'm getting an error.
http://alrioart.com/

When some clicks "log in to facebook" the pop up window says "An Error Occured"
An error occurred. Please try again later.

Could it by my fbmain file?

It starts out like this...
Code: [Select]
$fbappid = "<<numbers>>";
$fbapi = "<<more_numbers>>"; //facebook api
$fbsecret = "<<numbers_and_letters>>"; //facebook secret
$fbdomain = "<<alrioart.com>>"; //facebook domain

Is that correct or should I take out the << and >>?

I just tried it without the << and >> and it made no difference. I still get that error. :(

I click on Log In With Facebook and view the link and see the AP Id and FP api  is not showing. Instead it shows fbappid and fbapi.
I tried changing fbmain files to the earlier version reported here on these threads and it did not change this.
Users still can't log in.
Can anyone help? Maybe I have it set up wrong at Facebook? They have a different interface now than the screen shots that accompany this tutorial.

2:53am EST.
I've been looking at these files and making sure I have the right thing done. I just don't get it. Everything is done right it should be working.


Terry

Terry
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on December 20, 2010, 09:05:00 PM
@comicart,

please look at this post...
http://www.4homepages.de/forum/index.php?topic=27396.msg148725#msg148725 (http://www.4homepages.de/forum/index.php?topic=27396.msg148725#msg148725)
Mainly the change you need to make in the pageheader.php file

That should fix your problem,

Sorry for the delay, my computer crashed 5 days ago, lost 750gig of data and work...
Maybe someday I will learn why backup is so important. But for now, I just cry allot...
Title: Re: [MOD] Facebook Connector V1.0
Post by: comicart on December 20, 2010, 09:13:16 PM
Ack! That is terrible news!
Thanks for writing during this crisis.

My Issue now seems to be with the "add modification to this script.
This now shows a broken link under the names of users *not* registered through Facebook.
See here for an example of a broken image in the comments section (Scroll down):
http://alrioart.com/details.php?image_id=4221

Here is an example of it actually working.
http://alrioart.com/details.php?image_id=4259


Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on December 21, 2010, 04:58:56 PM
@comicart,
Look around the last insert in the details.php file, that is where the graphic is added.
The code looks correct and as long as the user allows the avatar and they have a facebook account it should display, otherwise it will not.
My site does not show the symptoms that yours has...

Can you zip and attach your details.php file for me to look at?
Title: Re: [MOD] Facebook Connector V1.0
Post by: comicart on December 21, 2010, 07:21:36 PM
Thanks for looking. I can't see the mistake myself.
Terry
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on December 21, 2010, 07:45:35 PM
Thanks for looking. I can't see the mistake myself.
Terry

The file looks correct, looking at the source code on the page with an error the fb_userid on that user is set to "registered"
That field should be blank for every user unless they have an account with facebook, then it should contain their numeric userid with facebook.

I think you will find your error in how the fb_userid was created in your database. the registered should be related to fl_facebook field instead.
Title: Re: [MOD] Facebook Connector V1.0
Post by: comicart on December 21, 2010, 07:56:00 PM
I think you will find your error in how the fb_userid was created in your database. the registered should be related to fl_facebook field instead.

But it is - see?
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on December 21, 2010, 08:55:13 PM
@comicart,
this is what the source code looks like for that page with the error.
Quote
    <b>christophe</b><br />
   Member<br /><img src="http://graph.facebook.com/registered/picture" /><br /><
Look at the database under that user "christophe" in their "fb_userid" field and what is written there?
From the code above, you should see "registered" which should not be in that field. If it is there then delete it and then the avatar should not show up for that user.
Title: Re: [MOD] Facebook Connector V1.0
Post by: comicart on December 21, 2010, 09:21:04 PM
Thanks - I did that and that user doesn't show up.
However I have hundreds of comments from people who are now showing as "registered".
Is there a Sql command that will change ALL of my existing users except alrioart to "blank" instead of registered?

Terry
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on December 23, 2010, 12:53:03 AM
Thanks - I did that and that user doesn't show up.
However I have hundreds of comments from people who are now showing as "registered".
Is there a Sql command that will change ALL of my existing users except alrioart to "blank" instead of registered?

Terry

Have not tested it but I think this will work. backup your database just in case...
Code: [Select]
UPDATE 4images_users SET fb_userid = '' WHERE 4images_users.user_name <> 'alrioart'
Title: Re: [MOD] Facebook Connector V1.0
Post by: comicart on December 23, 2010, 02:24:19 AM
Perfect! Thanks so much!
T

New Problem - the "numbers" beside Share and Like seem to be skewed.
I've got the *exact same* number count on Likes and Shares for an image.

For example - 54 of each on this image:
http://alrioart.com/details.php?image_id=4268

4 of each on this image:
http://alrioart.com/details.php?image_id=2573

Anyone else have this same problem?
Title: Re: [MOD] Facebook Connector V1.0
Post by: uploadeur on March 23, 2011, 11:47:27 PM
There is no easyway to make this? I just want to share tumbnails in facebook? How can do this with an easyway?
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on March 24, 2011, 12:55:41 AM
New Problem - the "numbers" beside Share and Like seem to be skewed.
I've got the *exact same* number count on Likes and Shares for an image.

For example - 54 of each on this image:
http://alrioart.com/details.php?image_id=4268

4 of each on this image:
http://alrioart.com/details.php?image_id=2573

Anyone else have this same problem?
I have not paid attention to this but I see what you are talking about. I have noticed facebook has updated/changed the way things work for connector but my way still seems to work but I am planning on sitting down and redoing this mod using the new coding facebook is wanting, maybe it will work better but it is such a pain to work with facebook unless you do it everyday so no eta when it will be ready to post.

There is no easyway to make this? I just want to share tumbnails in facebook? How can do this with an easyway?
I thought other people already had ways of doing it a little easier if you search for facebook in the search on this forum. I am not sure if they actually give just the link to the page or the thumbnail.
The problem I saw with posting thumbnails to facebook is that they need certain things in the header of the page for it to work and it is info that 4images does not use all the time so it takes a little trial and error.
I would think it should not be that hard to come up with something. I will look into it and post anything I can find unless someone else knows that one of the other posted sharings are actually posting the thumbnails or not.
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on March 28, 2011, 12:15:19 AM
@comicart,
The shares and like are being combined as one entity on facebook. I believe that they will be moving everything to the Like button from now on.

@uploader,
I just posted my version of the like button for you to try out,
am waiting for it to be moved to the mods section before I post a link to it.
Title: Re: [MOD] Facebook Connector V1.0
Post by: comicart on April 04, 2011, 06:03:56 AM
I had to uninstall this mod today.
So many times since I've installed it I've tried to go to a random page on my site and the browser kept loading and reloading over and over and over - and I know it was the Facebook login trying to work. But that's not a good user experience so I took it out.

Terry
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on April 04, 2011, 12:15:21 PM
I had to uninstall this mod today.
So many times since I've installed it I've tried to go to a random page on my site and the browser kept loading and reloading over and over and over - and I know it was the Facebook login trying to work. But that's not a good user experience so I took it out.

Terry

I think you might be running into the same thing I did and it had nothing to do with this mod that I can find.
What happens when you load my site? http://www.budduke.com (http://www.budduke.com)
I found my site was doing it after I upgraded to IE9 and found out it was Java and Flash that was causing my problem and not any mods I had installed.
After I put the latest Java and the Latest flash, then my site loaded just fine, or when testing I removed any Java/flash stuff from my site and it also worked.
Title: Re: [MOD] Facebook Connector V1.0
Post by: comicart on April 05, 2011, 06:55:08 AM
What happens when you load my site? http://www.budduke.com (http://www.budduke.com)

Nothing - it appears normal.

I found my site was doing it after I upgraded to IE9 and found out it was Java and Flash that was causing my problem and not any mods I had installed.
After I put the latest Java and the Latest flash, then my site loaded just fine, or when testing I removed any Java/flash stuff from my site and it also worked.

I never use IE. Just Firefox Mac and Safari Mac.
Thanks for the help though.

Terry
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on April 05, 2011, 03:58:46 PM

I never use IE. Just Firefox Mac and Safari Mac.
Thanks for the help though.


I use Macs also in my testing but have not seen any strange issues...
I am working on a newer version of this mod right now, not sure when will be ready. I will try to make it so it does not have to do so many refreshes when it logs in.
Title: Re: [MOD] Facebook Connector V1.0
Post by: qBass17 on April 25, 2011, 11:47:31 AM
Works perfect with 4images 1.7.9

+ Manual Database (Link (http://www.4homepages.de/forum/index.php?topic=27396.msg148838#msg148838))
Code: [Select]
CREATE TABLE IF NOT EXISTS `4images_users` (
  `fb_userid` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `fl_facebook` enum('new','normal','registered') CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'registered',
  PRIMARY KEY (`user_id`),
  KEY `user_lastaction` (`user_lastaction`),
  KEY `user_name` (`user_name`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
+ PHP 5 (Link (http://www.4homepages.de/forum/index.php?topic=27396.msg148725#msg148725))
Title: Re: [MOD] Facebook Connector V1.0
Post by: qBass17 on April 27, 2011, 09:06:07 PM
Costum text for the Facebook Button
Example
in the your_template_folder\user_loginform.html & your_template_folder\user_loginform.html file...
find
Code: [Select]
<fb:login-button size="small" length="long" autologoutlink="true" perms="email,user_website,publish_stream"></fb:login-button>Replace with:
Code: [Select]
<fb:login-button size="small" length="long" autologoutlink="true" perms="email,user_website,publish_stream">{lang_login}</fb:login-button>
Title: Re: [MOD] Facebook Connector V1.0
Post by: comicart on June 19, 2011, 03:23:35 AM
I had to uninstall this mod today.
Terry

Since uninstalling I haven't been able to Approve users who register.
When I go to the admin and try to change someone from Registered User (not active) to Registered User, I get this error in red:
Please recheck the marked fields.
*
And there's a blank field after "Last Activity".

Is there something obvious I'm missing?
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on June 19, 2011, 01:56:41 PM
I had to uninstall this mod today.
Terry

Since uninstalling I haven't been able to Approve users who register.
When I go to the admin and try to change someone from Registered User (not active) to Registered User, I get this error in red:
Please recheck the marked fields.
*
And there's a blank field after "Last Activity".

Is there something obvious I'm missing?

If you leave the "last activity" blank, it should not error. It should use the default date. If you zip and send me the changed files, I could take a look.

If you could PM me the reason why you unistalled it, Facebook is redoing their login stuff right now. I have version 2 of the mod almost ready but waiting for facebook to update their javascript to include the new login stuff. The new mod only refreshes once and only adds .02 seconds to the page load time. If there are other issues I would love to have the fixed before publishing it.
Title: Re: [MOD] Facebook Connector V1.0
Post by: comicart on June 19, 2011, 04:57:06 PM
It's not the "last activity" field that's giving a problem.
It's the field *after* it where I assume the facebook name went.

Do you know what file that's in?
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on June 19, 2011, 06:25:03 PM
It's not the "last activity" field that's giving a problem.
It's the field *after* it where I assume the facebook name went.

Do you know what file that's in?

That blank field should be the fb_userid field. Not sure why it is being registated as a required field. I can make mine blank and it still saves changes.
I never noticed anything appeared in the admin area of the edit user on this mod, will have to modify that on the new one.
You could put something like 99999999999999999 in the field to get by the error or remove the field from your database.
Version 2 will still be using that field but it will change it back to the correct # when they login with their facebook account.
Title: Re: [MOD] Facebook Connector V1.0
Post by: comicart on June 19, 2011, 10:01:58 PM
Thanks - removing it from the DB fixed it.
I appreciate your help. Looking forward to the next version.
Title: Re: [MOD] Facebook Connector V1.0
Post by: XIIIX on June 23, 2011, 03:10:31 AM
I just started to add this mod but I cant seem to get around this...would you guys help me out here? What could It Be?


Code: [Select]
Parse error: syntax error, unexpected T_CONST in /home5/nonsens5/public_html/gallery/facebook/fbmain.php on line 6
I had no problem adding the code except on the header file in my templates with the area where you have to add after this:


Code: [Select]
<body bgcolor="#FFFFFF" text="#0F5475" link="#0F5475" vlink="#0F5475" alink="#0F5475">
<br />
add this
Code: [Select]
  <div id="fb-root"></div>
        <script type="text/javascript">
            window.fbAsyncInit = function() {
                FB.init({appId: '{fb_appid}', status: true, cookie: true, xfbml: true});

                /* All the events registered */
                FB.Event.subscribe('auth.login', function(response) {
                    // do something with response
                    login();
                });
                FB.Event.subscribe('auth.logout', function(response) {
                    // do something with response
                    logout();
                });
            };
            (function() {
                var e = document.createElement('script');
                e.type = 'text/javascript';
                e.src = document.location.protocol +
                    '//connect.facebook.net/{fbl_lang}/all.js';
                e.async = true;
                document.getElementById('fb-root').appendChild(e);
            }());

            function login(){
                document.location.href = '{self_full}{fb_status}';
            }
            function logout(){
                document.location.href = '{self_full}{fb_status}';
            }
</script>
Uhm Im using Iceberg's template.

btw my code on fbmain is the next:
Code: [Select]
const FBAPPID="asldkfjklñasdfjlñksdafjlñkjklñ";//facebook app id
const FBAPI="alksadjflñksadjflñksadfjñlksadjflñk"; //facebook api key
const FBSECRET="lkjlñkjñlkjñlkjñlkjñlkjñkljlñkjlñkjlk"; //facebook secret
const FBDOMAIN="www.nonsenseinc.org"; //facebook base domain

I´ve checket the FB++ are the correct ones...

I cant even acces the main site of my gallery, what could It Be?

Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on June 23, 2011, 05:39:10 PM
@ XIIIX,
look at this reply further up this post...
http://www.4homepages.de/forum/index.php?topic=27396.msg148725;topicseen#msg148725 (http://www.4homepages.de/forum/index.php?topic=27396.msg148725;topicseen#msg148725)

that should fix your error message,
The template...
You will need to insert this after the <body> tag area of the template. (I do not have that template installed to say exactly where)
Title: Re: [MOD] Facebook Connector V1.0
Post by: XIIIX on June 23, 2011, 07:02:06 PM
Ok Im sorry to bother this much but thanks to you I can see the website again! But I've got 2 problems...
When someone tries to log in with facebook an error message is displayed.

Quote
An error occurred. Please try again later
<--NVM i think this one is because I havent submitted the application with the 10monthly active users.

And the way every box content is displayed is a little messed up, for example the footer has disappeared and a lot has moved, where can I correct this? on my templates or on the main directory of my gallery?

Here, check it out.

www.nonsenseinc.org/gallery
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on June 23, 2011, 07:18:43 PM
@ XIIIX,

looking at your sourcecode on your pages, that template is using <div> instead of tables..
this is what I saw...
Code: [Select]
<li><a href="./register.php?sessionid=u1qrggq1uerkhe4lii54bs6ti3">Registration</a></li>
  </tr><tr><td valign="top" align="center">
  <fb:login-button size="small" length="long" autologoutlink="true" perms="email,user_website,publish_stream"></fb:login-button>
</td>
</ul>  
 
</div>

I would change it to this...
Code: [Select]
<li><a href="./register.php?sessionid=u1qrggq1uerkhe4lii54bs6ti3">Registration</a></li>
</ul>  
<fb:login-button size="small" length="long" autologoutlink="true" perms="email,user_website,publish_stream"></fb:login-button>
 </div>
Title: Re: [MOD] Facebook Connector V1.0
Post by: XIIIX on June 23, 2011, 07:25:33 PM
Hmmm I changed it on every file I could find but its still the same...
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on June 23, 2011, 09:01:50 PM
Hmmm I changed it on every file I could find but its still the same...

It looks like something with that template. Can you send me a link for that template so I can see what it is doing?

also the "try again later", so do not have the appid and key in correctly.
I have not seen a number like that (it is usually all numeric) and not with all the sybols in it. What language is it in?
Title: Re: [MOD] Facebook Connector V1.0
Post by: XIIIX on June 24, 2011, 01:44:05 AM
Ok so...
The template Im using is this:

http://www.4homepages.de/forum/index.php?topic=18761.0

The appid key and connections are changed on the files because they´re supposed to be secret... Im just having this little issue that bothers me is the domain..im using my website and My website is www.nonsenseinc.org but what I want people to connect too is to nonsenseinc.org/gallery because thats where the images are :)
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on June 24, 2011, 02:23:28 AM
Ok so...
The template Im using is this:

http://www.4homepages.de/forum/index.php?topic=18761.0

The appid key and connections are changed on the files because they´re supposed to be secret... Im just having this little issue that bothers me is the domain..im using my website and My website is www.nonsenseinc.org but what I want people to connect too is to nonsenseinc.org/gallery because thats where the images are :)

in your template folder, the user_loginform.html and user_logininfo.html files...
Place the login button AFTER the last </ul> in those files (it did not mess anything up in the template on my computer)
Code: [Select]
<fb:login-button size="small" length="long" autologoutlink="true" perms="email,user_website,publish_stream"></fb:login-button>just put in the code above and not the other tags around it in my original post.

The code that I told you to place in the header file at the end, the <div id="fb-root"> code, place that code in your header.html file after the <div id="container">

for the app stuff, yes, do not share that info, I just noticed when I click on the login, it was trying to use the garbled info for the login and not using the app-id.
You can still use and run an app of facebook, you just can not get it published in their directory of apps until you have enough people using it.
The domain for your app would be nonsenseinc.org and the connect url on your facebook app would be http://www.nonsenseinc.org/gallery/ (notice the last slash, important)
Title: Re: [MOD] Facebook Connector V1.0
Post by: XIIIX on June 24, 2011, 02:54:28 AM
Ok I added the code where you said I needed to add it but the Login to Facebook section disappeared.. :/
This is the code:

User-loginform
Code: [Select]
    <form action="{url_login}" method="post">
        {lang_user_name}<br />
        <input type="text" size="14" name="user_name" class="search" />
        <br />
        {lang_password}<br />
        <input type="password" size="14" name="user_password" class="search" />
        <br />
        <table border="0" cellspacing="0" cellpadding="0">
          <tr valign="top">
            <td><input type="checkbox" name="auto_login" value="1" /></td>
            <td>Remember Me?</td>
          </tr>
        </table>
        <br />
<input type="submit" value="{lang_login}" class="button" />
      </form>
<br />  
<ul>
<li><a href="{url_lost_password}">{lang_lost_password}</a></li>
<li><a href="{url_register}">{lang_register}</a></li>
</ul>
<fb:login-button size="small" length="long" autologoutlink="true" perms="email,user_website,publish_stream"></fb:login-button>


User.Logininfo
Code: [Select]
{lang_loggedin_msg}<br /><br />
<ul>
<li><a href="{url_lightbox}">{lang_lightbox}</a></li>
<li><a href="{url_control_panel}">{lang_control_panel}</a></li>
<li><a href="{url_logout}">{lang_logout}</a></li>
</ul>
<fb:login-button size="small" length="long" autologoutlink="true" perms="email,user_website,publish_stream"></fb:login-button>
EDITTTTTTT

Ok I think to managed it for the logo to appear, now, when I click log in with facebook it starts to like log out and log in constantly...try it yourself

www.nonsenseinc.org/gallery/

BTW when I run the facebook_install I get this error:
Error:

ALTER TABLE `4images_users` ADD `fb_userid` VARCHAR(255) NOT NULL, ADD `fl_facebook` ENUM(\'new\',\'normal\',\'registered\') NOT NULL DEFAULT \'registered\'

budduke I thank you very much for your time and help I will surely point out in my website that you helped BIG TIME hahaha
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on June 26, 2011, 12:44:46 AM
regarding @XIIIX issues,
The problem seemed to be a firewall issue. Also had to manually add the database fields to database to get it to work.
Title: Re: [MOD] Facebook Connector V1.0
Post by: Rembrandt on June 26, 2011, 05:13:22 AM
Hi!

@budduke, Before you make continued here, should @XIIIX this read.
http://www.4homepages.de/forum/index.php?topic=29705.msg157871#msg157871

@XIIIX , What should that?
Title: Re: [MOD] Facebook Connector V1.0
Post by: daniel.carneiro on June 26, 2011, 06:11:29 AM
Hi Guys,

I did all in tutorial. My facebook connector is ok. Somes issues:

1 - My albuns is all private. Only registered user could login and view photos.

2 - When user login with facebook acount, but not registered, facebook login ok, but not access the albuns. Sure! It's ok. However appears the message:

An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.

And the rest of the site is ok.

Can I block and only give permissions to certain users log on to facebook account? My settings are for only the user can log in when I release the control panel (no facebook accounts).

3 - When I include manually an user adress that is registered on facebook, the message appears:


An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.

Warning: Cannot modify header information - headers already sent by (output started at /home/daniela1/public_html/fotos/includes/db_mysql.php:192) in /home/daniela1/public_html/fotos/includes/sessions.php on line 102

Warning: Cannot modify header information - headers already sent by (output started at /home/daniela1/public_html/fotos/includes/db_mysql.php:192) in /home/daniela1/public_html/fotos/includes/sessions.php on line 102

Warning: Cannot modify header information - headers already sent by (output started at /home/daniela1/public_html/fotos/includes/db_mysql.php:192) in /home/daniela1/public_html/fotos/includes/sessions.php on line 102

Warning: Cannot modify header information - headers already sent by (output started at /home/daniela1/public_html/fotos/includes/db_mysql.php:192) in /home/daniela1/public_html/fotos/includes/functions.php on line 114


If I go back, the message disapears.

4 - If I am a user that have facebook account, I can login in the site. Can I block and only give permissions to certain users log on to facebook account? My settings are for only the user can log in when I release the control panel (no facebook accounts).


Anyone help me?
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on June 26, 2011, 02:19:50 PM
@Rembrandt,
Sorry, did not notice they had the footer missing from their site. I PM'd them.

@daniel.carneiro,
The unexpected error is usually something to do with the database. Either a field that is missing or something along those lines.
Make sure the fb_userid and fl_facebook fields are in your user database in phpadmin.
At this time, no, you can not decide who can login with facebook.
At first, I thought you were wanting the button to only appear to certain users. but why login with facebook if you are already logged in?
I am assuming you want people to login with facebook but get stopped at the registation until you OK it in the admin panel.
I am working on version 2 of this mod. Waiting for facebook to update thier javascript before continueing.(I think they said July)
I have it so the user has to registar after they login and I can easly do the wait till admin approves before continueing.
Title: Re: [MOD] Facebook Connector V1.0
Post by: daniel.carneiro on June 26, 2011, 03:20:52 PM
@Rembrandt,
Sorry, did not notice they had the footer missing from their site. I PM'd them.

@daniel.carneiro,
The unexpected error is usually something to do with the database. Either a field that is missing or something along those lines.
Make sure the fb_userid and fl_facebook fields are in your user database in phpadmin.
At this time, no, you can not decide who can login with facebook.
At first, I thought you were wanting the button to only appear to certain users. but why login with facebook if you are already logged in?
I am assuming you want people to login with facebook but get stopped at the registation until you OK it in the admin panel.
I am working on version 2 of this mod. Waiting for facebook to update thier javascript before continueing.(I think they said July)
I have it so the user has to registar after they login and I can easly do the wait till admin approves before continueing.


Ok Budduke. The fb_userid and fl_facebook is in my database. See atachment please.

The error occur when I logged in facebook and I login with my old login (that exists) in my gallery:

Fatal error: Call to a member function getLogoutUrl() on a non-object in /home/daniela1/public_html/fotos/login.php on line 51

If I go back in my browser appears:


DB Error: Bad SQL Query: SELECT * from 4images_users where fb_userid='100000024664271'
Unknown column 'fb_userid' in 'where clause'

DB Error: Bad SQL Query: SELECT * from 4images_users where fb_userid='100000024664271'
Unknown column 'fb_userid' in 'where clause'

DB Error: Bad SQL Query: UPDATE 4images_users set fb_userid='100000024664271' where user_id='1'
Unknown column 'fb_userid' in 'field list'

See in atachaments my archives that appears problem.

Thank you
Title: Re: [MOD] Facebook Connector V1.0
Post by: XIIIX on June 26, 2011, 05:33:26 PM
@Rembrandt

Ill put up the footer on my site ! :D
Can anyone log in with facebook to my site?


www.nonsenseinc.org

It seems everytime you log with facebook the index just reloads automatically unless you click log out.
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on June 26, 2011, 06:46:46 PM
@ XIIIX,
I have tested your site on 3 different computers, one xp, one vista, and one win7 with IE and firefox on all of them.
You site seems to be working correctly on all of them. One thing you may be seeing is if you are logged in already with a 4images account and then press the facebook ligin button. It may be logging out the current user (because the e-mail is different) and then logging back on with the facebook user which makes 2 window refreshes.

@ daniel.carneiro,
I see the problem, You have added 2 new tables with those names. You need to add those 2 fields to your 4images_users table.
In phpadmin open up your 4images database, then open up the 4images_users table, then in the sql tab run this command to add those two fields and you should be good.
Code: [Select]
ALTER TABLE 4images_users ADD  (`fb_userid` varchar(255) NOT NULL,`fl_facebook` enum('new','normal','registered') NOT NULL DEFAULT 'registered')Make a backup first just in case...
Title: Re: [MOD] Facebook Connector V1.0
Post by: daniel.carneiro on June 26, 2011, 07:08:40 PM
@ XIIIX,
I have tested your site on 3 different computers, one xp, one vista, and one win7 with IE and firefox on all of them.
You site seems to be working correctly on all of them. One thing you may be seeing is if you are logged in already with a 4images account and then press the facebook ligin button. It may be logging out the current user (because the e-mail is different) and then logging back on with the facebook user which makes 2 window refreshes.

@ daniel.carneiro,
I see the problem, You have added 2 new tables with those names. You need to add those 2 fields to your 4images_users table.
In phpadmin open up your 4images database, then open up the 4images_users table, then in the sql tab run this command to add those two fields and you should be good.
Code: [Select]
ALTER TABLE 4images_users ADD  (`fb_userid` varchar(255) NOT NULL,`fl_facebook` enum('new','normal','registered') NOT NULL DEFAULT 'registered')Make a backup first just in case...


You're a genious! It's ok now. Allright! Thank you man!
Title: Re: [MOD] Facebook Connector V1.0
Post by: XIIIX on June 26, 2011, 08:28:50 PM
@budduke

Hmmm Maybe its because Im using a MAC. I tried using firefox & safari but it seriously just reloads endlessly...
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on June 26, 2011, 09:13:25 PM
@budduke

Hmmm Maybe its because Im using a MAC. I tried using firefox & safari but it seriously just reloads endlessly...

I have a mac at work I can try out tomorrow and will let you know what happens...
Title: Re: [MOD] Facebook Connector V1.0
Post by: XIIIX on June 27, 2011, 04:51:51 PM
FIXED-------The page kept reloading because the clock was off I didn't realize this until I looked at it at 3am and it said it was 1pm hahahaha


:D
Title: Re: [MOD] Facebook Connector V1.0
Post by: bma2004 on June 29, 2011, 09:21:48 AM

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?

I have a similar problem, in this way it is not decided.

Name and Surname on Facebook - in Russian.

After using your method - can be written on DataBase, but unreadable symbols.

how to solve this problem?

Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on June 30, 2011, 12:04:01 AM
@ bma2004,
I do not know russian at all so it is hard for me to test this.
I am assuming in your attached image. The correct spelling is under the Welcome, area
Is the incorrect version the bold letters above the picture after the ":" ?

Are you able to create a russian user in the normal 4images registration area using the spelling under the Welcome message and get it to display correctly?
That will tell me if it is the mod or deeping into 4images.

I am going to have to figure out how I can type russian letters so I can test this further.
Title: Re: [MOD] Facebook Connector V1.0
Post by: bma2004 on June 30, 2011, 02:37:53 PM
@ bma2004,
I do not know russian at all so it is hard for me to test this.
I am assuming in your attached image. The correct spelling is under the Welcome, area
Is the incorrect version the bold letters above the picture after the ":" ?
Are you able to create a russian user in the normal 4images registration area using the spelling under the Welcome message and get it to display correctly?
That will tell me if it is the mod or deeping into 4images.

I am going to have to figure out how I can type russian letters so I can test this further.
Users registered in the usual way - write to the database and displayed normal.
If you change the entry to the database "username" by typing the name correctly, it displays everything correctly.


UPD
put a line echo($fbme['first_name']) at the beginning fbstatus.php.

result - the variable is initially displayed with unreadable characters :(
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 01, 2011, 01:36:55 AM
@ bma2004,

I will be setting up a test server this weekend and will PM you a link to get to it and I will need you to login with a russian facebook account so I can see what is getting stored in the database of 4images.
looking over facebook's forums and bug lists, there has been allot of issues in regards to russian names but not what we are seeing here.

I like chalenges, I wish I knew other languages better  :(

UPDATE:
With the help of bma2004 doing some login testing for me (Thank you!) I think we got it working and these are the steps I took to make it happen.
I do not know if you have to do all of them but this is what I did to my test site to make it start working with the Russian names correctly...

BACKUP YOUR DATABASE AND ALL TEMPLATE FILES BEFORE STARTING THIS

First,
I used Notepad++ http://notepad-plus-plus.org/ (http://notepad-plus-plus.org/) and opened ALL of my template files into it. (not sure if you need to do all of them or not)
Then I clicked on each file's tab and chose "encoding" menu, select "convert to UTF-8 without BOM" for each template file.
After I was finished changing them to this encoding, I clicked on the "save all" icon to save the changes to all the files at once.

Second,
I opened up the lang/your language/main.php file and changed the $lang['charset'] = "utf-8" (it did not look like any of the others worked correctly)
You can try skipping this step and see what your own results are.

Third,
I replaced the facebook/fbstatus.php file with the one attached to this post (it is changed to UTF-8 and added a function for special characters)

Fouth,
This can cause allot of problems, but also attached is a "utf8-conversion.php" file I had to run on my database to change everything over to charset "utf-8" and fields collate to "utf8-general-ci". I did not create this file but it does what I needed pretty well.
Place this file in your root of your gallery and change the username/password/db/host to your settings for your database and run the file, then delete it.
If there are ANY unusual chacters in your database specific to your language it can loose them or mess things up pretty bad.
if you know your database is already "UTF-8" and your text fields are collate "utf8-general-ci" (or maybe a version if this) then DO NOT RUN THIS FILE.
Test it the way it is to see if it works for you. (I am not being held responsible for any damages to your database, always backup first!)

The only thing that I noticed is that when you look at the user database in phpadmin, the russian users have weird characters in them, but when you look in 4images admin "edit user" area, they look correct. Not sure what is happening there...

If I did not leave anything out then this should fix your russian character issues with the facebook login. If anyone is more knowledgable on this subject (fonts/ect...) and knows an easier way to accomplish this then I would love to hear from you so I can test your solution.
Title: Re: [MOD] Facebook Connector V1.0
Post by: sathishIPL on July 18, 2011, 04:26:21 PM
hi budduke,

could you please see attached screenshot?  it seems the site has not been logged via Facebook.



Is Facebook SDK has been changed?

Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 18, 2011, 08:12:42 PM
@ sathishIPL,
It looks like it is logging into facebook correctly, just not into 4images.
You need to recheck the inserts to make sure you placed everything in the correct places.
If you can zip your changed files and send them to me I can take a look at them.
Title: Re: [MOD] Facebook Connector V1.0
Post by: Saschilys on July 19, 2011, 02:13:27 PM
Ich habe auch ein problem.
Ich habe alles nach der Anleitung installiert, aber der Login funktioniert nicht.

Link: http://www.pic-host4.me

ZIP: http://www.pic-host4.me/files.zip

Kannst du mir helfen?

Curl und Json sind installiert (eigener Server)



I also have a problem.
I installed everything according to the instructions, but the login does not work.

Link: http://www.pic-host4.me

ZIP: http://www.pic-host4.me/files.zip

Can you help me?

Curl and json are installed (dedicated server)
Title: Re: [MOD] Facebook Connector V1.0
Post by: sathishIPL on July 20, 2011, 05:44:46 AM
@ sathishIPL,
It looks like it is logging into facebook correctly, just not into 4images.
You need to recheck the inserts to make sure you placed everything in the correct places.
If you can zip your changed files and send them to me I can take a look at them.


Thanks budduke !!!!

I will check my modifications and will get back to u.

One morething if you look my URL http://www.website.com/index.php?fb_status=1   ...If i login or logout [ it seems something wrong in the Session?] the URL remains the same ..



UPDATE::: successfully implemented ..thnks duke.
Problem with including fbstatus.php. .
As we include in global.php it should affect all files !
Title: Re: [MOD] Facebook Connector V1.0
Post by: sathishIPL on July 21, 2011, 04:08:03 PM
This looks very promising... but I have a question:

What would happened when you signup with facebook account and your username is already taken?

I have also noticed that there is error with logout link. When you want to logout from gallery some FB code show up.
first question: It will add numbers to the end of the name until it gets a username that does not already exist.

second one: do you have php warnings being suppressed? I do know it makes a call to facebook to see if you are attached or not but I rechecked the code to make sure I removed that array that you say is showing up. Can you provide me with a link to see if it is the same thing?

Thx for you answers, here is attached screenshot of that error that i was talking about...




I am receiving the same error while logout.

Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on July 22, 2011, 12:22:57 AM
I am receiving the same error while logout.

I did not see this error when I loged out of your site. Can you attach a screenshot of what you are geting?

PS TO EVERYONE: Facebook just released their new javascript today. I have been working on version 2 of this mod for the last couple months using their new PHP SDK and have been waiting for this javascript update, so I should be posting the new one in the next couple of weeks after I am finished testing it.
I have included a couple of addons that have been requested and the code is running faster and does not need to refresh so often. In my testing, in only adds .02 seconds to the page load compaired to the old one that may have taken a couple of seconds added to the page. So I think everyone will be very happy when I get it finished.
Title: Re: [MOD] Facebook Connector V1.0
Post by: sathishIPL on July 22, 2011, 12:06:51 PM
Hi Budduke,

Thanks for your valuable reply.

currently am testing the mods in local  host.i am receiving the same error what lucifix received in your site.

I will wait for Newer one as facebook updated their SDK versions to 3.

I am just begginer in PHP and i am learning thro the open source.

Title: Re: [MOD] Facebook Connector V1.0
Post by: siddhamalli on August 10, 2011, 07:50:38 AM
Hi im trying to implement this at xxx: xxx: myview. in/photo/ the facebook login button appears but its not doing anything when i click on it , its just thr thats all , can you please help me fix it .
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on August 10, 2011, 12:19:44 PM
Hi im trying to implement this at xxx: xxx: myview. in/photo/ the facebook login button appears but its not doing anything when i click on it , its just thr thats all , can you please help me fix it .

Can you provide a link so I can see what is happening?
Title: Re: [MOD] Facebook Connector V1.0
Post by: MrAndrew on August 19, 2011, 03:22:05 PM
Dear developers, please help me resolve my problem... Login FB correct, but not login in gallery... Always refreshing page...

Try please

Link: http://skyphotos.ru

Many thanks!
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on August 20, 2011, 12:04:16 AM
Dear developers, please help me resolve my problem... Login FB correct, but not login in gallery... Always refreshing page...

Try please

Link: http://skyphotos.ru

Many thanks!

I just logged into that site using my facebook account and it it seems fine...
What browser are you using? are you using a certain language on that site when you log in? I was using english and then I changed it to german and both seemed fine from IE9

Please read my earlier post...
http://www.4homepages.de/forum/index.php?topic=27396.msg158343#msg158343 (http://www.4homepages.de/forum/index.php?topic=27396.msg158343#msg158343)
PS to everyone:
I am working on a newer version of this mod that should run allot better. They just posted an update to the PHP and javascript kit last week so I am working with it now...
Title: Re: [MOD] Facebook Connector V1.0
Post by: MrAndrew on August 21, 2011, 09:12:16 PM
A little detail in step was lost

In in the includes\page_header.php file...

Find:

    "fb_appid" => FBAPPID,
"fbl_loggedin" => $fbl_loggedin,
"fbl_confirm" => $lang['fbl_confirm'],
"fbl_lang" => $lang['fbl_lang'],
"fbl_passmessage" => $lang['fbl_passmessage'],
"fbl_sharing" => $lang['fbl_sharing'],

Replace:

    "fb_appid" => FBAPPID,
"fbl_loggedin" => $fbl_loggedin,
"fbl_confirm" => $lang['fbl_confirm'],
"fbl_lang" => $lang['fbl_lang'],
"fbl_change_password" => $lang['fbl_change_password'],
"fbl_passmessage" => $lang['fbl_passmessage'],
"fbl_sharing" => $lang['fbl_sharing'],

"fbl_change_password" => $lang['fbl_change_password'],
Title: Re: [MOD] Facebook Connector V1.0
Post by: khan on September 28, 2011, 11:27:30 PM
Hi,
this mod was working perfect with V 1.7.7 Now I am trying to install this mod on V 1.7.10 but getting this error message:
Fatal error: Call to undefined method Session::fb_login() in /home/MY USER/public_html/facebook/fbstatus.php on line 72

after this when i remove ?fb_status=1 from the url and reload the page its shows facebook loged in but 4images login form is still visible means user is loged in to facebook but not to 4images.

any idea?
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on September 29, 2011, 02:03:28 PM
Hi,
this mod was working perfect with V 1.7.7 Now I am trying to install this mod on V 1.7.10 but getting this error message:
Fatal error: Call to undefined method Session::fb_login() in /home/MY USER/public_html/facebook/fbstatus.php on line 72

after this when i remove ?fb_status=1 from the url and reload the page its shows facebook loged in but 4images login form is still visible means user is loged in to facebook but not to 4images.

any idea?
Check the insert thar you needed to place in the sessions.php file
That is where the fb_login() function should reside. I have installed this mod on 1.7.10 without any issues.
Title: Re: [MOD] Facebook Connector V1.0
Post by: khan on September 29, 2011, 04:47:09 PM
Hi,

Thanks budduke you were right, I missed the code in sessions.php :P now its working perfect,

another issue (not related to this MOD) I have added facebook comments plugin in details.html file, every thing is fine except when a user comment on an image the comment also post on his profile with a BACK LINK to that image, when click on that link from facebook the user get to the page but cant see any comments there, it is because facebook add ?fb_comment_id=fbc_5007219748935_660290_5007219838935 and some unique id to every back link, can you help me how to remove that extra part from the url? I am using [MOD] Google Friendly Urls For 4images Best Seo Mod.
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on September 29, 2011, 10:31:06 PM
@khan,
Do you have a link where I can see this in action to understand it better?
Title: Re: [MOD] Facebook Connector V1.0
Post by: khan on October 03, 2011, 12:36:08 PM
@budduke

sorry for late reply i was just out of town, you can check it here http://www.pukhtosongs.com/song-paroon-na-maloomedey-1596.html
Title: Re: [MOD] Facebook Connector V1.0
Post by: MrAndrew on October 17, 2011, 08:07:30 AM
Login gave me this error:

Fatal error: Call to a member function getLogoutUrl() on a non-object in /home/users2/d/***/domains/***/login.php on line 52

Line 52 in my login.php:

Code: [Select]
redirect($facebook->getLogoutUrl(array('next' => dirname(curPageURL()).'/'.$url)));
Thanks for help!
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on October 18, 2011, 01:59:37 AM
Login gave me this error:

Fatal error: Call to a member function getLogoutUrl() on a non-object in /home/users2/d/***/domains/***/login.php on line 52

Line 52 in my login.php:

Code: [Select]
redirect($facebook->getLogoutUrl(array('next' => dirname(curPageURL()).'/'.$url)));
Thanks for help!

Make sure you placed the correct insert into ALL of these files, I think you might have forgot one...
Quote
in the categories.php, lightbox.php, member.php, register.php, rss.php, top.php, index.php, postcards.php, search.php, and details.php files...


@khan,
I see what you are seeing... I will not have time to look into it till Early November (booked up till then)
I am wondering if by placing your correct url in the return url area in the javascript for the comments, if that would acclomplish anything. Right now it is blank ""
Title: Re: [MOD] Facebook Connector V1.0
Post by: budduke on December 16, 2011, 12:11:27 AM
[MOD] Facebook Connector V2.0

This mod will give your users the ability to login to your 4images site using their Facebook account.
YOU MUST be running PHP Version 5 or greater with CURL and JSON running on your server for this mod to work.
check your phpinfo() or your provider to find out. My provider upgraded my account for free to the new PHP.

this mod is based on the facebook php-sdk kit that is available at...
http://github.com/facebook/php-sdk/ (http://github.com/facebook/php-sdk/)

DEMO...
http://www.budduke.com (http://www.budduke.com)

Version History...
2.0 - upgrade from old model (using facebook php-sdk kit version 3.1.1)

Version 2 of this mod now support the Auth 2.0 that Facebook has moved over to.
NOTE: If you have Version 1 of this Mod installed, You will need to remove all the code you placed in Version 1.0 before you proceed. You can leave the database entries but all the code inserts must be removed.
The old version mod steps can be found here.http://www.4homepages.de/forum/index.php?topic=27396.0 (http://www.4homepages.de/forum/index.php?topic=27396.0)

New facebook users will now have to "agree to terms" and "create a password" before gaining entry into your site.Facebook users that are already created from version 1 of this mod will not have to do the above steps.

This mod is in conjunction with my other mod
http://www.4homepages.de/forum/index.php?topic=29422.0 (http://www.4homepages.de/forum/index.php?topic=29422.0)
The like/send/share button so some of the steps may be the same as you are going through them.

Backup your database before continuing. This will make changes to your settings and user databases.

You will need to unzip the attached file to the root of your 4images gallery and run the facebook_install.php file to place the entries into your database. Delete this file after you have ran it once.
You will also have a facebook folder with the correct files in it after you expand the zip file.

The following files will be modified...
admin\settings.php
includes\db_field_definitions.php
includes\page_header.php
includes\sessions.php
lang\english\admin.php
lang\english\main.php
logout.php
register.php
templates\your template\header.html
templates\your template\register_form.html
templates\your template\user_loginform.html
templates\your template\user_logininfo.html


STEP 1.a (this insert is the same as my like/share/send MOD V3.1 Step 5.a)
in your admin/settings.php file
search for
Code: [Select]
// end of functionsInsert Before
Code: [Select]
//[MOD] Facebook
function show_fb_language_options($setting_name, $setting_value) {
  global $fb_language_optionlist;
  echo "<select name=\"setting_item[".$setting_name."]\">";
  foreach ($fb_language_optionlist as $key => $val) {
    echo "<option value=\"$key\"";
    if ($setting_value == $key) {
      echo " selected=\"selected\"";
    }
    echo ">".$val."</option>";
  }
  echo "</select>";
}
//END [MOD] Facebook

Step 1.b (this insert is the same as my like/share/send MOD V3.1 Step 5.b)
Search for
Code: [Select]
show_form_footer($lang['save_changes'], "", 2);
Insert Before
Code: [Select]
// [MOD] Facebook
  show_table_separator($setting_group["facebook"], 2, "setting_group_facebook");
  show_setting_row("fb_appid");
  if ($fb_mod_select==1 || $fb_mod_select==3){
   show_setting_row("fb_appsec");
  }
  if ($fb_mod_select>1){
   show_setting_row("fb_admins");
   show_setting_row("fb_title");
   show_setting_row("fb_main_url");
   show_setting_row("fb_image");
   show_setting_row("fb_description","textarea");
  }
  show_setting_row("fb_language","show_fb_language_options");
// END[MOD] Facebook

Step 2
in your includes\db_field_definitions.php file
Search for
Code: [Select]
?>Insert Before
Code: [Select]
//MOD facebook
$additional_user_fields['fb_userid'] = array($lang['fb_userid'], "text",0);
$additional_user_fields['fb_name'] = array($lang['fb_name'], "text",0);
$additional_user_fields['fb_pic_small'] = array($lang['fb_pic_small'], "text",0);
//end MOD facebook

Step 3
in your includes\page_header.php file
search for
Code: [Select]
//-----------------------------------------------------
//--- User Box ----------------------------------------
//-----------------------------------------------------
insert Before
Code: [Select]
//MOD facebook
include_once (ROOT_PATH.'facebook/fbmain.php');
if (($user_info['user_level'] >= USER)&&($fb_flag==3)) {
   $site_sess->set_session_var("fb_flag", 0);
   $fb_flag=0;
   }
if ((!$fb_flag) && ($file!="register")) {
   fb_checkstatus();
   }
$fb['hide1']=$fb_flag>1?1:0;
$fb['hide2']=$fb_flag==3?1:0;
$fb['loggedin'] = $fb_session>0?1:0;
$site_template->register_vars(array(
   "fb_appid" => $config['fb_appid'],
   "fb_language" => isset($lang['fb_language']) ? $lang['fb_language'] : $config['fb_language'],
   "fb_hide1" => $fb['hide1'],
   "fb_hide2" => $fb['hide2'],
   "fb_message" => $lang['fb_message'],
   "fb_loggedin" => $fb['loggedin'],
   "fb_pic_small" =>$user_info['fb_pic_small'],
   "fb_userid"=>$user_info['fb_userid'],
   "fb_name"=>$user_info['fb_name'],
   "fb_logout_url"=>(ROOT_PATH=="./") ? "logout.php" : $site_sess->url($script_url."/".substr(ROOT_PATH,2)."logout.php"),
  ));
unset ($fb);
//end MOD facebook

Step 4
in your includes\sessions.php file
search for
Code: [Select]
function logout($user_id)insert Before
Code: [Select]
//MOD facebook
  function fb_login($user_name = "", $user_password = "", $auto_login = 0, $set_auto_login = 1) {
    global $site_db, $user_table_fields;

    if (empty($user_name) || empty($user_password)) {
      return false;
    }
    $sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_password")."
            FROM ".USERS_TABLE."
            WHERE ".get_user_table_field("", "user_name")." = '$user_name' AND ".get_user_table_field("", "user_level")." <> ".USER_AWAITING;
    $row = $site_db->query_firstrow($sql);

    $user_id = (isset($row[$user_table_fields['user_id']])) ? $row[$user_table_fields['user_id']] : GUEST;
    if ($user_id != GUEST) {
      if ($row[$user_table_fields['user_password']] == $user_password) {
        $sql = "UPDATE ".SESSIONS_TABLE."
                SET session_user_id = $user_id
                WHERE session_id = '".addslashes($this->session_id)."'";
        $site_db->query($sql);
        if ($set_auto_login) {
          $this->set_cookie_data("userpass", ($auto_login) ? $user_password : "");
        }
        $this->start_session($user_id, 1);
        return true;
      }
    }
    return false;
  }
//END MOD facebook

Step 5 (this insert is the same as my like/share/send MOD V3.1 Step 6)
Note: first line $fb_mod_select=1 (change to 3 if using both mods)
in your lang\english\admin.php file
search for
Code: [Select]
?>insert Before
Code: [Select]
//[MOD] Facebook
$fb_mod_select=1; // 1="login button Mod", 2="like/share/send button Mod", 3="both Mods installed"
/*-- Setting-Group Facebook --*/
$setting_group["facebook"]="Facebook settings";
$setting['fb_appid'] = "Application ID";
$setting['fb_appsec'] = "Application Secret";
$setting['fb_admins'] = "List of facebook IDs as admins<br><span class=\"smalltext\">IDs seperated by commas</span>";
$setting['fb_main_url'] = "Full HTML path to your website<br><span class=\"smalltext\">What you placed in the connect URL on facebook</span>";
$setting['fb_image'] = "Full HTML path to your logo/image for your website";
$setting['fb_title'] = "What you would like the Main Title to say for your website";
$setting['fb_description'] = "Description displayed for your website<br><span class=\"smalltext\">HTML code will be removed</span>";
$setting['fb_language'] = "Default language to use for Facebook";
$fb_language_optionlist = array(
'ca_ES' => 'Catalan',
'cs_CZ' => 'Czech',
'cy_GB' => 'Welsh',
'da_DK' => 'Danish',
'de_DE' => 'German',
'eu_ES' => 'Basque',
'en_PI' => 'English (Pirate)',
'en_UD' => 'English (Upside Down)',
'ck_US' => 'Cherokee',
'en_US' => 'English (US)',
'es_LA' => 'Spanish',
'es_CL' => 'Spanish (Chile)',
'es_CO' => 'Spanish (Colombia)',
'es_ES' => 'Spanish (Spain)',
'es_MX' => 'Spanish (Mexico)',
'es_VE' => 'Spanish (Venezuela)',
'fb_FI' => 'Finnish (test)',
'fi_FI' => 'Finnish',
'fr_FR' => 'French (France)',
'gl_ES' => 'Galician',
'hu_HU' => 'Hungarian',
'it_IT' => 'Italian',
'ja_JP' => 'Japanese',
'ko_KR' => 'Korean',
'nb_NO' => 'Norwegian (bokmal)',
'nn_NO' => 'Norwegian (nynorsk)',
'nl_NL' => 'Dutch',
'pl_PL' => 'Polish',
'pt_BR' => 'Portuguese (Brazil)',
'pt_PT' => 'Portuguese (Portugal)',
'ro_RO' => 'Romanian',
'ru_RU' => 'Russian',
'sk_SK' => 'Slovak',
'sl_SI' => 'Slovenian',
'sv_SE' => 'Swedish',
'th_TH' => 'Thai',
'tr_TR' => 'Turkish',
'ku_TR' => 'Kurdish',
'zh_CN' => 'Simplified Chinese (China)',
'zh_HK' => 'Traditional Chinese (Hong Kong)',
'zh_TW' => 'Traditional Chinese (Taiwan)',
'fb_LT' => 'Leet Speak',
'af_ZA' => 'Afrikaans',
'sq_AL' => 'Albanian',
'hy_AM' => 'Armenian',
'az_AZ' => 'Azeri',
'be_BY' => 'Belarusian',
'bn_IN' => 'Bengali',
'bs_BA' => 'Bosnian',
'bg_BG' => 'Bulgarian',
'hr_HR' => 'Croatian',
'nl_BE' => 'Dutch (België)',
'en_GB' => 'English (UK)',
'eo_EO' => 'Esperanto',
'et_EE' => 'Estonian',
'fo_FO' => 'Faroese',
'fr_CA' => 'French (Canada)',
'ka_GE' => 'Georgian',
'el_GR' => 'Greek',
'gu_IN' => 'Gujarati',
'hi_IN' => 'Hindi',
'is_IS' => 'Icelandic',
'id_ID' => 'Indonesian',
'ga_IE' => 'Irish',
'jv_ID' => 'Javanese',
'kn_IN' => 'Kannada',
'kk_KZ' => 'Kazakh',
'la_VA' => 'Latin',
'lv_LV' => 'Latvian',
'li_NL' => 'Limburgish',
'lt_LT' => 'Lithuanian',
'mk_MK' => 'Macedonian',
'mg_MG' => 'Malagasy',
'ms_MY' => 'Malay',
'mt_MT' => 'Maltese',
'mr_IN' => 'Marathi',
'mn_MN' => 'Mongolian',
'ne_NP' => 'Nepali',
'pa_IN' => 'Punjabi',
'rm_CH' => 'Romansh',
'sa_IN' => 'Sanskrit',
'sr_RS' => 'Serbian',
'so_SO' => 'Somali',
'sw_KE' => 'Swahili',
'tl_PH' => 'Filipino',
'ta_IN' => 'Tamil',
'tt_RU' => 'Tatar',
'te_IN' => 'Telugu',
'ml_IN' => 'Malayalam',
'uk_UA' => 'Ukrainian',
'uz_UZ' => 'Uzbek',
'vi_VN' => 'Vietnamese',
'xh_ZA' => 'Xhosa',
'zu_ZA' => 'Zulu',
'km_KH' => 'Khmer',
'tg_TJ' => 'Tajik',
'ar_AR' => 'Arabic',
'he_IL' => 'Hebrew',
'ur_PK' => 'Urdu',
'fa_IR' => 'Persian',
'sy_SY' => 'Syriac',
'yi_DE' => 'Yiddish',
'gn_PY' => 'Guaraní',
'qu_PE' => 'Quechua',
'ay_BO' => 'Aymara',
'se_NO' => 'Northern Sámi',
'ps_AF' => 'Pashto',
'tl_ST' => 'Klingon'
);
//END [MOD] Facebook

Step 6
in your lang/english/main.php file
search for
Code: [Select]
?>insert Before
Code: [Select]
//MOD facebook
$lang['fb_userid'] = "Facebook User ID";
$lang['fb_name'] = "Facebook User Name";
$lang['fb_pic_small'] = "Facebook Picture link";
$lang['fb_message'] = "Your account has not been activated yet.";
$lang['fb_password'] = "Password to be used<br>for access to this site:";
$lang['fb_register_success'] = "You are now registered.";
//END MOD facebook

Step 7
in your logout.php file
search for
Code: [Select]
require(ROOT_PATH.'includes/sessions.php');insert After
Code: [Select]
//MOD facebook
$site_sess->set_session_var("fb_flag", 0);
$fb_flag=0;
include_once (ROOT_PATH.'facebook/fbmain.php');
fb_checkstatus();
//END MOD facebook

Step 8.a
Note: read insert line that begins with $captcha_enable_registration=0;
in your register.php file
search for
Code: [Select]
//-----------------------------------------------------
//--- Add New User ------------------------------------
//-----------------------------------------------------
insert Before
Code: [Select]
//MOD facebook
if ($action == "register" && $fb_flag == 2){
   if (!$HTTP_POST_VARS['user_name']){
      $tempuser = $fb_info[0]['name'];
     
      $tempuser = preg_replace("/ /","_",$fb_info[0]['name']);
      $found=false;
      $i=0;
      while (!$found){
         $user=$tempuser.($i==0?"":$i);
         $sql="SELECT count(*) from ".USERS_TABLE." where user_name='".$user."'";
         $row = $site_db->query_firstrow($sql);
         if ($row[0]!=0) $i++; else $found=true;
         }
      $HTTP_POST_VARS['user_name']=$user;
      }
   $captcha_enable_registration=0;// change to 1 if you want New facebook users to enter captcha
   }
if ($fb_flag == 2){
   $HTTP_POST_VARS['user_email'] = $fb_info[0]['email'];
    $site_template->register_vars(array(
      "fb_password" => $lang['fb_password'],
     ));
   }
//END MOD facebook

Step 8.b
search for
Code: [Select]
$msg = $lang['register_success']insert After
Code: [Select]
      //MOD facebook
      $site_sess->set_session_var("fb_flag", 3);
      $fb_flag=3;
      //END MOD facebook

Step 8.c
search for
Code: [Select]
$msg = $lang['register_success_none'];insert After
Code: [Select]
       //MOD facebook
      if ($fb_flag>1){ $msg=$lang['fb_register_success'];}
       $site_sess->set_session_var("fb_flag", 0);
      $fb_flag=0;
      //END MOD facebok

Step 8.d
search for
Code: [Select]
$msg = $lang['activation_success'];insert After
Code: [Select]
     //MOD facebook
     $site_sess->set_session_var("fb_flag", 0);
     $fb_flag=0;
     //END MOD facebok

Step 9.a(this insert is the same as my like/share/send mod V3.1 step 2.a)
in your templates/your template/header.html file
search for
Code: [Select]
<html dir="{direction}">Replace with
Code: [Select]
<html dir="{direction}" xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml">
Step 9.b(this insert is the same as my like/share/send mod V3.1 step 2.c)
At the end of the page insert
Code: [Select]
<div id="fb-root"></div>
    <script>
  window.fbAsyncInit = function() {     
        FB.init({
          appId: '{fb_appid}',
          cookie: true,
          xfbml: true
        });
        FB.Event.subscribe('auth.logout', function(response) {
          window.location = '{fb_logout_url}';
        });
      };
      (function() {
        var e = document.createElement('script'); e.async = true;
        e.src = document.location.protocol +
          '//connect.facebook.net/{fb_language}/all.js';
        document.getElementById('fb-root').appendChild(e);
      }());
</script>

Step 10.a
in your templates/your template/user_loginform.html file
search for
Code: [Select]
<form action="{url_login}" method="post">insert Before
Code: [Select]
{ifnot fb_hide1}
Step 10.b
search for
Code: [Select]
» <a href="{url_lost_password}">{lang_lost_password}</a><br />insert After
Code: [Select]
     {endifnot fb_hide1}
     {ifnot fb_hide2}

Step 10.c
search for
Code: [Select]
» <a href="{url_register}">{lang_register}</a><br>&nbsp;</td>insert After
Code: [Select]
     {endifnot fb_hide2}
     {if fb_hide2}
     {fb_message}
     {endif fb_hide2}

Step 10.d
search for
Code: [Select]
</table>insert Before
Code: [Select]
  <tr><td valign="top" align="center">
  {if fb_loggedin}
   <table width="100%" border="0"><tr><td align="right">
   <fb:profile-pic uid='loggedinuser' facebook-logo='false'></fb:profile-pic></td><td valign="center" align="left"> Welcome,<BR> <fb:name uid='loggedinuser' useyou='false'></fb:name>
   </td></tr></table>
{endif fb_loggedin}
      <fb:login-button size="small" length="long" autologoutlink="true" scope="email,user_website,publish_stream" ></fb:login-button>
    </td></tr>

Step 11.a
in your templates/your template/user_logininfo.html file
search for
Code: [Select]
<a href="{url_control_panel}">{lang_control_panel}</a><br />insert After
Code: [Select]
{ifnot fb_loggedin}
Step 11.b
search for
Code: [Select]
<a href="{url_logout}">{lang_logout}</a><br>&nbsp;</td>insert After
Code: [Select]
{endifnot fb_loggedin}
Step 11.c
search for
Code: [Select]
</table>insert Before
Code: [Select]
   <tr><td valign="top" align="center">
{if fb_loggedin}
   <table width="100%" border="0"><tr><td align="right">
   <img src="{fb_pic_small}"></img></td><td valign="center" align="left"> Welcome,<BR> <a href="http://www.facebook.com/profile.php?id={fb_userid}">{fb_name}</a>
   </td></tr></table>
{endif fb_loggedin}
      <fb:login-button size="small" length="long" autologoutlink="true" scope="email,user_website,publish_stream" ></fb:login-button>
    </td></tr>

Step 12
in your templates/your template/register_form.html file
search for
Code: [Select]
{lang_password}Replace with
Code: [Select]
{if fb_password}{fb_password}{endif fb_password}{ifnot fb_password}{lang_password}{endifnot fb_password}
after you are finished going through the steps, you will find in the admin control panel, under settings,
you will see facebook settings, this is where you will put the info for your facebook application to make this mod work.
How do you make a facebook application? this link will give you the steps. they are a little outdated but should still get you on the right track until I have a chance to redo them.
http://www.4homepages.de/forum/index.php?topic=29422.msg157086#msg157086 (http://www.4homepages.de/forum/index.php?topic=29422.msg157086#msg157086)
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on January 23, 2012, 06:19:28 PM
Version 2 of this mod has been posted.
http://www.4homepages.de/forum/index.php?topic=27396.msg160225#msg160225 (http://www.4homepages.de/forum/index.php?topic=27396.msg160225#msg160225)

the steps for creating an app on facebook are a little different and easier then before.
go to
http://developers.facebook.com (http://developers.facebook.com)
click on "apps" at the top.
"Create new App"
Give name,
app domain,
category (if needed)
Click on "website" and enter the path to your gallery.
And press "save changes"

See attached PDF
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: sathishIPL on January 30, 2012, 06:57:12 AM
Hi Duke,

I have implemented the mod.

Thanks for wonderful mod.

everything works fine for me .Except when i logout , am able to logout from facebook.

But not from the 4images.

Its different one .
Are you using GRAPH API to connect?

 I am currently developing Upload a photo to Facebook. It is not redirecting to the current URL in Firefox.

Here is the logic -> A upload Facebook submit button will be placed under the images- when a user click the upload Facebook button -> it will check for two things

1.If Valid FB session - the Images will be uploaded to user photo albums
2.If not it will be redirect to Facebook login page-> once the user login again he/she will be redirected to particular action called upload Facebook[here it is not redirected to correctly to the action]

Thank You...!

best regards,
Satz

Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on January 30, 2012, 08:03:20 PM
@sathishIPL,

The logout should work if everything is placed correctly. Since the logout is a javascript command at the browser, I have seen it make a second or 2 delay before it actually logs out of the site but it does work. You can test at my site.
If you zip all your changed files, I will look them over to make sure I did not forget to put something in the instructions, But I went over them twice and it worked both times.

The file upload is a different story. It is allot more involved then what you are thinking. I have found some PHP created scripts that handle most of it. The problem is, you have to be able to select the album or create a new one when you are sending an image to facebook.
I am going to work on this in the near future, not ETA though :( too many other things going on right now.
I am going to try to make it so you can go both ways, bring images from facebook to your gallery and take images from your gallery to facebook, either as the lightbox selected images, or one at a time, like you were saying with a button "send image to facebook" or something like that.
I thought it would be a simple call, but with the security in place, it is a little more work to make it happen.
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: sathishIPL on February 07, 2012, 12:07:53 PM
HI Budduke,

I was out of town.

It is working without any issues when other users logged using Facebook account.

Only the logout issue  is happening , when i login.

Thank You...!

Best regards,
Satz
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on February 07, 2012, 07:50:39 PM
It is working without any issues when other users logged using Facebook account.

Only the logout issue  is happening , when i login.

Can you give me a link so I can see the problem?
Not sure what you are asking. When I logout of facebook, it logs me out of the 4images site also.
When you login with just 4images, it should just stay as "login with facebook" and not change.
If you then "login with facebook" while you are already connected with 4images account. it will log you out and back in with whatever account is associated with the facebook account in your database.

Sidenote: I got an image to upload to my Facebook album in PHP last weekend. It can be done, now working on an interface to connect it wil 4images download.
Title: Bugs
Post by: szymanski on March 02, 2012, 03:27:14 AM
BUG REPORT

If this mod doesn't work in FF or IE please use this Doctype:

Change header.html on the top to
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


Redirecting after Facebook Login oder Logout to the last page,
open logout.php and find
redirect("index.php");



and replace with


redirect("$HTTP_REFERER");




If you want to use a larger picture than the small one,
then use this code:
<fb:profile-pic uid="{fb_userid}" size="normal">


Thank you budduke for this good mod!
Greetings Daniel
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: nicogd93 on March 30, 2012, 06:32:47 AM
Alguna solucion para mi error.
Cuando inicio en facebook me tira lo siguiente:

Warning: Cannot modify header information - headers already sent by (output started at /home/topfashi/public_html/home/lang/spanish/main.php:787) in /home/topfashi/public_html/home/includes/functions.php on line 114

la web es xxx: topfashionlikexxx: /home/
 
HELP
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: Rembrandt on March 30, 2012, 06:59:08 AM
Welcome to the Forum!
...
Warning: Cannot modify header information - headers already sent by ....
read this: http://www.4homepages.de/forum/index.php?topic=3378.0

mfg Andi
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: sathishIPL on April 13, 2012, 06:24:58 PM
Hi Budduke,

Facebook Redirection is not working when i disable the Register actviation code by email.

Br,
satz

Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on April 13, 2012, 10:24:51 PM
Facebook Redirection is not working when i disable the Register actviation code by email.

Can you give more information?
I am assuming you are using the redirection that is on the App page on facebook when creating your login app?
You should not use that field because redirecting in facebook will loose the 4images session id that gets attached to the url.
The correct way is to go back to the page it was on and let the 4images script handle the redirect.
I tested the "by admin" and the "none" in the 4images registration settings and they redirect the same as without the facebook login.
Are you trying to do something different?
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: sathishIPL on April 14, 2012, 05:46:20 AM
Hi,

When a new user login with Facebook account, Again the user has to activate the actviation code received thro Email.

I dont want to verify the Email for new user, when they login via Facebook.

When i change the 4images settings to Account activation -None.

The Page redirection from facebook to 4images is failing.

Note: The issue is encountered only new user's when they join via Facebook. Other then existing user 's can access the 4images via facebook normally .

Thank You....!

Best regards,
Satz
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on April 14, 2012, 04:46:24 PM
When a new user login with Facebook account, Again the user has to activate the actviation code received thro Email.
I dont want to verify the Email for new user, when they login via Facebook.
When i change the 4images settings to Account activation -None.
The Page redirection from facebook to 4images is failing.
Note: The issue is encountered only new user's when they join via Facebook. Other then existing user 's can access the 4images via facebook normally .

The way it should work (just tested it to make sure it still works that way)
The new facebook user should be redirected to the "terms and conditions" page and click on "agree"
Then they are redirected to a screen that asks them to fill in a password for the 4images website.
Then they are redirected to a screen that states they are now registered.
At that point, they need to click on something to go back into your gallery.
Where is it failing? Can I see a link? (you can PM me if you want)
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: sathishIPL on April 15, 2012, 03:26:47 PM
Hi Budduke,

Please find the attached files ,that i have changed for facebook mod.

Br,
Satz
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on April 15, 2012, 06:17:39 PM
Please find the attached files ,that i have changed for facebook mod.

It looked like something was wrong in your register.php file.
The fixed one is attached.
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: szymanski on May 23, 2012, 09:32:19 PM
Was kam denn nun für ein Facebook Update raus?
Zumindest funktioniert nirgends mehr der Facebook logout?
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on May 23, 2012, 09:42:27 PM
Was kam denn nun für ein Facebook Update raus?
Zumindest funktioniert nirgends mehr der Facebook logout?

Facebook it currently rolling out the new javascript that their site is using and there are a few bugs.
This happened about a week ago and it was fixed in a few hours. Allot of people are complaining about it.
So far, my code is correct comparing to there samples on their developer site, so something is wrong on their end.
It is a pain, I found if you close the browser and open it back up then you are logged out of facebook, or sometimes, I open facebook in a different tab and logout and that seems to work sometimes also.
Will stay on top of it. Their code just is not rendering the login stuff correctly at the moment.
Will check to see if there are a new bug reports placed like the last time (they had 7 or 8 last week when it happened) and the only response from facebook was, they are looking into it and then it just starts working again a few hours later...

gotta love facebook :)
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: vault001 on May 26, 2012, 05:55:58 PM
totally awesome! thank you for this mod :) by the way who is Nikki Taylor? lol
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on May 26, 2012, 11:02:44 PM
totally awesome! thank you for this mod :) by the way who is Nikki Taylor? lol
Thanks for the compliment!
Niki is one of the supermodels from the 80-90s erea, like Cindy Crawford, but she kept a low profile outside the modeling world.
Very sweet lady  :)
Thanks for asking
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: osukaru on June 05, 2012, 11:31:38 AM
Hello all,

I applied for the installation. but the button login fb does not respond.

Page: xxx: poznanskie-autobusy. pl

What may be the problem?
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on June 05, 2012, 12:10:13 PM
Hello all,

I applied for the installation. but the button login fb does not respond.

Page: xxx: poznanskie-autobusy. pl

What may be the problem?

I did not see Step 9.b anywhere in your file...
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: osukaru on June 06, 2012, 12:29:52 AM
Hello all,

I applied for the installation. but the button login fb does not respond.

Page: xxx: poznanskie-autobusy. pl

What may be the problem?

I did not see Step 9.b anywhere in your file...

In fact, missed ...

After the addition, work in Chrome, FF does not
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on June 06, 2012, 01:44:31 AM
In fact, missed ...

After the addition, work in Chrome, FF does not

Compairing your file source to my site that is working in FF, the only thing I see that might be causing it is...
In your header file above the meta tag fb:app_id
remove this line from the header.html file...
Code: [Select]
<script src="http://connect.facebook.net/pl_PL/all.js#xfbml=1"></script>
Not sure if that is what is causing it or not.
If it still does not work I would need to see your changed files, if you can zip them and send me a link to get them I will look them over...
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: osukaru on June 06, 2012, 09:05:36 AM
In fact, missed ...

After the addition, work in Chrome, FF does not

Compairing your file source to my site that is working in FF, the only thing I see that might be causing it is...
In your header file above the meta tag fb:app_id
remove this line from the header.html file...
Code: [Select]
<script src="http://connect.facebook.net/pl_PL/all.js#xfbml=1"></script>
Not sure if that is what is causing it or not.
If it still does not work I would need to see your changed files, if you can zip them and send me a link to get them I will look them over...
After removing this line of code, everything works.

thank you very much for your help
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: Jan-Lukas on June 06, 2012, 05:07:33 PM
Da mir das ganze zuviel Englisch ist, meine Frage, werden bei Facebook auch Bilder angezeigt ?
Habe es auf meiner Testseite eingbaut, klappt auch, bis auf Bilder.
Kann ja sein das der Mod so richtig ist, das keine Bilder angezeigt werden, wenn doch dann schiebt mich bitte mal zu der Stelle die ich überprüfen sollte.

LG Harald
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on June 06, 2012, 05:41:14 PM
Da mir das ganze zuviel Englisch ist, meine Frage, werden bei Facebook auch Bilder angezeigt ?
Habe es auf meiner Testseite eingbaut, klappt auch, bis auf Bilder.
Kann ja sein das der Mod so richtig ist, das keine Bilder angezeigt werden, wenn doch dann schiebt mich bitte mal zu der Stelle die ich überprüfen sollte.

LG Harald
I think I understand your question using google translate...
My mods do not send the actual big pictures to facebook yet (still working on that one)
This mod just allows you to log into your site using your facebook account.
My other mod (the like/send/share button) does post a thumbnail of the picture along with the descriptions in your newsfeed on facebook.
It can be touchy sometimes. If you post it incorrectly the first time like when testing and something is not setup correctly, facebook caches it on their end and then the thumbnail never shows up till the cache expires (I think 24hrs)

let me know if your question is something different,
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: zhono on January 12, 2013, 09:39:54 PM
I have a few problems with this great mod. I'll try to explain them well.

If a user already has an account on my site with the same email as his Facebook, if he clicks the Login with Facebook button, it links his account nicely, and he can now use Facebook to login and out.

But if he is a new user to my site, and wants to register with Facebook, there is trouble. Using an extra Facebook account, I tested it and this is what happens.

Completely logged out from my site. Logged into Facebook.com with my extra account. Go to my site, click Register, I get the standard registration page, no Facebook. Is that supposed to happen?

I instead, I click on the Login with Facebook button. The popup comes, asks for permission. I Agree and it says all good. But now, the user has to click on "Registration" again, where he has to agree to terms, enter username, password, and email. Shouldn't it all be one step/page? How does the user know to go find the "Registration" link after he already thinks he registered with Facebook in the popup?

After you fill out that registration form, and are registered on the site using Facebook info, it still only shows you the "Registration" link, and shows you as logged out. But even though it thinks you are logged out, it doesn't give you the login form. During all this, the Facebook button itself thinks you are logged in, but the rest of the site doesn't.

And the last problem is login/logout. If I logout from facebook, either on my site, or on facebook.com, I will automatically be logged out from both. So that works.
But, if I login on Facebook.com and then go to my site, it says I'm not logged in, but if I just refresh the page, it shows my all logged in. Is there a way to detect that, and make it refresh or something, so that a user does not try to login when he doesn't have to?


In case I messed up my user_loginform and user_logininfo, I'll include them here. I was using custom login and info forms, but it was too much trouble to edit, so I went back to the standard ones.

user_loginform.html
Code: [Select]
<table width="100%" height="100%" border="0" cellpadding="3" cellspacing="0">
  <tr>
    <td valign="top" align="left">
    {ifnot fb_hide1}
      <form action="{url_login}" method="post">
        {lang_user_name}<br />
        <input type="text" size="10" name="user_name" class="logininput" />
        <br />
        {lang_password}<br />
        <input type="password" size="10" name="user_password" class="logininput" />
        <br />
        <table border="0" cellspacing="0" cellpadding="0">
          <tr valign="top">
            <td><input type="checkbox" name="auto_login" value="1" /></td>
            <td><span class="smalltext">{lang_auto_login}</span></td>
          </tr>
        </table>
        <br />
<input type="submit" value="{lang_login}" class="button" />
      </form>
      » <a href="{url_lost_password}">{lang_lost_password}</a><br />
      {endifnot fb_hide1}
     {ifnot fb_hide2}
 » <a href="{url_register}">{lang_register}</a><br>&nbsp;</td>
 {endifnot fb_hide2}
     {if fb_hide2}
     {fb_message}
     {endif fb_hide2}
 
  </tr>
  <tr><td valign="top" align="center">
  {if fb_loggedin}
   <table width="100%" border="0"><tr><td align="right">
   <fb:profile-pic uid='loggedinuser' facebook-logo='false'></fb:profile-pic></td><td valign="center" align="left"> Welcome,<BR> <fb:name uid='loggedinuser' useyou='false'></fb:name>
   </td></tr></table>
{endif fb_loggedin}
      <fb:login-button size="small" length="long" autologoutlink="true" scope="email,user_website,publish_stream" ></fb:login-button>
    </td></tr>
</table>

user_logininfo.html
Code: [Select]
<table width="100%" height="100%" border="0" cellpadding="4" cellspacing="0">
  <tr>
    <td valign="top" align="left">
 {lang_loggedin_msg}<br />
      &raquo; <a href="{url_lightbox}">{lang_lightbox}</a><br />
      {if support_ticket_activ}
 &raquo; {url_support_ticket}<br />
 &raquo; <a href="{url_support_ticket_new}">{lang_support_new}</a><br />
 {endif support_ticket_activ}
 &raquo; <a href="{url_control_panel}">{lang_control_panel}</a><br />
 {ifnot fb_loggedin}
      &raquo; <a href="{url_logout}">{lang_logout}</a><br/>
      {endifnot fb_loggedin}
      <br /><b class="h2">{cp_link}</b>
</td>
  </tr>
  <tr><td valign="top" align="center">
{if fb_loggedin}
   <table width="100%" border="0"><tr><td align="right">
   <img src="{fb_pic_small}"></img></td><td valign="center" align="left"> Welcome,<BR> <a href="http://www.facebook.com/profile.php?id={fb_userid}">{fb_name}</a>
   </td></tr></table>
{endif fb_loggedin}
      <fb:login-button size="small" length="long" autologoutlink="true" scope="email,user_website,publish_stream" ></fb:login-button>
    </td></tr>
</table>

Thanks for any help you can provide for this great mod. It's appreciated.

*EDIT* Also, my site, if you want to have a look there. http://anime-themes.com (http://anime-themes.com) Excuse the messy category list. I'm still finishing it up a bit.

*EDIT 2* When that new user tries to register with Facebook, but it doesn't show him as logged in, he can logout from Facebook completely, and login again, and he will be logged into the site.
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on January 13, 2013, 05:07:58 PM
@zhono,
The description you gave seems to be correct, I think the problem you may be running into is the dropdown javascript for the login you have running.
If you test it at my site http://www.budduke.com (http://www.budduke.com) The normal procedure after they login/create an account with facebook on your site it should refresh the login box which seems to not be happening at your site.
I could not register at your site because it was disabled when I got to the password screen.
You may try changing to a default 4images template temporarly to determine if it is working correctly or not.
The login goes by page refresh because it lies in the hearder area of the page.

I am planning on working on this mod again becasue facebook keeps changing how things work but not ETA on it.
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: zhono on January 13, 2013, 08:58:37 PM
Okay, I did some more testing. As you suggested, I used the normal template. I used a fresh copy of the default template from 1.7.11, and did the mods to header, register_form, user_loginform, and user_logininfo. All of the same problems exist. New user is not redirected to the registration page. Once he goes there himself and registers, he is still not logged in to the site(even though it says Facebook is logged in), and he sees no login form.

Users which already have a site account and just want to link Facebook, they can login, but there is also no redirect there either. They have to refresh.

Logout with Facebook button does refresh the page and logout as it should.

I'm going to look at fbmain.php and see what I can do. But it's your script, so you would know better than me how it works. Thanks for your help. Hopefully we can get it working. I'm already using your "Like" mod, and I've replaced the 4images comments with Facebook comments, so having the Facebook login makes sense.

*EDIT* Also, registration is not actually disabled. I'm using a mod that forces the user to enter all details in the proper format before he can click the register button. Seems to work fine when creating the account with Facebook.
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on January 13, 2013, 10:33:40 PM
Okay, I did some more testing. As you suggested, I used the normal template. I used a fresh copy of the default template from 1.7.11, and did the mods to header, register_form, user_loginform, and user_logininfo. All of the same problems exist. New user is not redirected to the registration page. Once he goes there himself and registers, he is still not logged in to the site(even though it says Facebook is logged in), and he sees no login form.

Users which already have a site account and just want to link Facebook, they can login, but there is also no redirect there either. They have to refresh.

Logout with Facebook button does refresh the page and logout as it should.

I'm going to look at fbmain.php and see what I can do. But it's your script, so you would know better than me how it works. Thanks for your help. Hopefully we can get it working. I'm already using your "Like" mod, and I've replaced the 4images comments with Facebook comments, so having the Facebook login makes sense.

*EDIT* Also, registration is not actually disabled. I'm using a mod that forces the user to enter all details in the proper format before he can click the register button. Seems to work fine when creating the account with Facebook.

Are you doing where it sends them an activation code or instant activation?

Yes, The refresh is necessary because it has to run the function again in the header file to see it is logged in on the facebook side. The registration link is there till they click on their activation code to activate there registration, and even then it is a refresh of the page, usually my users just click on something on the site and then they are logged in.
I do not know allot about jquery to see if there is a way of doing all this without a page refresh.

When I tested your site earlier, I logged in with my facebook account and it gave the "agree to terms" and then wanted me to create a password, and that was as far as I got. On my site, after you put in a password for the site then it logs you into your site, whether you use the standard login or facebook.

The disabled button was up the entire time I was on the "enter password" screen of the registration page, even when I put a password in.
UPDATE: I had to click on each field on your reg screen to get the registar button to come on but then I got a syntax error in the header file...
You can PM me to take this off of here and I will post what we find out but I tested my site again and it seems to work just fine, there is a slight delay when registared but it does log the facebook user in. I do not think the dropdown login screen is letting the facebook update. What Mod is that so I can try to add it on my test site?
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: zhono on January 13, 2013, 10:47:26 PM
I have activation disabled, so it's instant.

I fixed my redirect problems.

I changed:

Code: [Select]
<div id="fb-root"></div>
    <script>
  window.fbAsyncInit = function() {      
        FB.init({
          appId: '{fb_appid}',
          cookie: true,
          xfbml: true
        });
        FB.Event.subscribe('auth.logout', function(response) {
          window.location = '{fb_logout_url}';
        });
      };
      (function() {
        var e = document.createElement('script'); e.async = true;
        e.src = document.location.protocol +
          '//connect.facebook.net/{fb_language}/all.js';
        document.getElementById('fb-root').appendChild(e);
      }());
</script>

To:

Code: [Select]
<div id="fb-root"></div>
    <script>
  window.fbAsyncInit = function() {      
        FB.init({
          appId: '{fb_appid}',
          cookie: true,
          xfbml: true
        });
        FB.Event.subscribe('auth.logout', function(response) {
          window.location = '{fb_logout_url}';
        });
        FB.Event.subscribe('auth.login', function(response) {
          window.location = '{fb_login_url_z}';
        });
      };
      (function() {
        var e = document.createElement('script'); e.async = true;
        e.src = document.location.protocol +
          '//connect.facebook.net/{fb_language}/all.js';
        document.getElementById('fb-root').appendChild(e);
      }());
</script>

And changed in page_header.php:

Code: [Select]
$site_template->register_vars(array(
   "fb_appid" => $config['fb_appid'],
   "fb_language" => isset($lang['fb_language']) ? $lang['fb_language'] : $config['fb_language'],
   "fb_hide1" => $fb['hide1'],
   "fb_hide2" => $fb['hide2'],
   "fb_message" => $lang['fb_message'],
   "fb_loggedin" => $fb['loggedin'],
   "fb_pic_small" =>$user_info['fb_pic_small'],
   "fb_userid"=>$user_info['fb_userid'],
   "fb_name"=>$user_info['fb_name'],
   "fb_logout_url"=>(ROOT_PATH=="./") ? "logout.php" : $site_sess->url($script_url."/".substr(ROOT_PATH,2)."logout.php"),
  ));

to:

Code: [Select]
$site_template->register_vars(array(
   "fb_appid" => $config['fb_appid'],
   "fb_language" => isset($lang['fb_language']) ? $lang['fb_language'] : $config['fb_language'],
   "fb_hide1" => $fb['hide1'],
   "fb_hide2" => $fb['hide2'],
   "fb_message" => $lang['fb_message'],
   "fb_loggedin" => $fb['loggedin'],
   "fb_pic_small" =>$user_info['fb_pic_small'],
   "fb_userid"=>$user_info['fb_userid'],
   "fb_name"=>$user_info['fb_name'],
   "fb_logout_url"=>(ROOT_PATH=="./") ? "logout.php" : $site_sess->url($script_url."/".substr(ROOT_PATH,2)."logout.php"),
   "fb_login_url_z"=>($site_sess->url($self_url)),
  ));

Now it redirects me when I login with Facebook. Also, when I register a new account with Facebook, it sends me to the registration page, but after that the site still won't login the new user. He had to click the Facebook logout, and then login again.

Also about the need to click on the registration fields, I'll probably remove that so it works properly.
As for the login dropdown, it's custom. But even when I completely remove it(by using the standard template) it doesn't help anything.
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on January 14, 2013, 12:04:58 AM
@zhono,
When I registered on your site and put in the password in the registration page, it came back with a "successfully registered" page and waited a few seconds and then the site refreshed and the "login" screen was replaced with the "control panel". I did not have to do anything on my end but there was a few second pause before it did it.
You can remove my account from your site so I can try it again.
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: zhono on January 14, 2013, 12:19:09 AM
I deleted your account so you can test again. I have been trying it repeatedly, and no matter what I do, when I fill in the password on the registration page, it will say "You are now registered. Please log in." but then it won't refresh. If I refresh it myself, I am not logged into the site, and there is no way to login except to click the Facebook logout, and then click again to login. If it works for you this time, but still not for me, then I really don't know what the problem could be.
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on January 14, 2013, 12:52:18 AM
I now see what you are saying, this time it never did refresh after the registration, it did earlier today. I think it is because you put in the self_url as the target, it actually needs to be directed to the login.php page to actually log you in. The Self_url would only refresh the page you are currently viewing which would be the reg page.

It is now doing the same thing on my site, so facebook probably changed something again,  :(

I probably will not have time to work on it till next weekend, but if you look at the logout link I was using, I think you could mirror the login link to be about the same in your fb_login_url_z code. I always run through allot of tests before I post things. I have been wanting to clean up this code for awhile now, maybe get away from the javascript and keep it all php. not sure right now.

I will post any changes I make when I figure it all out,
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: zhono on January 14, 2013, 01:17:41 AM
Well, this is embarrassing. It seems I missed step 8.c

So that's why it wasn't logging in the new user after he enters his password.

It still doesn't redirect the user, but just has to click a link and he's logged in. I'll figure out the redirect later I guess. My solution above still works nicely for redirecting existing users after login, though, so I'm leaving it in place.

If I figure out why new users don't redirect after registration, I'll post my solution. Thanks for the help. Now I'm off to redesign my template.

Also, my fb_login_url_z only tells the Facebook script where to send the user after a successful login. Which is why I sent it to the current page. It doesn't actually change the handling of the login itself.


*EDIT*

Fixed the redirect by opening register.php and changing all of the:

Code: [Select]
//MOD facebook
      if ($fb_flag>1){ $msg=$lang['fb_register_success'];}
       $site_sess->set_session_var("fb_flag", 0);
      $fb_flag=0;
      //END MOD facebok

To:

Code: [Select]
//MOD facebook
      if ($fb_flag>1){ $msg=$lang['fb_register_success'];}
       $site_sess->set_session_var("fb_flag", 0);
      $fb_flag=0;
     redirect($site_sess->url("index.php"));
      //END MOD facebok

Now when the user submits his password, he goes right to the home page, completely logged in and ready to go. My new template will contain slideout message to new users, so he will know it was a successful registration when he sees that. No need for the regular success page.
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: osukaru on January 15, 2013, 09:46:18 PM
Hi,
the last few days I have a problem.
facebook login button sometimes leaves the table, thereby crushing the DIV and you can not use half of the links on the page, as if it was covered.
When the load properly to the table that everything is okay.

My user_loginform.html
<table width="100%" border="0" cellpadding="4" cellspacing="0">

  <tr>

    <td valign="top" align="left">
{ifnot fb_hide1}
      <form action="{url_login}" method="post">

       
<table width="100%" border="0" cellspacing="4" cellpadding="0">
<tr>
<td width="50">{lang_user_name}</td>
</tr>
<tr>
<td><input type="text" size="10" name="user_name" class="logininput" /></td>
</tr>
<tr>
<td>{lang_password}</td>
</tr>
<tr>
<td><input type="password" size="10" name="user_password" class="logininput" /></td>
</tr>
        </table>
        <br />

        <table border="0" cellspacing="0" cellpadding="0">

          <tr valign="top">

            <td><input type="checkbox" name="auto_login" value="1" /></td>

            <td><span class="smalltext">{lang_auto_login}</span></td>

          </tr>

        </table>

        <br />

<input type="submit" value="{lang_login}" class="button" />

      </form>

     <div style="padding:4px;"> &raquo; <a href="{url_lost_password}">{lang_lost_password}</a><br />
     {endifnot fb_hide1}
     {ifnot fb_hide2}

  &raquo; <a href="{url_register}">{lang_register}</a></div></td>
     {endifnot fb_hide2}
     {if fb_hide2}
     {fb_message}
     {endif fb_hide2}

  </tr>
  <tr><td valign="top" align="center">
  {if fb_loggedin}
   <table width="100%" border="0"><tr><td>
   <fb:profile-pic uid='loggedinuser' facebook-logo='false'></fb:profile-pic></td><td valign="center" align="left"> Witaj,<BR> <fb:name uid='loggedinuser' useyou='false'></fb:name>
   </td></tr></table>
{endif fb_loggedin}
      <fb:login-button size="small" length="long" autologoutlink="true" scope="email,user_website,publish_stream" ></fb:login-button>
    </td></tr></table>

Page: poznanskie-autobusy.pl
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on January 16, 2013, 01:14:01 AM
@osukaru,
Click on my site http://www.budduke.com (http://www.budduke.com), is this what you are seeing? The button moves around while rendering, a big white box shows up and moves things around till it gets rendered? I clicked on your link for your site but did not see the login button anywhere.

I reported that problem to facebook a few months back, it comes and goes but has been back for awhile lately. They said they would look into it but then closed the bug saying it was by design, whatever that means. I saw someone posted a similer issue today on their bug site, will see if they do anything for them.
All that is in their control and nothing I can do to fix it. It is all embedded in their Javascript package.

I have looked at other sites and talked with a few people and most sites have moved away from the javascript and have started rendering their buttons locally thorugh PHP instead because they got tired of facebook changing things all the time in the javascript language.

When I get time, I think I will be also going that route to get away from these changes all the time but I have no ETA when that will happen, but will post my changes when I feel they are stable enough to post.
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: zhono on February 19, 2013, 02:07:29 AM
I'm back yet again. I've had everything working nicely, but just noticed another problem. If I'm logged in with facebook, and I click the facebook logout button, it will log me out from facebook, but not from the site. So since you're still logged in, you won't see the standard login link, but you also don't see the logout link either. If I login and out with standard login right from the start, it works fine.
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on February 20, 2013, 12:33:36 AM
I'm back yet again. I've had everything working nicely, but just noticed another problem. If I'm logged in with facebook, and I click the facebook logout button, it will log me out from facebook, but not from the site. So since you're still logged in, you won't see the standard login link, but you also don't see the logout link either. If I login and out with standard login right from the start, it works fine.

Can you PM me a link so I can see the problem in action?

Facebook keeps messing with thier javascript routines. I noticed on my site that when you login with facebook, you have to refresh the page to get it to log into 4images but the logout still refreshes just fine.

Version 3 of this mod will almost be all in PHP, I am moving away from javascript because of all the changes. That seems to be what most sites have done.
Sorry, no ETA. I am finishing up a paying customer right now before I can start back to playing again :)
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: zhono on February 20, 2013, 01:31:48 AM
Actually, like I said, I have everything else working perfectly. It refreshes on login, and logout. If you login at facebook.com and then visit my site, it will also refresh and log you in. My only problem is that when you click the facebook logout button, it does refresh, but you are still logged into the site. I'll PM the link.
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: son_gokou on May 29, 2013, 04:45:13 PM
Hello.

I want to share pictures and videos on facebook. I can share it, directly on facebook or using a button on 4images but sometimes a thumbnail don't appear.
What should I do?
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: qBass17 on January 02, 2014, 01:45:48 AM
I cant find the api key at the new facebook developers site !?
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on January 02, 2014, 04:57:05 PM
I cant find the api key at the new facebook developers site !?

The 2.0 version does not use the api key, it is now changed to the "app secret" which is asterisk on the site till you press "show" at facebook's site under the dashboard of the app.
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: qBass17 on January 02, 2014, 08:14:37 PM
Work! Thank you!
An extension for "Google+", "Steam" and "Twitter" would be great as well. Thanks for your extension.
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: Starblade on October 22, 2014, 02:36:18 PM
Richtig geile Sache, aber leider zu schwer für mich. Bekomme es einfach nicht hin. Habe auch das Problem das ich beim längeren sitzen am PC , bei solchen Sachen heftig Kopfweh und Rückenschmerzen bekomme. Gibt es eventuell eine fertige Version zum Download, wo man nicht alles einzeln austauschen muss ?

LG
Ralf
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: Jan-Lukas on October 22, 2014, 05:04:37 PM
Hi,
Nein, sowas gibt es nicht, kannst aber unter Jobbörse dein Anliegen vortragen, evtl. macht es dir einer

http://www.4homepages.de/forum/index.php?board=26.0
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: zex2 on January 13, 2015, 06:39:21 PM
Ich habe ein Fehler:

Code: [Select]
Parse error: syntax error, unexpected '}' in /var/www/zex2/data/www/bahnzuege.de/includes/template.php(101) : eval()'d code on line 3
Konnen Sie mir helfen?  :)
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: Rembrandt on January 13, 2015, 07:18:31 PM
Ich habe ein Fehler:

Code: [Select]
Parse error: syntax error, unexpected '}' in /var/www/zex2/data/www/bahnzuege.de/includes/template.php(101) : eval()'d code on line 3
Konnen Sie mir helfen?  :)
Der Fehler ist in den HTML Dateien zu suchen, du hast eine "{" oder "}" zu viel oder zu wenig.

mfg Andi
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: zex2 on January 14, 2015, 06:56:09 AM
HTML Dateien
Danke, ich habe gefunden.
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: Szooguun on August 24, 2016, 05:12:16 PM
Hello. I'm sorry for my english. I write using google translator.

Mod recently stopped working properly. After logging in using facebook still get a box to enter a user name, password, etc. and the "facebook login". When you click on the "facebook login" appears for a brief moment popup and disappear.

ps. When you click on my website on the "facebook login" logs me only on facebook.com

budduke on http://www.budduke.com/ is exactly the same situation.

Please help.
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: nobby on August 24, 2016, 06:32:20 PM
Hello,

the Login at budduke works but perfectly.


nobby
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: Szooguun on August 24, 2016, 06:47:24 PM
Logon process runs ok, but after all I am not physically logged on my website.

After clicking on "facebook login" logs me on www.facebook.com

While on my website looks like this:

(https://s19.postimg.io/8um0bvaxf/login.png)

At http://www.budduke.com/ so it looks after login:

(https://s19.postimg.org/n3q87oetv/login2.png)
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: budduke on August 25, 2016, 12:48:31 AM
Yes, Facebook changed their coding and stop supporting the code that my mod was written under. It turned off a couple of weeks ago.
I have had allot on my plate lately but I will try to look over my code to see what needs to be changed to get it working again.
If I can figure it out, I will post the changes in this area.
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: Szooguun on August 26, 2016, 12:12:59 PM
Thanks. I look forward to the update :)
Title: Re: [MOD] Facebook Connector V1.0 & V2.0
Post by: alibala on September 01, 2016, 05:14:43 PM
thank you... very very nice
downloadu.ir (http://downloadu.ir)