Facebook Login Plugin Facebook Login Plugin
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Facebook Login Plugin

Started by omnitool, July 11, 2010, 08:34:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

omnitool

This plugin throws a "connect with Facebook" button underneath the login button in the sidebar. You can still login the normal way, but if you choose to login via facebook, it will automatically:
1) Register the user (if he hasn't logged in before) using his firstname.lastname.DOB as his username, Facebook Id as his password, and email as his email (if the user has opted out of making his email public, facebook will use a proxy email in stead).
2) Log that user in (guaranteed working email addy from FB means no need for verification)
3)put your FBpicture up beneath the logout button.

Here's a good tutorial on setting up a FB application which you will need to do to use this plugin. Its meant for a wordpress plugin, so instead of throwing the keys in a WP page, just you'll want to put that in the plugin in the appropriate fields. (I just made an array in codebase.php, maybe theres a better coppermine way to do things, but I'm a coppernewb;) )
http://www.youtube.com/watch?v=nFCIlfnwZQg

Here's some Facebook Documentation: http://developers.facebook.com/docs/authentication/
Here's what helped me wrap my head around the FB login process: http://github.com/facebook/php-sdk


Things I'd like to do:
1) Change login to fancy-pants javacript login.
2) Once you FBlogin, all the checking the FBsession stuff happens after Coppermine Authentication, so I had to make it refresh. later on, there was a change to the site that made this endlessly loop. That needs to be done cleaner.
3) I couldn't figure out how to find the 'logout button' in the $menu array, o I just used $menu[11]. If you rearranged your menu, be sure and change this or better yet make it so its automatic.

A note about the quality: This is my first coppermine plugin. If its a little hacked, its because I'd never heard about coppermine until a few days before I created this, and my boss gave me a very short deadline. I ended up getting it to "just work" for what we needed with not too much thought of scalability for other users.


Joachim Müller

#1
It's a pity that you haven't based your second generation plugin on the version that I originally had attached to your first draft version that you had to withdraw for personal reasons: the plugin that I had attached already used to contain several fixes and (most important of all) i18n. Some editing and work had already gone into the version I attached. Your second attempt is a step back. I had to perform a diff to get the delta between your initail version and the one I attached and apply the changes to your new version. Please be carefull as well with your version numbering scheme: your old copy had the version number 0.9, the one I attached in reply had 1.0. The new version you initially posted in this thread would have been v1.1, that's why my the version I have attached to my posting here is v1.2
As I consider the idea of the plugin promising I will add an actual config section to it, as it is my firm believe that actual, true plugins should not require the end user to modify any of the files.
With this being said, thanks again for your contribution.
I can see an issue though for end users: why are there two login buttons? In an ideal world, this wouldn't be a plugin, but a bridge file contribution.

Joachim

P.S. You might as well want to take a look at http://documentation.coppermine-gallery.net/en/dev_plugins.htm#plugin_writing_naming_conventions_archives

omnitool

#2
Quote from: Joachim Müller on July 12, 2010, 08:00:25 AM
It's a pity that you haven't based your second generation plugin on the version that I originally had attached to your first draft version that you had to withdraw for personal reasons: the plugin that I had attached already used to contain several fixes and (most important of all) i18n. Some editing and work had already gone into the version I attached. Your second attempt is a step back. I had to perform a diff to get the delta between your initail version and the one I attached and apply the changes to your new version.

By the time I had read your post, I tried to download your version. but it had moved to something called the CB board, which I didn't have permission to view. For some reason in this forum, you cant edit your own posts, you can't remove your own uploads, and for some reason you can't send messages to people, even if they message you. because of that I was unable to tell anybody what was going on.

Quote
Please be carefull as well with your version numbering scheme: your old copy had the version number 0.9, the one I attached in reply had 1.0. The new version you initially posted in this thread would have been v1.1, that's why my the version I have attached to my posting here is v1.2

The old post was deleted. I was told to not reference the old post and go on as if it never existed. that's what I did. personally, I don't think this plugin is quite ready to be >=1.0 which is why I versioned it 0.9.  I assumed anybody who was going to update my plugin would follow standard versioning conventions and update it to 0.9.1, 0.9.2, etc... until it was finally stable. You might want to look at http://en.wikipedia.org/wiki/Software_versioning#Version_1.0_as_a_milestone


QuoteAs I consider the idea of the plugin promising I will add an actual config section to it, as it is my firm believe that actual, true plugins should not require the end user to modify any of the files.
agreed. Thats what I said in my post. I just don't know how to use this because I've never worked with coppermine.
QuoteWith this being said, thanks again for your contribution.
I can see an issue though for end users: why are there two login buttons?

the top login button is to login the old way. The new 'Connect with facebook' button is to connect through facebook. If it were possible to do what ,say, youtube does and have a single username/password login box, I'd say go for it, but I'm pretty sure FB wants you to use their proprietary login box thats on their page. I say that because I've never seen a static facebook login box. but maybe I'm wrong.

QuoteIn an ideal world, this wouldn't be a plugin, but a bridge file contribution.

I don't know what that is. I've learned symfony, drupal, joomla, and wordpress, and never come accross a bridge file. Of course I'm self taught, so theres a lot I dont know that exists.

I'm not going to be maintaining this 'plugin' because we found a better solution and moved away from coppermine. I'm just offering it here if somebody else with coppermine experience wants to turn it into a plugin the coppermine way.

omnitool

and, of course, I can't edit my own post. :-\

Αndré

Quote from: Joachim Müller on September 28, 2008, 12:45:45 PM
The ability for regular users to edit their postings has deliberately been removed because of frequent abuse in the past.
As contributor you should be moved to the appropriate board group and get the permission to edit your posts.

Joachim Müller

Quote from: omnitool on July 13, 2010, 12:15:32 AM
and, of course, I can't edit my own post. :-\
You're not meant to, that's why. Postings remain unchanged preferably.

Quote from: omnitool on July 13, 2010, 12:14:51 AM
By the time I had read your post, I tried to download your version. but it had moved to something called the CB board, which I didn't have permission to view.
My version used to be attached to the posting in which I told you about the remnant private data inside your first public release, so this sound a bit implausible. Anyway, as I said, I have re-added the changes. Please base future contributions on the file I have attached.

Quote from: omnitool on July 13, 2010, 12:14:51 AMFor some reason in this forum, you cant edit your own posts, you can't remove your own uploads, and for some reason you can't send messages to people, even if they message you. because of that I was unable to tell anybody what was going on.
As André suggested, that's on purpose. We organize this forum differently: we believe in posting publicly, that's why there are no PMs allowed for regular users.

Quote from: omnitool on July 13, 2010, 12:14:51 AMpersonally, I don't think this plugin is quite ready to be >=1.0 which is why I versioned it 0.9.
I understand that version numbering scheme and I have seen it before of course. End users never care about such things, they never ask themselves what a version number zero dot something means. That's why I consider this numbering scheme overkill.
Quote from: omnitool on July 13, 2010, 12:14:51 AMI assumed anybody who was going to update my plugin would follow standard versioning conventions and update it to 0.9.1, 0.9.2, etc... until it was finally stable. You might want to look at http://en.wikipedia.org/wiki/Software_versioning#Version_1.0_as_a_milestone
I'm aware that there are various version numbering schemes. For Coppermine plugins we agreed to start counting at 1.0. If you think that your plugin isn't mature enough, you're welcome to illustrate that by saying so in the description or install text, that's our prefered method to make end users aware of the fact that we consider versions as not-stable-yet.

Quote from: omnitool on July 13, 2010, 12:14:51 AMI just don't know how to use this because I've never worked with coppermine.
Only recently I have finished coming up with additional documentation on adding config options, see http://forum.coppermine-gallery.net/index.php/topic,65526.msg327967.html#msg327967

Quote from: omnitool on July 13, 2010, 12:14:51 AMand never come accross a bridge file. Of course I'm self taught, so theres a lot I dont know that exists.
Try http://documentation.coppermine-gallery.net/en/bridging.htm#integrating_bridge_file_creating_start as a start

Quote from: omnitool on July 13, 2010, 12:14:51 AMI'm not going to be maintaining this 'plugin' because we found a better solution and moved away from coppermine. I'm just offering it here if somebody else with coppermine experience wants to turn it into a plugin the coppermine way.
OK, thanks again for your contrib. What license does your plugin come with? Is it GNU GPLed? Are we allowed to add it to the subversion repository?

Quote from: Αndré on July 13, 2010, 08:30:44 AM
As contributor you should be moved to the appropriate board group and get the permission to edit your posts.
You have been promoted to contributor status.

taucher_0815

I am getting an Error during installation of the plugin...

QuoteParse error: syntax error, unexpected '{' in /var/www/*some more text here*/coppermine/plugins/fb_oauth/codebase.php on line 69

Any idea on how to get around?

Αndré


taucher_0815

Jochen's version: cpg1.5.x_plugin_fb-oauth_v1.2.zip.zip

Αndré

Works for me as expected. Check if none of your files are corrupted/incomplete.

taucher_0815

uploaded several times. also the initial file from the Thread-Opener. Same Error.

May it be the PHP-Version? running on "PHP Version 4.4.9-0.dotdeb.1"

Αndré

Quote from: taucher_0815 on August 11, 2010, 12:09:01 PM
May it be the PHP-Version? running on "PHP Version 4.4.9-0.dotdeb.1"
Exceptions don't exist in PHP4:
Quote from: taucher_0815 on August 11, 2010, 11:38:23 AM
Parse error: syntax error, unexpected '{' in /var/www/*some more text here*/coppermine/plugins/fb_oauth/codebase.php on line 69
$me = null;
// Session based API call.
if (!empty($session)) {
  try {
    $uid = $facebook->getUser();
    $me = $facebook->api('/me');
  } catch (FacebookApiException $e) {
    error_log($e);
  }
}

taucher_0815

after switching to PHP Version 5.2.13-0.dotdeb.1

Parse error: syntax error, unexpected '}' in /var/www/*some more text here*/coppermine/plugins/fb_oauth/codebase.php on line 99

Αndré

Quote from: taucher_0815 on August 11, 2010, 12:22:52 PM
Parse error: syntax error, unexpected '}' in /var/www/*some more text here*/coppermine/plugins/fb_oauth/codebase.php on line 99

I cannot find a '}' on line 99:
Code (codebase.php, line 99) Select
$JS['includes'][] = 'plugins/fb_oauth/include/fbconnect.js';

I don't know what you're doing, sorry.

taucher_0815

strange... re-re-re-downloaded the zip, copied to the server inserted the requiered data and installed the plugin.

But now I do not see the FB-Connect-Button.

Using the unmodified "curve"-theme. Also copied the language file to german.php.

even a call to http://www.sk-foto.info/?lang=english does not bring this up


Αndré


taucher_0815

any idea on how to bring this to curve?

Αndré

You have to adjust the way how the button is added to the menu:
$new_button = array();
$new_button[0][0] = $buttonTtl;
$new_button[0][1] = $lang_plugin_fb_oauth['login_title'];
$new_button[0][2] = $buttonLnk;
$new_button[0][3] = 'fb_oauth';
$new_button[0][4] = $template_sys_menu_spacer;
$new_button[0][5] = 'rel="nofollow"';

array_splice($menu, count($menu)-1, 0, $new_button);


I cannot give you a working code snipped as I decided it's finishing time for today :P

purplefreak3

Hello I am trying to use this plugin but I use the Curve theme, looked around on how to add it but havn't had much luck. Possible any more details on how to bring this plugin to Curve them?

Gallery
http://www.beautifuljodelle.com/gallery-user-created

Αndré

Please read one post above... ::)