function gdm_blogger_post_processing() { $clients = new gdm_clients(); // TODO move pending posts to new post status $pending_posts = $clients->get_schedule_by_status("pending"); foreach ($pending_posts as $user_id => $posts) { foreach ($posts as $post) { wp_update_post(array("ID" => $post, "post_status" => "assigned")); $clients->update_schedule($user_id, $post, "pending", "assigned"); } } // TODO publish posts marked for publishing }
<p> <b>Add Client:</b> <input type="text" name="gdm_new_client"> <b>OR</b><br> <b>Edit Client:</b> <select name="gdm_existing_client"> <option value="" selected="selected"></option> <?php foreach ($clients as $id => $client) { echo "<option value='" . $id . "'>" . $client['name'] . "</option>"; } ?> </select> <small>If editing a client, only non-empty fields will be updated</small><br> Posts/Month: <input type="number" name="gdm_client_freq"><br> Website: <input type="url" name="gdm_client_url"><br> Categories: <input type="text" name="gdm_client_categories"> <small>Comma-Seperated Please!</small> </p> <input type="submit" class="button button-primary" name="gdm_client_submit" value="Submit"> </form> <?php // getting array out of the way error_reporting(E_ALL); require_once GDM_BLOGGER_DIR . "/library/gdm_blogger_cron.class.php"; $gdm_cron = new gdm_cron(); $gdm_cron->gdm_blogger_url_checker(); print "list: <pre>"; print_r($gdm_clients->list); print "</pre>"; print "schedule: <pre>"; print_r($gdm_clients->get_schedule_by_status("pending")); print "</pre>";