Commit c3cc1926 authored by Martin Lees's avatar Martin Lees
Browse files

work in progress here and there

parent c204bba9
......@@ -194,7 +194,6 @@ class Steempress_sp {
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
$this->loader->add_filter('the_content',$plugin_public, 'steempress_sp_comments');
}
/**
......
......@@ -100,6 +100,25 @@ class Steempress_sp_Public {
}
private function steempress_sp_steem_comments($id, $username, $permlink)
{
$data = array(
"jsonrpc" => "2.0",
"method" => "get_content_replies",
"params" => [$username,$permlink]
);
$result = wp_remote_post("https://api.steemit.com", array(
'headers' => array('Content-Type' => 'application/json; charset=utf-8'),
'body' => json_encode($data),
'method' => 'POST'
));
return $result['body'];
}
public function steempress_sp_comments($content)
{
......@@ -108,23 +127,30 @@ class Steempress_sp_Public {
$username = get_post_meta($id, "steempress_sp_username");
$permlink = get_post_meta($id, "steempress_sp_permlink");
$payout = "";
$data = "";
$comments = "";
if (sizeof($username) == 1 and sizeof($permlink) == 1)
{
$data = "<div id=\"steempress_sp_username\" style=\"display: none;\">".$username[0]."</div>";
$data .= "<div id=\"steempress_sp_permlink\" style=\"display: none;\">".$permlink[0]."</div>";
$username = $username[0];
$permlink = $permlink[0];
$data = "<div id=\"steempress_sp_username\" style=\"display: none;\">".$username."</div>";
$data .= "<div id=\"steempress_sp_permlink\" style=\"display: none;\">".$permlink."</div>";
$payout = "<div id='steempress_sp_price'>0.000$</div>";
// comment zone
$comments = "<div id='steempress_sp_price'>0.000$</div>";
echo ($this->steempress_sp_steem_comments($id, $username, $permlink));
}
return $content.$data.$payout;
}
}
......@@ -33,8 +33,8 @@
$(window).load(function () {
const username = "howo"//$("#steempress_sp_username")[0].innerText;
const permlink = "my-steemniversary-one-year-going-from-oh-this-looks-cool-to-well-this-is-now-my-job"//$("#steempress_sp_permlink")[0].innerText;
const username = $("#steempress_sp_username")[0].innerText;
const permlink = $("#steempress_sp_permlink")[0].innerText;
console.log(permlink);
steem.api.getContent(username, permlink, function(err, response){
......
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