wdevraz
Forum Replies Created
-
Forum: Plugins
In reply to: [WP OAuth Server (OAuth Authentication)] How to get the user info?Hi,
I’m having trouble finding a way to retrieve the data from the link you posted.
It works fine when I pass the access_token through to the URL as you said, and it displays all the current user info in an array.
But is there a way to retrieve this array/data into the .php I posted above?
Forum: Plugins
In reply to: [WP OAuth Server (OAuth Authentication)] How to get the user info?Thanks for the info! Much appreciated
Forum: Plugins
In reply to: [WP OAuth Server (OAuth Authentication)] How to get the user info?Array ( [result] => Array ( [access_token] => uy8zq1n67kb1bm9ycl5foflbi1vz2einq6cmbjqx [expires_in] => 86400 [token_type] => Bearer [scope] => basic [refresh_token] => ld5yl7gmpf1bla2wn1rxnd7xkwpjqtdsnbvidupc ) [code] => 200 [content_type] => application/json )Is there any way to retrieve username from this response?
I’m currently working on a small fix for counting the shares on your plugin, which will search for HTTP as well as HTTPS, as the website I linked used to be using HTTP, so now some of the shares aren’t showing as it is only searching for HTTPS through the API’s. If possible I could send you the code and you could implement it in a new version of the plugin? Might help some people π
Okay that was really easy, and I’m not great with JavaScript either!
Here’s my code, with a brief explanation in comments for anyone who wants to use this.
(function($) { $("#crestashareicon").prependTo(".share-article-vertical"); //here is where we move the floating bar, change '.share-article-vertical' with where you want to move it. fshares = $("#facebook-count").text(); //get facebook shares gshares = $("#googleplus-count").text(); //get gplus shares pshares = $("#pinterest-count").text(); //get twitter shares totalshares = fshares + gshares + pshares; //add all shares $( "#total-count" ).replaceWith( totalshares ); //replace the spinning loading icon with the total shares })(jQuery); Don't forget to turn off <code>fixed</code> positioning for the <code>#crestashareicon</code> element in CSS!Done! Thanks for the great plugin.
Classic mode style it is still broken.
Ok I have thought of a solution.
I can use JavaScript to get the values inside of
#facebook-count,#twitter-countelements, which contain the amount of shares for each social network.Then I will use JavaScript to add these together and replace the animated loading icon with the total number.
I’ll let you know how I get on and post my full solution in-case others would like to use it. This is of course only a hack/work-around for now π
Hi,
I just reinstalled your plugin to revert all the changes I made in the code. Now instead I am simply using some jQuery to re-position the floating bar and place it inside of the container next to the article, code is below.
$("#crestashareicon").appendTo(".share-article-vertical");However the total shares are still broken
So even without modifying the PHP or JS in your plugin but just by simply moving it, it breaks the total shares.
Not sure what to do…
Hi,
Thanks for the speedy response. The website is over at https://sciscomedia.co.uk/proxima-b-habitable-planet/ (that is one of the articles)
You can see the social bar on the side, I have done
display:noneon #total-shares in CSS so if you inspect element you can remove that and see the problem with spinning loading icon πThanks
Okay so I found out how to place it there. Everything is working APART from the total amount of shares.
I found
add_action('wp_footer', 'add_social_button');insidecresta-social-share-counter.php(around line 464) – this creates the floating social bar.I replaced
wp_footerwith the name of the function that displays the theme’s own social bar, so it looked like:add_action('thb_social_article_detail_vertical', 'add_social_button');Inside my themes files, I went to that function (
thb_social_article_detail_vertical) and removed all theecho‘s where it was trying to display its own share bar. Nowcresta-social-share-counter.phpis basically going to inject the plugin’s share bar into there.Voila, it works! But now the total number of shares won’t work, it just shows a loading icon for infinite time. Obviously something to do with the way it’s called through
wp_footer, but why? πAny help appreciated!