Commit 42de3279 authored by Martin Lees's avatar Martin Lees
Browse files

Disable the update feature and adds re-adds the username in the two way integration options

parent 77d8aee2
......@@ -237,8 +237,6 @@ class Steempress_sp_Admin {
if (sizeof($wp_tags) != 0) {
$tags = array();
foreach ($wp_tags as $tag) {
......@@ -401,9 +399,9 @@ class Steempress_sp_Admin {
$this->Steempress_sp_publish($post->ID);
}
// Edited post
} else if ($new_status == 'publish' && $old_status == 'publish' && $post->post_type == 'post') {
} /*else if ($new_status == 'publish' && $old_status == 'publish' && $post->post_type == 'post') {
$this->steempress_sp_update($post->ID);
}
}*/
return;
}
......@@ -477,16 +475,20 @@ class Steempress_sp_Admin {
}
$permlink = get_post_meta($post->ID, 'steempress_sp_permlink', true);
$meta_author = get_post_meta($post->ID, 'steempress_sp_author', true);
if ($meta_author != $author && $meta_author != "")
$author = $meta_author;
$body = "
<p>These options are only for advanced users regarding steem integration</p>
<label for=\"steempress_sp_username\">Author : </label><br>
<p name='steempress_sp_username'>".$author."</p>
<input type='text' name='steempress_sp_username' value='".$author."'/><br>
<label for=\"steempress_sp_author\">Permlink</label>
<input type='text' name='steempress_sp_permlink' value='".$permlink."'/><br>
";
// Minified js to handle the "test parameters" function
$body .= "<script>function steempress_sp_createCORSRequest(){var e=\"".$this->twoway_api_url."/test_param\",t=new XMLHttpRequest;return\"withCredentials\"in t?t.open(\"POST\",e,!0):\"undefined\"!=typeof XDomainRequest?(t=new XDomainRequest).open(\"POST\",e):t=null,t}function steempress_sp_test_params(){document.getElementById(\"steempress_sp_status\").innerHTML=\"loading...\";var e=steempress_sp_createCORSRequest(),s=document.getElementsByName(\"steempress_sp_username\")[0].innerText,n=document.getElementsByName(\"steempress_sp_permlink\")[0].value,r=\"username=\"+s+\"&permlink=\"+n;e.setRequestHeader(\"Content-type\",\"application/x-www-form-urlencoded\"),e&&(e.username=s,e.permlink=n,e.onload=function(){var t=e.responseText;document.getElementById(\"steempress_sp_status\").innerHTML=\"ok\"===t?\"The parameters are correct. this article is linked to this <a href='https://steemit.com/@\"+this.username+\"/\"+this.permlink+\"'>steem post</a>\":\"Error : the permlink is incorrect.\"},e.send(r))}</script>";
$body .= "<script>function steempress_sp_createCORSRequest(){var e=\"".$this->twoway_api_url."/test_param\",t=new XMLHttpRequest;return\"withCredentials\"in t?t.open(\"POST\",e,!0):\"undefined\"!=typeof XDomainRequest?(t=new XDomainRequest).open(\"POST\",e):t=null,t}function steempress_sp_test_params(){document.getElementById(\"steempress_sp_status\").innerHTML=\"loading...\";var e=steempress_sp_createCORSRequest(),s=document.getElementsByName(\"steempress_sp_username\")[0].value,n=document.getElementsByName(\"steempress_sp_permlink\")[0].value,r=\"username=\"+s+\"&permlink=\"+n;e.setRequestHeader(\"Content-type\",\"application/x-www-form-urlencoded\"),e&&(e.username=s,e.permlink=n,e.onload=function(){var t=e.responseText;document.getElementById(\"steempress_sp_status\").innerHTML=\"ok\"===t?\"The parameters are correct. this article is linked to this <a href='https://steemit.com/@\"+this.username+\"/\"+this.permlink+\"'>steem post</a>\":\"Error : the permlink or username is incorrect.\"},e.send(r))}</script>";
$body .= "<button type=\"button\" onclick='steempress_sp_test_params()'>Test parameters</button><br/><p id='steempress_sp_status'></p>";
......
......@@ -167,12 +167,12 @@ class Steempress_sp {
$this->loader->add_action( 'transition_post_status', $plugin_admin, 'Steempress_sp_post', 15, 3 );
$this->loader->add_filter( 'bulk_actions-edit-post', $plugin_admin,'steempress_sp_bulk_update_action' );
//$this->loader->add_filter( 'bulk_actions-edit-post', $plugin_admin,'steempress_sp_bulk_update_action' );
$this->loader->add_filter( 'bulk_actions-edit-post', $plugin_admin,'steempress_sp_bulk_publish_action' );
$this->loader->add_filter( 'handle_bulk_actions-edit-post', $plugin_admin,'steempress_sp_bulk_publish_handler', 10, 3 );
$this->loader->add_filter( 'handle_bulk_actions-edit-post', $plugin_admin,'steempress_sp_bulk_update_handler', 10, 3 );
//$this->loader->add_filter( 'handle_bulk_actions-edit-post', $plugin_admin,'steempress_sp_bulk_update_handler', 10, 3 );
$this->loader->add_action( 'admin_notices', $plugin_admin,'steempress_sp_bulk_publish_notice' );
$this->loader->add_action( 'admin_notices', $plugin_admin,'steempress_sp_bulk_update_notice' );
//$this->loader->add_action( 'admin_notices', $plugin_admin,'steempress_sp_bulk_update_notice' );
$this->loader->add_action( 'post_submitbox_misc_actions', $plugin_admin,'createSteemPublishField' );
......
......@@ -111,13 +111,10 @@ class Steempress_sp_Public {
if ($options['twoway'] == "on") {
$id = get_the_ID();
/*if ($id != 88)
return $content;*/
$post = get_post($id);
$permlink = get_post_meta($id, "steempress_sp_permlink");
$permlink = get_post_meta($id, "steempress_sp_permlink", true);
$author_id = $post->post_author;
......@@ -127,13 +124,18 @@ class Steempress_sp_Public {
$author = $options["username"];
if (isset($options['username' . $author_id]) && $options['username' . $author_id] != "") {
$author = $options['username' . $author_id];
}
$meta_author = get_post_meta($post->ID, 'steempress_sp_author', true);
if ($meta_author != $author && $meta_author != "")
$author = $meta_author;
if (sizeof($permlink) == 1 && $author != "") {
$permlink = $permlink[0];
// If it's the front page, we display a smaller iframe.
$steempress = "<div id='steempress_sp_comment_feed'>";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment