Hi,
While it seems fb_form was ported to Drupal 6, it doesn't work at all. It looks like there was supposed to be some shift from fb_form_request_selector to fb_form_multi_friend_selector that didn't happen...
At any rate there's theme functions such as theme_fb_form_request() that are lost because they're not referenced in hook_theme(), and when fb_form_invite_page() calls drupal_get_form('fb_form_multi_add_invite_form') it just returns null because Drupal can't find theme functions for theme keys 'fb_form_request_selector' and 'fb_form_request'.
I had a go at patching it up, but was unable to figure out what was deprecated and what was the new way. I haven't managed to get it to work yet.
I suspect this functionality was overlooked in the D6 port?
Sorry I can't offer a patch. I normally would, but I don't understand the workings of this module enough to do so.
Comments
Comment #1
Dave Cohen commentedThere are a number of things to clean up, in several modules including this. And the time has come. I'll do my best to take a look this week or early next and I'll let you know. (and get some other patches checked in at the same time).
I think the future of invite forms lies in contrib/fb_friend.module.
I appreciate the effort.
Comment #2
ahansen1 commentedI've started playing with the fix for this. I have the form returning, but it still doesn't show in the FBML. The only change I made was from:
To:
I can now see the form being output in the FBML debug, but it isn't showing the form on the page. My guess is there is still something missing with generating the proper FBML. Anyone else have any luck with this?
Comment #3
Dave Cohen commentedOK, finally some time to describe this... In upgrading to D6 I'm changing the way invite forms are supported. To be more consistent with the way Drupal generally works, the idea now is to create a data structure representing the markup, then drupal_render() it.
See fb/contrib/fb_friend.module. Specifically the code responsible for the
FB_FRIEND_DELTA_INVITE_PAGEblock. Currently, fb_friend.module works only on Facebook Connect pages. But the goal is to support canvas pages eventually. So try to use fb_friend.module instead of writing your own, but if that fails use it as an example.fb_friend currently provides two blocks. One will invite users to visit the current page. The other invites users to add the application. Try adding the "invite to current page" block to the footer of a Facebook Connect page. You should see a big invite form embedded within the page.
You can tweak various aspects of this form by implementing hook_fb_friend_invite_page_alter(). (It's really a drupal_alter function, slightly different from a hook, but you know what I mean.) The data structure you're altering represents the form described on http://wiki.developers.facebook.com/index.php/Fb:request-form, so read up there and use function like
dpm()to inspect the data.Comment #4
Dave Cohen commentedAnd here's one more trick...
If you want to render the invite form in a popup, use hook_fb_friend_invite_page_wrap_alter(). Sure, all the hooks and data structures seem a little crazy. But it's very flexible and I believe true to the Drupal Way.
Here's code that will provide a link that pops up the invite form. In this way you can make the block fit in a sidebar, for example.
Comment #5
Dave Cohen commentedI checked in a fix to fb_friends.module to support canvas pages and connect pages.
I'm trying now to make the Drupal for Facebook doc pages the best they can be. So instead of answering here, I wrote this: http://drupal.org/node/631216
If you run into problems with those instructions, use this issue queue for support.
Comment #6
ahansen1 commentedWith the noted patch I was once again able to use the invite form on D6. How I was able to accomplish similar functionality to the D5 fb/invite was to add the "Invite Facebook friends to install the current app" to a panel. This ended up working out well b/c then I was able to take over the whole page so that the full sized friend selector could be seen. The result can be seen here:
http://apps.facebook.com/howigotengaged/invite
It should be noted that as far as I can tell, the form alter given will only work on fb connect pages.
Comment #7
Dave Cohen commentedIt should be that the alter hooks are called whether in a canvas or connect page.
However, on a connect page, the default "wrap" will be the server-fbml tag. On canvas pages, it be an empty wrap.
And the example code I show, making the popup, is Facebook Connect only. I'm sure there's a way to accomplish that on canvas pages, but it would be using FBJS. The markup of my hook relies on some javascript in fb_connect.js to work. In short, I don't consider it a bug that the markup of that hook does not work on canvas pages. Its just an example of one way to use the hook.
Comment #9
psi-borg commentedeveryone, thanks for your continued efforts on the fb package. i'm wondering what the path looks like, for integrating facebook's friends invite with drupal's invite module http://drupal.org/project/invite such that invitations sent through fb can be tracked in drupal. if some guidance on where to start can be provided, i'd be willing to help develop this bridge.
Comment #10
Dave Cohen commentedFacebook is deprecating invites, in favor of messages to the user's inbox. Look for big changes in the way this is done. So I don't plan to change code for invite forms from this point on.
Check out facebook's wiki on the subject. There is, I believe, a way to learn which friends a user has invited. And please let us know if you end up doing this.
Comment #11
psi-borg commenteddave, as far as i could find, there wasn't a way to track which invite was accepted, given more than 1 user issued an invite to the same non-user. there was also no field in the FQL tables that i found that refers to accepted invites. i'm wondering if zynga gives credit to all inviters or just the 1 inviter whose invite was accepted. =)