/** * @static * @param object $account * @param WP_Post $post * @param Social_Service_Facebook $service * * @return object|bool */ public static function social_get_broadcast_account($account, $post, $service) { if ($service->key() == 'facebook') { // Load accounts $found = false; $accounts = $service->accounts(); foreach ($accounts as $_account) { $pages = $_account->pages(null, 'combined'); if (isset($pages[$account->id])) { $found = true; $account = $_account->broadcast_page($pages[$account->id]); break; } } if (!$found) { $personal_accounts = get_user_meta($post->post_author, 'social_accounts', true); if (isset($personal_accounts['facebook'])) { foreach ($personal_accounts['facebook'] as $account_id => $_account) { $_account = new Social_Service_Facebook_Account($_account); $pages = $_account->pages(null, 'combined'); if (isset($pages[$account->id])) { $found = true; $account = $_account->broadcast_page($pages[$account->id]); break; } } } } if ($found) { return $account; } } return false; }
/** * Child account avatar. * * @return string */ public function child_account_avatar($child_account) { $service = new Social_Service_Facebook(); return $service->page_image_url($child_account); }