'; else echo ''; ?> Settings'; $links[] = 'Donate'; } return $links; } // action links add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'sfc_settings_link', 10, 1); function sfc_settings_link($links) { $links[] = 'Settings'; return $links; } // add the admin settings and such add_action('admin_init', 'sfc_admin_init',9); // 9 to force it first, subplugins should use default function sfc_admin_init(){ $options = get_option('sfc_options'); if (empty($options['api_key']) || empty($options['app_secret']) || empty($options['appid'])) { add_action('admin_notices', create_function( '', "echo '

".sprintf('Simple Facebook Connect needs configuration information on its settings page.', admin_url('options-general.php?page=sfc'))."

';" ) ); } else { sfc_featureloader(); add_action('admin_footer','sfc_add_base_js',20); } wp_enqueue_script('jquery'); register_setting( 'sfc_options', 'sfc_options', 'sfc_options_validate' ); add_settings_section('sfc_main', 'Main Settings', 'sfc_section_text', 'sfc'); add_settings_field('sfc_api_key', 'Facebook API Key', 'sfc_setting_api_key', 'sfc', 'sfc_main'); add_settings_field('sfc_app_secret', 'Facebook Application Secret', 'sfc_setting_app_secret', 'sfc', 'sfc_main'); add_settings_field('sfc_appid', 'Facebook Application ID', 'sfc_setting_appid', 'sfc', 'sfc_main'); add_settings_field('sfc_fanpage', 'Facebook Fan Page', 'sfc_setting_fanpage', 'sfc', 'sfc_main'); } // add the admin options page add_action('admin_menu', 'sfc_admin_add_page'); function sfc_admin_add_page() { $mypage = add_options_page('Simple Facebook Connect', 'Simple Facebook Connect', 'manage_options', 'sfc', 'sfc_options_page'); } // display the admin options page function sfc_options_page() { ?>

Simple Facebook Connect

Options relating to the Simple Facebook Connect plugins.

About the Author

Simple Facebook Connect is developed and maintained by Otto.

He blogs at Nothing To See Here and Otto on WordPress, posts photos on Flickr, and chats on Twitter.

You can follow his site on either Facebook or Twitter, if you like.

If you'd like to buy him a beer, then he'd be perfectly happy to drink it.

Facebook Platform Status

1, 'items' => 10) ); ?>

To connect your site to Facebook, you will need a Facebook Application. If you have already created one, please insert your API key, Application Secret, and Application ID below.

Can't find your key?

  1. Get a list of your applications from here: Facebook Application List
  2. Select the application you want, then copy and paste the API key, Application Secret, and Application ID from there.

Haven't created an application yet? Don't worry, it's easy!

  1. Go to this link to create your application: Facebook Connect Setup
  2. When it tells you to "Upload a file" on step 2, just hit the "Upload Later" button. This plugin takes care of that part for you!
  3. On the final screen, there will be an API Key field, in the yellow box. Copy and paste that information into here.
  4. You can get the rest of the information from the application on the Facebook Application List page.
  5. Select the application you want, then copy and paste the API key, Application Secret, and Application ID from there.
api_client->admin_getAppProperties(array('connect_url')); } catch (Exception $e) { // bad API key or secret or something $error=true; echo '

Facebook doesn\'t like your settings, it says: '; echo $e->getMessage(); echo '.

'; } if (is_array($a)) { $connecturl = $a['connect_url']; } else if (is_object($a)) { // seems to happen on some setups.. dunno why. $connecturl = $a->connect_url; } if (isset($connecturl)) { $siteurl = trailingslashit(get_option('siteurl')); if (strpos($siteurl, $connecturl) === false) { $error = true; echo '

Your Facebook Application\'s "Connect URL" is configured incorrectly. It is currently set to "'. $connecturl . "\" when it should be set to \"{$siteurl}\" .

"; } if ($error) { ?>

To correct these errors, you may need to edit your applications settings and correct the values therein. The site will not work properly until the errors are corrected.

(required)"; } function sfc_setting_app_secret() { $options = get_option('sfc_options'); echo " (required)"; } function sfc_setting_appid() { $options = get_option('sfc_options'); echo " (required)"; if (!empty($options['appid'])) echo "

Here is a link to your applications wall. There you can give it a name, upload a profile picture, things like that. Look for the \"Edit Application\" link to modify the application.

"; } function sfc_setting_fanpage() { $options = get_option('sfc_options'); ?>

Some sites use Fan Pages on Facebook to connect with their users. The Application wall acts as a Fan Page in all respects, however some sites have been using Fan Pages previously, and already have communities and content built around them. Facebook offers no way to migrate these, so the option to use an existing Fan Page is offered for people with this situation. Note that this doesn't replace the application, as that is not optional. However, you can use a Fan Page for specific parts of the SFC plugin, such as the Fan Box, the Publisher, and the Chicklet.

If you have a Fan Page that you want to use for your site, enter the ID of the page here. Most users should leave this blank.

"; } // validate our options function sfc_options_validate($input) { // api keys are 32 bytes long and made of hex values $input['api_key'] = trim($input['api_key']); if(! preg_match('/^[a-f0-9]{32}$/i', $input['api_key'])) { $input['api_key'] = ''; } // api keys are 32 bytes long and made of hex values $input['app_secret'] = trim($input['app_secret']); if(! preg_match('/^[a-f0-9]{32}$/i', $input['app_secret'])) { $input['app_secret'] = ''; } // app ids are big integers $input['appid'] = trim($input['appid']); if(! preg_match('/^[0-9]+$/i', $input['appid'])) { $input['appid'] = ''; } // fanpage ids are big integers $input['fanpage'] = trim($input['fanpage']); if(! preg_match('/^[0-9]+$/i', $input['fanpage'])) { $input['fanpage'] = ''; } $input = apply_filters('sfc_validate_options',$input); // filter to let sub-plugins validate their options too return $input; } // this adds the app id to allow you to use Facebook Insights on your domain, linked to your application. add_action('wp_head','sfc_meta_head'); function sfc_meta_head() { $options = get_option('sfc_options'); if ($options['appid']) { ?> ' /> get_queried_object_id() ) { $link = get_permalink( $id ); echo "\n"; } } else if (is_home()) { $link = get_bloginfo('url'); echo "\n"; } }