You are here

function fb_test_create_form_submit in Drupal for Facebook 6.3

Same name and namespace in other branches
  1. 7.3 contrib/fb_test.module \fb_test_create_form_submit()

File

contrib/fb_test.module, line 65
http://developers.facebook.com/docs/test_users

Code

function fb_test_create_form_submit($form, &$form_state) {
  $values = $form_state['values'];
  $fb_app = $form['#fb_app'];
  try {
    $fb = fb_api_init($fb_app);
    for ($i = 0; $i < $values['how_many']; $i++) {
      $result = $fb
        ->api($fb_app->id . "/accounts/test-users", 'POST', array(
        'installed' => $values['installed'],
        'permissions' => $values['perms'],
        'access_token' => fb_get_token($fb),
      ));
    }
    drupal_set_message(t('Created %num test accounts.', array(
      '%num' => $values['how_many'],
    )));
  } catch (Exception $e) {
    fb_log_exception($e, t('Failed to create test accounts.'));
  }
}