function gdm_dashboard_widget()
 {
     require_once GDM_CLIENTS_CLASS;
     $clients = new gdm_clients();
     echo "<b>GDM has " . sizeof(get_option('gdm_blogger_clients')) . " clients!</b>";
     echo "<p>" . sizeof($clients->get_clients_with_posts()) . " has posts ready to publish and<br>";
     echo sizeof($clients->get_clients_without_posts()) . " have no posts assigned to them.</p>";
 }
 function profile_update($userid)
 {
     require_once GDM_CLIENTS_CLASS;
     $gdm_clients = new gdm_clients();
     if (isset($_POST['gdm_client_categories'])) {
         $gdm_clients->initialize_client($userid);
         $gdm_clients->update_client($userid, array("categories" => $gdm_clients->get_entered_categories($_POST['gdm_client_categories']), "url" => $_POST['gdm_client_website']));
     } else {
         $gdm_clients->remove_client($userid);
     }
 }
 function gdm_blogger_url_checker()
 {
     $clients = new gdm_clients();
     foreach ($clients->list as $clientid => $client) {
         if (!empty($client['url'])) {
             $remote = wp_remote_get($client['url'] . '/wp-json/');
             if (is_wp_error($remote)) {
                 $error_message = $remote->get_error_message();
                 $clients->set_error($clientid, "http_response", $error_message);
             } elseif ($remote['response']['code'] >= 300) {
                 $clients->set_error($clientid, "http_response", $remote['response']['message']);
             } else {
                 $response_body = json_decode($remote['body'], true);
                 if (!in_array("e_ct/v1", $response_body['namespaces']) || !in_array("wp/v2", $response_body['namespaces'])) {
                     $clients->set_error($clientid, "remote_namespace", $response_body['namespaces']);
                 }
             }
         } else {
             $clients->set_error($clientid, "url_missing", "As of " . time() . " the clients URL was missing from their profile");
         }
     }
     return;
 }
    function gdm_blogger_scheduling_metabox($post)
    {
        require_once GDM_CLIENTS_CLASS;
        $clients = new gdm_clients();
        $requested_client = get_post_meta($post->ID, gdm_blogger_requested_client, true);
        if (is_numeric($requested_client)) {
            $category_list = $clients->get_client_categories($requested_client);
            ?>
				<table>
					<tr>
						<td style="width: 60%">
							<p>The author of this post has requested the category group:<br>
							<i><?php 
            echo implode(", ", $category_list);
            ?>
</i><br>
							Is this post is ready for publishing? Please leave a note for the author.
							<select name="gdm_blogger_approved">
								<option value=""></option>
								<option value="yes">Yes</option>
								<option value="no">No</option>
							</select></p>
						</td>
						<td style="width: 40%">
							<textarea rows="3" cols="40" name="gdm_blogger_notes">Notes:</textarea>
						</td>
					</tr>
				</table>
				<?php 
        } else {
            echo "<p>The author of this post has not requested this post be assigned to any client yet.</p>";
        }
    }
Example #5
0
<h2>Clients</h2>
<p>Cool client stuff will go here</p>

<?php 
require_once GDM_CLIENTS_CLASS;
$gdm_clients = new gdm_clients();
$clients = $gdm_clients->list;
if (isset($_POST['gdm_client_submit'])) {
    $gdm_clients->update_schedule(1, 18, "pending", "assigned");
    $gdm_clients->update_schedule(1, 15, "pending", "assigned");
    /*if (!empty($_POST['gdm_new_client'])) { // adds new client
    			$gdm_clients->add_client(
    				$_POST['gdm_new_client'],
    				$_POST['gdm_client_freq'],
    				$_POST['gdm_client_url'],
    				$_POST['gdm_client_categories']
    			);
    		}elseif (is_numeric($_POST['gdm_existing_client'])) { // edits exiting client
    			$gdm_client_id = $_POST['gdm_existing_client'];
    			$gdm_clients->update_client($gdm_client_id,array(
    				"name" => $_POST['gdm_client_name'],
    				"freq" => $_POST['gdm_client_freq'],
    				"url" => $_POST['gdm_client_url'],
    				"categories" => $_POST['gdm_client_categories']
    			));
    		}*/
}
?>


<h3>Edit Clients</h3>
Example #6
0
<?php

require_once GDM_CLIENTS_CLASS;
$clients = new gdm_clients();
print "<pre>";
print_r($_POST);
print "</pre>";
$without = $clients->get_clients_without_posts();
$with = $clients->get_clients_with_posts();
?>

<h2>Post Publishing Schedule</h2>
<p>Post Posting Schedule<br>For now, this system does not work. You can, however, publish posts manually</p>

<form action="" method="post">
<?php 
if (!empty($without)) {
    ?>
		<hr>
		<p><b>Note:</b><br>The following clients do NOT have any posts assigned to them</p>
		<table style="width: 60%">
		  <tr>
		  	<th>ID:</th>
		    <th>Client:</th>
		    <th>URL:</th>
		    <th>Categories:</th>
		  </tr>
		  <?php 
    foreach ($without as $id => $clientdata) {
        $row = "<tr>";
        $row .= "<td>" . $id . "</td>";
Example #7
0
<h2>Blogging Options</h2>

<table class="form-table">
	<?php 
require_once GDM_CLIENTS_CLASS;
$gdm_clients = new gdm_clients();
if (current_user_can('edit_gdm_profile') || current_user_can('promote_users')) {
    // if is admin or gdm client
    $categories = implode(", ", $gdm_clients->get_client_categories($user->ID));
    ?>
		<tr>
			<th><label for="gdm_client_categories">Interested Categories</label></th>
			<td>
			<input type="text" name="gdm_client_categories" value="<?php 
    echo $categories;
    ?>
"><br>
			<small>Comma-Seperated list of categories you would like us to blog about</small>
		</td>
		<tr>
			<th><label for="gdm_client_categories">Website To Blog To</label></th>
			<td>
			<input type="text" name="gdm_client_website" value="<?php 
    echo $gdm_clients->list[$user->ID]['url'];
    ?>
"><br>
			<small>The website your posts will be sent to</small>
		</td>
		<?php 
}
?>