The purpose of this module will be to import publicly available photos from a person's Facebook profile or Fan Page into Drupal. It does so by creating internal tables in the Drupal schema (currently an albums table and a photos table), and then populating these tables with references to the location of the facebook photos. Upon uploading new photos to a person's Facebook profile or fan page, an administrator needs to login to Drupal and click on a 'Synchronise' button - the module will then use Facebook's API to connect to Facebook, and import all photos in local Drupal tables.
A public page will be made visible in drupal, where users can browse photo albums, and the photos in each albums in turn. This functionality is currently available in the following website - http://beta.marhaba.co.nz/albums; however, the website is still in constant development and there is no guarantee that the referenced link will be available for public when this motivation's review is being conducted.
I plan to allow the albums and photos being presented using tradionatial HTML+CSS and using an open source Flash slideshow plugin like dfGallery.
I have started building this functionality after finding no Drupal module allowing such functionality. Most Facebook modules available for Drupal allow for 'each logged in user' to import their own content from Facebook. This module differs by allowing the admin of the website to import their own photos from Facebook and sharing it with all visitors to the website.
I have working code now that successfully works. I am currently polishing it up and at the stage where getting community feedback whilst developing will be useful - hence my application for a CVS account now.
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | fbphotos.zip | 19.69 KB | hadyos |
| #14 | fbphotos.zip | 20.25 KB | hadyos |
| #11 | fbphotos.zip | 29.9 KB | hadyos |
| #7 | fbphotos.zip | 19.92 KB | hadyos |
| #5 | fbphotos.zip | 24.17 KB | hadyos |
Comments
Comment #1
hadyos commentedTo run this module, you will need the following:
* Add the Facebook Developer application and create a new application
* Facebook API and Secret Key
This module is still in development. There are obvious things that are in my list for tidy up before releasing such as the use of check_plain's where appropriate and appropriate permission attributes. However, the attached module is good enough for use and getting the picture of where the module is heading.
[UPDATE: NEW MODULE ATTACHMENT MADE IN A POST BELOW. ATTACHMENT TO THIS POST IS OUTDATED - DO NOT DOWNLOAD]
Comment #2
avpadernoComment #3
hadyos commentedPlease discard my previous attachment. I have attached the latest source code of my proposed fbphotos module to this posting.
This version is more complete and works end to end at the moment. You can see it in action on the following link: http://beta.marhaba.co.nz/fbalbums.
New to this version of the module is the use of Zen Flash Gallery to display the imported Facebook photos in a funky style.
Comment #4
avpadernoIn Drupal.org CVS the only accepted files are the ones licensed under GPL license v2+; compatible licenses are not accepted.
Files available from third-party sites should not be included in Drupal.org CVS.
Comment #5
hadyos commentedAttached a new iteration of the Facebook Photos module. New in this iteration
o Removal of any files that are not under the GPL license
o Added README.txt file with instructions on installation
o Added extra functionality to the module to allow display imported Facebook photos in more than one method (e.g. Standard HTML, lightBox, Zen Flash Gallery)
Kindly review the latest attachment please.
Comment #6
matt2000 commentedI wonder if you could add your css in fbphotos.page.inc instead of using hook_init and adding it on every page load?
Comment #7
hadyos commentedThanks for the review matt. Whilst reading the Drupal API, it was mentioned that
hook_initis usually the place were all the CSS and JS files are included for a given module. However, I do see your point that not all screens of my module require my custom CSS.I have uploaded a new version of my module with the following changes:
I am using this module now on a production site, and it is fairly stable in my opinion. Looking forward to the CVS account and contributing back to Drupal!
Comment #8
avpadernoThe CSS files added in
hook_init()are added to all the pages; rather than checking the page being viewed, it is better to add the CSS files in the menu callback for the pages that need those CSS files.Comment #9
hadyos commentedYip, I have done something similar to that now - although doesn't look as nice :\
Comment #10
matt2000 commentedI haven't looked real deep to see if this might be handled elsewhere, but at first glance, it looks like there may be unsanitized user-generated URLs being output, for example in the block. User-generated content (including data supplied by Facebook API) should be run through check_plain(), or filter_xss(), or in the case of URLs, l().
Other than that, a visual review of the code shows that hadyos has a good understanding of the Drupal API and best practices, including security considerations, with the possible exception of the above.
IMHO, this can be RTBC once the above is addressed, and someone actually installs the module to ensure that it doesn't obviously break anything.
Comment #11
hadyos commentedThanks for the review matt.
I agree. My code was fetching rows from the database (populated with Facebook data) and using them 'as-is' in any of the theme functions without any santisation.
I have updated the code as follows:
The new version of the code has been tested by me, and look exactly the same as is - except it is a lot more secure now. Only downside of this change is my code now looks a bit 'heavy' :\
Kindly review my code again and approve. It would be a nice Christmas gift to be given a CVS account before the end of the year :)
Comment #13
avpadernoThe file LICENSE.txt needs to be removed; Drupal.org CVS doesn't allow to commit that file.
Comment #14
hadyos commentedI have re bundled the fbphotos module again without the LICENSE.txt and attached to post.
Comment #15
avpadernoComment #16
bizkut commentednice module! :)
Comment #17
bizkut commentedyour module uses db_rewrite_sql() which doesn't work with i18n
Comment #18
avpadernoWhen the code uses %-placeholders, there is no need to pass the argument to
check_plain(), because that is already done byt().db_rewrite_sql()is not correct; without further arguments, the function takes the query is for the nodes table, which is not true in this case. If there are no modules that implement hook_db_rewrite_sql() to alter the table created by your module, it's probably that callingdb_rewrite_sql(), or not doesn't make any differences.Out of the points I reported, the point about the function names is the one that needs to be fixed, to get this application approved.
Comment #20
robino commentedI am not a developer but I used your module to test. I run into some issues to display the albums to all other users except me.
the bug in in sites/all/modules/fbphotos/fbphotos.page.inc on line 9 is in:
$result = pager_query(db_rewrite_sql($sql), variable_get('fbphotos_albums_limit', 10), 0);
I changed that into:
$result = pager_query(($sql), variable_get('fbphotos_albums_limit', 10), 0);
And it worked :)
Comment #21
hadyos commentedThanks for everyone's comments.
I have uploaded a new version of the module to address all issues that were raised.
@kiamlaluno
* Fixed extra calls to check_plain(). All placeholders passed to the t() function no longer call check_plain
* Removed usage of db_rewrite_sql(). I initially thought that was required to convert {table names} to their prefixed names; that is already handled inherently by Drupal
* All user interface comments now use sentence case. I have stuck to spelling 'Facebook' with a capital F though.
* All function names to me are currently correct and reflect my purpose for them. I have correct $ID tags to all files that I wish to have committed as part of this module.
@robino
* Thanks for raising your issue. I have fixed it as well in this attachment. With that said, I was unsure why you hit your problem and how that code fix made any difference.
Comment #23
jupiterchild commentedInstalled this today following the VERY good instructions in the readme.txt; very easy to install.
I'm not a developer or coder so I can only relay my experience and mention a couple of issues:
Thumbnails link back to www.example.com/fbalbums/00000000 which fails if Drupal is installed in a sub-directory i.e. www.example.com/cms/fbalbums/00000000
I had issues when synchronising Albums with Facebook. The first synch goes OK but any subsequent synch just hangs. I found I needed to clear my recent cookies and and then the synch works.
Great module.
Comment #24
jupiterchild commentedProblem seems to be at line 220 :
$img_link = check_url($base_url . "/fbalbums/{$photo->aid}/photo/{$photo->pid}");
$img_link = check_url($base_url . "/cms/fbalbums/{$photo->aid}/photo/{$photo->pid}");
as a quick fix I added my sub-directory to the path.
Comment #25
avpadernoThe code should use
url()to obtain the URL.I am changing the status as per previous comment.
Comment #26
jupiterchild commentedChanging line 220
from:
$img_link = check_url($base_url . "/fbalbums/{$photo->aid}/photo/{$photo->pid}");
to:
$img_link = url($base_url . "fbalbums/{$photo->aid}/photo/{$photo->pid}");
fixes the problem for me.
Comment #27
jupiterchild commentedNot quite fixed, since this introduces another error:
We are yet to import any photos ;) continues to be displayed in the thumbnail block.
line 227
$content .= "<li>We are yet to import any photos ;)</li>";I guess I'll leave it to the coders.
Comment #28
jupiterchild commentedFrom a usability point of view it would be useful to be able to control the maximum display size of the original photo. I've been using the default 'html viewer' and since the user has no control over the size of the original Facebook photos invariably some of the photos are quite large, this results in horizontal scroll bars.
I've not had time to install and use the other viewers.
Comment #29
jupiterchild commented@#28 Realised I could do this by theming fbphotos_photo.tpl.php
Comment #30
jupiterchild commentedI have used fbphotos over several days and not had any major issues until I installed fbconnect (http://drupal.org/project/fbconnect) module.
Both modules operate OK except when in order to refresh the album contents I use the fbphotos 'Synchronise All' button. I then receive the following error message:
Fatal error: Cannot redeclare class FacebookRestClientException in /home/*******/public_html/*******/cms/sites/all/modules/fbphotos/facebook-client/facebookapi_php5_restlib.php on line 3784
Disabling the fbconnect module fixes the issue (I have tried this several times, just to confirm).
Wasn't sure which issue queue to post this in but since hadyos is wanting reviews I've posted the issue here.
Comment #31
hadyos commentedThanks a lot for your feedback jupiterchild. I'll update the module on the weekend to fix the issues you have raised.
Re @#30, both fbphotos and fbconnect utilise Facebook's PHP API which is causing a conflict when both of them are being used at the same time.
Comment #32
jupiterchild commented@hadyos #31
One other thing I noticed is the thumbnail block only ever selects images in landscape mode. I looked at the code, though not being a coder I was unsure whether this is by design, since the code seems to be selecting images with a greater width than height.
The Facebook PHP API could become an issue since I guess more Facebook / Drupal modules will gradually come on stream.
This is a great module, does exactly what I require, and I personally see no reason not to release it.
Comment #33
hadyos commented@jupiterchild #32
You caught-up on the thumbnail behaviour quite correct. I built this module initially for a website of mine. The portrait thumbnail photos was messing my pixel perfect layout, hence I wanted to always return landscape thumbnails.
As part of the next fix I'll release, I'll make this a configurable item.
Thanks a lot for your feedback - much appreciated. As you can see I have been waiting since October 2009 to try and get it release but I get review feedbacks once a month :) Can't wait myself for it to be on the Drupal module list!
Comment #35
avpadernoThere have not been replies in the last week. I am marking this application as .
Comment #36
blaiz commentedSubscribe
Comment #37
blaiz commentedHi everyone,
Is this project still alive? I'm looking for a way to import photo albums from a public page to my Drupal website and this module is the only one I could find that can do that.
However, after following the instructions in the README file, I have this error on facebook.com:
Has anybody had this error before?
Thanks,
Blaiz
Comment #38
hadyos commentedHey Blaiz,
I was actively working on this project by the CVS approval dragged for too long. Let me know how I can recreate the above error that you are getting and I can try and make a new patch of the module along with fixing your issue.
Always happy to see there is interest for my facebook photos module.
Hady
Comment #39
blaiz commentedHi Hadyos,
I finally got it working, I had to add a next URL on the Facebook application, then add it on my profile and synchronize. It works really well, all the albums are here, I added lightbox, that's really cool.
I really hope it can become a hosted module on Drupal and receive updates because we really need such a module.
However there are some functionalities that we need also. We would like to customize the title of the photo albums. I changed the name from "Album - " to "Photo album: ", by directly changing it in the files but I think it would be cool to be able to do it through a GUI. Another nice feature would be to use the album title in the URL, and make URLs more customizable in general (e.g. instead of /fbalbums/14546451468, it would be cool to have /san-francisco-photos/north-beach).
I will look into it, see how hard it could be to implement that, but I have never worked on a module source code before so I don't know if I'll be able to do it myself.
Thanks
Comment #40
blaiz commentedOk I finally got working what I wanted to do.
The name of the album is now appended in the URL. I used a pathauto function to do that and it works pretty well. That's a bit better for SEO. You need the pathauto module installed and enabled to use this function.
Here is the code, in the fbphotos.page.inc file, after line 17:
and you get a URL like youwebsite.com/fbalbums/987646749648_1894651/your-album-title-inserted-here
Comment #41
jazzitup commented@blaiz: can you confirm an issue with FBConnect and this module?
@hadyos: did you try to host this module at drupal.org?
Comment #42
blaiz commentedI'm not using the FBConnect module.
Comment #43
dobbler commentedHi,
I have this all working but I'm at a loss as to how to display the galleries on the frontend?!?
Am I just missing something glaringly obvious?
Many thanks and great module!
Regards,
Rob.
(Maybe this isn't the place to post this?)
Comment #44
dobbler commentedOops! I found it! It was glaringly obvious!
Comment #45
hadyos commentedhey all,
thanks for everyone's interest in the module. I have tried to apply for this module to be accepted in drupal.org as you can see in this thread. the time taken to review every iteration of my code took too much time and i eventually got busy with other work.
i'm currently working on another drupal module, and will try and give applying for this module into drupal.org another shot!
Comment #46
blaiz commentedawesome!
Good luck
Comment #47
steviesky commentedHi Hadyos,
What a great module and something that is really necessary in the drupal module arsenal. All the sites i am going to do want to have there photos on there site aswell and i cant understand why this is not being accepted. Is there any site or place that people can email to try and enforce the module acceptors to take notice.
Great work,
Steve
Comment #48
arianek commentedHi. Please read all the following and the links provided as this is very important information about your CVS Application:
Drupal.org has moved from CVS to Git! This is a very significant change for the Drupal community and for your application. Please read the following documentation on how this affects and benefits you and the application process:
Migrating from CVS Applications to (Git) Full Project Applications
Comment #49
avpadernoThe user who applied for the CVS account didn't reply from April 2010, and on May 14 the application has been closed. Since then, the OP has not uploaded new versions of the code, even if he got reports about what should be changed.
I am closing this application.