This month you can send or accept {$quotas_result["Quotas"]["GuestPost"]["Count"]} guest posts without upgrading to a bigger plan.
END;
} else {
echo <<You don't have guest post credits
To send or accept guest posts you need to upgrade to a bigger plan or wait for the next month.
END;
}
}
}
$incoming_request = atcontent_api_guestposts_incoming( site_url(), $ac_api_key );
if ( $incoming_request["IsOK"] == true && count($incoming_request["List"]) > 0 ) {
?>
Incoming
| Title |
From |
Status |
| Title |
From |
Status |
type-post status-publish format-standard hentry category-uncategorized alternate iedit author-self" id="post-">
| ”" href="" class="row-title">
| "> |
|
0 ) {
?>
Outgoing
| Title |
To |
Status |
| Title |
To |
Status |
type-post status-publish format-standard hentry category-uncategorized alternate iedit author-self" id="post-">
| ”" href="" class="row-title">
| "> |
|
" . 'Could not save draft to atcontent.com. ' .
'To submit guest post you should have Pro account.
' .
'Upgrade for Pro account here' .
"";
} else {
echo "" . 'Could not save draft to atcontent.com. ' . $create_result["Reason"] . "
";
}
} else {
die( 'Post saved!
' . '' );
}
$gp_title = $_POST["title"];
$gp_content = $_POST["post_content"];
$gp_targeturi = $_POST["targeturi"];
}
} else {
$editor_title = "Edit guest post";
if ( $action == "save" ) {
if ( $_POST["targetaction"] == "save" ) $status = "Created";
if ( $_POST["targetaction"] == "submit" ) $status = "Submitted";
$post_content = $_POST["post_content"];
$update_result = atcontent_api_guestposts_update( $ac_api_key, $guestpostid, site_url(), $_POST["targeturi"], $_POST["title"], $post_content, $status );
if ( $update_result["IsOK"] != true ) {
if ($update_result["ErrorCode"] == 102) {
echo "" . 'Could not save draft to atcontent.com.
' .
'You must have a Pro account to submit guest posts.
' .
"
";
echo( 'Upgrade for Pro account here
' );
} else {
echo "" . 'Could not save draft to atcontent.com. ' . $create_result["Reason"] . "
";
}
$gp_title = $_POST["title"];
$gp_content = $_POST["post_content"];
$gp_targeturi = $_POST["targeturi"];
} else {
die( 'Post saved!
' . '' );
}
} else if ( $action == "submit" ) {
$update_result = atcontent_api_guestposts_status_update( $ac_api_key, $guestpostid, "Submitted" );
if ( $update_result["IsOK"] != true ) {
if ($update_result["ErrorCode"] == 102) {
echo "" . 'Could not update status.
' .
'You must have a Pro account to submit guest posts.
' .
"
";
die( 'Upgrade for Pro account here
' );
} else if ( $update_result["Code"] == 103 ) {
echo "" . 'Could not update status. ' .
'You must have guest post quota to submit guest posts.
' .
"
";
die( 'Chose the suitable plan.' );
} else {
echo "" . 'Could not update status. ' . $create_result["Reason"] . "
";
}
} else {
die( 'Post submitted!
' . '' );
}
} else if ( $action == "accept") {
$preview_result = atcontent_api_guestposts_preview( $ac_api_key, $guestpostid, site_url() );
if ( $preview_result["IsOK"] != true ) {
echo "" . 'Could not preview guest post. ' . $create_result["Reason"] . "
";
} else {
// Create post object
$new_post = array(
'post_title' => $preview_result["Title"],
'post_content' => '[atcontent id="' . $preview_result["Post4gId"] . '"]',
'post_status' => 'publish',
'post_author' => $userid,
'post_category' => array()
);
// Insert the post into the database
$new_post_id = wp_insert_post( $new_post );
$original_uri = get_permalink ( $new_post_id );
$update_result = atcontent_api_guestposts_accept( $ac_api_key, $guestpostid, site_url(), $original_uri );
if ( $update_result["IsOK"] != true ) {
wp_delete_post( $new_post_id, TRUE );
if ($update_result["Code"] == 102) {
echo "" . 'Could not accept guest post.
' .
'You must have a Pro account to accept guest posts.
' .
"
";
die( 'Subscribe for Pro account here
' );
} else if ( $update_result["Code"] == 103 ) {
echo "" . 'Could not accept guest post. ' .
'You must have guest post quota to accept guest posts.
' .
"
";
die( 'Chose the suitable plan.' );
} else {
echo "" . 'Could not accept guest post. ' . $create_result["Reason"] . "
";
}
} else {
die( 'Post accepted and published
' . '' );
}
}
} else if ( $action == "decline") {
$update_result = atcontent_api_guestposts_decline( $ac_api_key, $guestpostid, site_url(), $original_uri );
if ( $update_result["IsOK"] != true ) {
if ($update_result["Code"] == 102) {
echo "" . 'Could not decline guest post. ' .
'You must have a Pro account to decline guest posts.
' .
"
";
die( 'Subscribe for Pro account here' );
} else {
echo "" . 'Could not decline guest post. ' . $create_result["Reason"] . "
";
}
} else {
die( 'Post declined
' . '' );
}
} else {
$gp_result = atcontent_api_guestposts_get( $ac_api_key, $guestpostid );
if ( $gp_result["IsOK"] != true ) {
echo "" . 'Could not load draft from atcontent.com. ' . $create_result["Reason"] . "
";
} else {
$gp_content = $gp_result["Item"]["Face"] . ( strlen( $gp_result["Item"]["Body"] ) > 0 ? '' . $gp_result["Item"]["Body"] : '' );
$gp_title = $gp_result["Item"]["Title"];
$gp_targeturi = $gp_result["Item"]["TargetUri"];
}
}
}
?>
' . $editor_title . '';
echo '";
}
} //end of API Key Check
?>