There is a module called Link, which adds a Link field type to Drupal. You can use this new field type when adding fields to user profiles.
I used the Link field type to add a Facebook profile field to user profiles. The field should contain the URL of the user's Facebook profile (e.g. http://www.facebook.com/firstname.lastname).
Now I would like the Facebook OAuth module to map the Facebook profile URL to this Drupal field. But it is not possible, when the field type is Link. It is only possible if the field type is Text. But in that case, the Facebook profile URL is not displayed as a clickable hyperlink on the user profile page, but only as a plain text (non-clickable).
It would be really useful if the Facebook OAuth module was able to map the Facebook profile link from a Facebook data source to a Drupal Link field.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | Allow-mapping-of-FB-profile-url-to-Link-field-157030-7.patch | 27.77 KB | darrellduane |
Comments
Comment #1
grasmash commentedscrap2000,
You can actually do this on your own using FBOauth's API. Checkout related tutorial here:
http://grasmash.com/article/connecting-facebook-drupal-easy-way
Basically, you can create hook in your own custom module to permit mapping to a link field.
Comment #2
darrellduane commentedI agree with Scrap2000 that this functionality should be available out of the box from the fboauth module. I'll be sending over a patch shortly.
Comment #3
darrellduane commentedOK, here's a patch, I added the 'link-field' as a valid field type for the Website and Facebook profile link fields.
I patched it against the 7.x-1.6 release as the master is out of date.
Comment #4
darrellduane commentedThere's a bug in this patch where the data doesn't get loaded. I'll submit a new patch shortly.
Comment #5
darrellduane commentedComment #6
darrellduane commentedOk, I've added in the fixes to make this patch work. I had to add in code to actually deal with link fields in the /includes/fboauth.field.inc file.
As a part of this patch, I've fixed numerous issues that the coder module found with /includes/fboath.fboauth.inc and /includes/fboauth.field.inc files. I did this because I've got another patch I recently submitted that was rejected because it didn't meet coder standards.
I've got two other patches I'm working on--One that imports city and state information for the US and Canada, and one that allows this module to play nice with the multiple_emails module. Those two patches, if you want to use them, should be applied first, before this patch, as this patch changes a lot due to the coder fixes. I'll post links to them here once I submit them.
Comment #7
darrellduane commentedFacebook URLs can now be directly mapped and copied into Drupal Link fields, as can the Blog/Website field.
This patch that also incorporates fixes for:
Adding in support for Multiple Email involved rewriting the login logic at connection time, but all of the same functionality is maintained. The code in includes/fboauth.fboauth.inc and in includes/fboauth.fields.inc has been cleaned up based on recommendations from Coder.
Comment #8
darrellduane commentedComment #9
quicksketchThanks for the patch @DarrellDuane! I'd be happy to make you co-maintainer for the project! A few things about this patch in particular:
It's great that we're formatting these lines so they fit easier in 80 characters, but if we're just doing formatting, we should match the Drupal coding standards and close parens so their on the matching indentation. Additionally you should *never* put a new line inside of a t() or watchdog() call, because that means when the text is translated, the new line itself has to be translated as well. Changing the location of the new line (to alter the line wrapping) would cause existing translations to break.
Although I can't find explicit evidence in the documented coding standards, I'm fairly sure if you wrapped the line, matching up opening and closing parens so they are on the same vertical link would look like this:
But by far the most common approach in Drupal core is to just put it all on one line, since translated strings tend to exceed the 80 character bar anyway and you can't break it up even if you wanted to.
Overall though, formatting doesn't bother me too much even if it varies slightly from core, but let's not break our translated strings. :)
I've given you commit access to the project, welcome aboard!
Comment #10
quicksketchOne more thing about translated strings:
The check_plain() should go around the outside, not the inside of t(). Otherwise translators are going to need to translate "&" instead of translating "&" (and other unencoded characters).
Comment #11
darrellduane commentedThanks for the tips, I'll fix this before committing!
Comment #13
darrellduane commentedComment #14
darrellduane commented