Exemplo n.º 1
0
 /**
  * Allow an author to disable posting to Timeline by default.
  *
  * @since 1.2
  *
  * @param WP_User $wordpress_user WordPress user object for the current profile.
  * @return void
  */
 public static function personal_options($wordpress_user)
 {
     if (!($wordpress_user && isset($wordpress_user->ID))) {
         return;
     }
     if (!class_exists('Facebook_User')) {
         require_once dirname(dirname(__FILE__)) . '/facebook-user.php';
     }
     if (!Facebook_User::can_publish_to_facebook($wordpress_user->ID, false)) {
         return;
     }
     echo '<tr class="facebook-post-to-timeline"><th scope="row">Facebook</th><td><input class="checkbox" type="checkbox" name="facebook_timeline" id="facebook-timeline" value="1"';
     checked(!Facebook_User::get_user_meta($wordpress_user->ID, 'facebook_timeline_disabled', true));
     echo ' /> <label for="facebook-timeline">' . esc_html(__('Post an article to my Facebook Timeline after it is public.', 'facebook')) . '</label><br /></td></tr>';
 }
 /**
  * Can the current user publish to Facebook?
  *
  * @since 1.1
  *
  * @param int $wordpress_user_id WordPress user identifier
  * @return bool true if Facebook data stored for user and permissions exist
  */
 public static function user_can_publish_to_facebook($wordpress_user_id = null)
 {
     global $facebook_loader;
     if (!class_exists('Facebook_User')) {
         require_once $facebook_loader->plugin_directory . 'facebook-user.php';
     }
     return Facebook_User::can_publish_to_facebook($wordpress_user_id);
 }
Exemplo n.º 3
0
 /**
  * Can the current user publish to Facebook?
  *
  * @since 1.1
  * @return bool true if Facebook data stored for user and permissions exist
  */
 public static function user_can_publish_to_facebook()
 {
     if (!class_exists('Facebook_User')) {
         require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/facebook-user.php';
     }
     $current_user = wp_get_current_user();
     if (Facebook_User::can_publish_to_facebook() && !Facebook_User::get_user_meta($current_user->ID, 'facebook_timeline_disabled', true)) {
         return true;
     }
     return false;
 }