Index: fb_form.info =================================================================== --- fb_form.info (revision 1.2) +++ fb_form.info (6.x working copy) @@ -1,8 +1,4 @@ name = Facebook Forms description = Enables FBML form elements via Drupal Form API. Provides commonly needed forms such as invite friends to install application. package = Facebook -dependencies[] = fb -core = 6.x - -version = "6.x-1.x-dev" - +dependencies = fb Index: fb_form.module =================================================================== --- fb_form.module (revision 1.3) +++ fb_form.module (6.x working copy) @@ -15,23 +15,21 @@ /** * hook_menu. */ -function fb_form_menu($may_cache) { +function fb_form_menu() { $items = array(); - if ($may_cache) { - // Page allowing a user to invite their friends to add the app. - $items[] = array('path' => 'fb/invite', - 'callback' => 'fb_form_invite_page', - 'access' => TRUE, + // Page allowing a user to invite their friends to add the app. + $items['fb/invite'] = array( + 'page callback' => 'fb_form_invite_page', + 'access callback' => TRUE, 'type' => MENU_CALLBACK, ); - } return $items; } /** * hook_form_alter. */ -function fb_form_form_alter($form_id, &$form) { +function fb_form_form_alter(&$form, &$form_state, $form_id) { // Drupal allows no clean way to set $form['#type'], so we hack... if ($type = $form['#type_hack']) { $form['#type'] = $type; @@ -52,7 +50,7 @@ if (function_exists('fb_canvas_is_fbml') && !fb_canvas_is_fbml()) { - drupal_set_message(t('Unable to display page. FBML required.'), 'error'); + drupal_set_message('Unable to display page. FBML required.', 'error'); drupal_not_found(); exit(); } @@ -82,7 +80,7 @@ if ($fbu = fb_facebook_user($fb)) { // Exclude friends who have already installed app. // http://wiki.developers.facebook.com/index.php/Fb:request-form - $rs = $fb->api_client->fql_query("SELECT uid FROM user WHERE has_added_app=1 and uid IN (SELECT uid2 FROM friend WHERE uid1 = $fbu)"); + $rs = $fb->api_client->fql_query("SELECT uid FROM {user} WHERE has_added_app=1 and uid IN (SELECT uid2 FROM {friend} WHERE uid1 = $fbu)"); $arFriends = ""; // Build an delimited list of users... if ($rs) { @@ -162,7 +160,7 @@ $items = array(); if ($fb) { - $query = "SELECT last_name, first_name, uid, pic_square FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=$fbu)"; + $query = "SELECT last_name, first_name, uid, pic_square FROM {user} WHERE uid IN (SELECT uid2 FROM {friend} WHERE uid1=$fbu)"; //TODO: db_query this to be safe? $result = $fb->api_client->fql_query($query); // TODO: sort results by name @@ -176,14 +174,14 @@ function fb_form_group_member_options($fbg, $fbu) { global $fb; - $query = "SELECT uid FROM group_member WHERE gid=$fbg"; + $query = "SELECT uid FROM {group_member} WHERE gid=$fbg"; //TODO: db_query this? $result = $fb->api_client->fql_query($query); drupal_set_message("fb_form_group_member_options($fbg, $fbu) query $query returns" . dpr($result, 1)); - $query = "SELECT uid, first_name, last_name FROM user WHERE uid IN (SELECT uid FROM group_member WHERE gid=$fbg)"; + $query = "SELECT uid, first_name, last_name FROM {user} WHERE uid IN (SELECT uid FROM {group_member} WHERE gid=$fbg)"; //TODO: db_query to be safe? $result = $fb->api_client->fql_query($query); drupal_set_message("fb_form_group_member_options($fbg, $fbu) query $query returns" . dpr($result, 1)); @@ -254,7 +252,7 @@ static $options = NULL; if (!$options) { - $query = "SELECT last_name, first_name, uid, pic_square FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=".fb_facebook_user().")"; + $query = "SELECT last_name, first_name, uid, pic_square FROM {user} WHERE uid IN (SELECT uid2 FROM {friend} WHERE uid1=". fb_facebook_user() .")"; $result = $fb->api_client->fql_query($query); // TODO: sort results by name @@ -279,6 +277,14 @@ //drupal_set_message("friend_selector_value" . dpr($form, 1)); } +function fb_form_theme() { + return array( + 'friend_selectorXXX' => array( + 'arguments' => array('fbu' => NULL), + ), + ); +} + // TODO: provide some alternative when NOT a facebook app. // deprecated! function theme_friend_selector($fbu = NULL) { @@ -289,4 +295,3 @@ $output = ""; return $output; } -?> \ No newline at end of file