function wordbooker_poll_facebook($single_user = null) { global $wpdb, $user_ID, $table_prefix, $blog_id; # If a user ID has been passed in then restrict to that single user. wordbooker_trim_errorlogs(); $limit_user = ""; if (isset($single_user)) { $limit_user = "******" . $single_user . " limit 1"; } $wordbooker_settings = get_option('wordbooker_settings'); # This runs through the Cached users and refreshes them $sql = "Select user_id,name from " . WORDBOOKER_USERDATA . $limit_user; $wb_users = $wpdb->get_results($sql); if (is_array($wb_users)) { wordbooker_debugger("Batch Cache Refresh Commence ", " ", -1, 9); foreach ($wb_users as $wb_user) { wordbooker_debugger("Calling Cache refresh for : ", $wb_user->name . " (" . $wb_user->id . ")", -1, 9); $wbuser = wordbooker_get_userdata($wb_user->user_id); # $fbclient = wordbooker_fbclient($wbuser); wordbooker_cache_refresh($wb_user->user_id); } wordbooker_debugger("Batch Cache Refresh completed ", " ", -1, 9); } }
function wordbooker_option_notices() { global $user_ID, $wp_version, $blog_id; wordbooker_upgrade(); wordbooker_trim_postlogs(); wordbooker_trim_errorlogs(); $errormsg = null; if (!function_exists('curl_init')) { $errormsg .= __('Wordbooker needs the CURL PHP extension to work. Please install / enable it and try again', 'wordbooker') . ' <br />'; } if (!function_exists('json_decode')) { $errormsg .= __('Wordbooker needs the JSON PHP extension. Please install / enable it and try again ', 'wordbooker') . '<br />'; } if (!function_exists('simplexml_load_string')) { $errormsg .= __('Your PHP install is missing <code>simplexml_load_string()</code> ', 'wordbooker') . "<br />"; } $wbuser = wordbooker_get_userdata($user_ID); if (strlen($wbuser->access_token) < 50) { $errormsg .= __("Wordbooker needs to be set up", 'wordbooker') . "<br />"; } else { if ($wbuser->facebook_error) { $method = $wbuser->facebook_error['method']; $error_code = $wbuser->facebook_error['error_code']; $error_msg = $wbuser->facebook_error['error_msg']; $post_id = $wbuser->facebook_error['postid']; $suffix = ''; if ($post_id != null && ($post = get_post($post_id))) { wordbooker_delete_from_postlogs($post_id, $blog_id); $suffix = __('for', 'wordbooker') . ' <a href="' . get_permalink($post_id) . '">' . get_the_title($post_id) . '</a>'; } $errormsg .= sprintf(__("<a href='%s'>Wordbooker</a> failed to communicate with Facebook" . $suffix . ": method = %s, error_code = %d (%s). Your blog is OK, but Facebook didn't get the update.", 'wordbooker'), " " . WORDBOOKER_SETTINGS_URL, " " . wordbooker_hyperlinked_method($method), " " . $error_code, " " . $error_msg) . "<br />"; wordbooker_clear_userdata_facebook_error($wbuser); } } if ($errormsg) { ?> <h3><?php _e('Notices', 'wordbooker'); ?> </h3> <div class="wordbooker_notices" style="background-color: #f66;"> <p><?php echo $errormsg; ?> </p> </div> <?php } }