No Facebook and only 30 Posts
-
I have a Blog with 1500 Posts, the Social Metrics Plugins seems to working, but I only see metrics for 30 Posts. Cron seems to be running and counting down …
As well I only see twitter and g+ stats, no facebook.
what could be the reason?
-
Hello, has the cron finished and do you see more posts now? It takes a while for the plugin to collect data on all of the posts.
Does your server support SSL connections? The Facebook API requires an SSL connection to retrieve data.
I will be releasing a patch soon (1.3.1, probably this Friday) which will display notices / error messages when the plugin has trouble connecting to the social networks. Right now all errors happen silently in the background (errors don’t even go to the error log). Once I release the patch the plugin should display more helpful error messages to see why Facebook is not updating.
Cron was finished, still no more results. I guess because lack of facebook data. I will wait then for the next release and check the logs. Might be a connection problem. thanks so far!
I’ve released version 1.3.1 which has a status indicator that will display error messages for specific social networks. Please try upgrading to this version, then check to see if there is some information displayed. After you upgrade, click “Update” next to any of your posts so that the plugin checks for new data at least once with the new plugin version.
When you are looking at the Social Metrics Dashboard, the indicator is in the upper right corner and will either say “Data is being synced in the background” or “Temporary connectivity issue detected. Click for details.” — if you click on it, it will expand to show any error messages collected from specific social networks.
Thanks!! Error Messages are:
_ Facebook – 1 failures – The connection was successful, but we did not receive the expected data from the social network
_ LinkedIn – 1 failures – The connection was successful, but we did not receive the expected data from the social network.All others are green / working.
How can I check, e.g. from server shell, if required connections are working?
When I look into the response returned from facebook api, this is the result:
array ( 'error_code' => 100, 'error_msg' => 'The parameter urls is required', 'request_args' => array ( 0 => array ( 'key' => 'method', 'value' => 'links.getStats', ), 1 => array ( 'key' => 'format', 'value' => 'json', ), 2 => array ( 'key' => 'amp;urls', 'value' => 'http://www.wordpress.org', ), ), )“‘key’ => ‘amp;urls'” seems to be the problem, the “amp;” should not be there, that’s why it can not find the required “urls” parameter – right?
Hello,
I was just about to reply with instructions on how to do exactly what you just did to investigate the request/response.
Yes, I think you’re exactly right, that looks like it would be causing the issue. I will take a look at the plugin code today and see if I can figure out why the request is being formatted incorrectly with the ‘amp;’ and see if I can release another patch to fix it. It’s strange that it works on some servers but not others; clearly the ‘amp;’ should not be there though in the request, it’s probably getting encoded twice somewhere.
Okay, could you try this version of the plugin and tell me if it fixes the issue?
http://share.bencole.net/v2/dir/temp-624/social-metrics-tracker-1.3.2-rc.zip
The plugin uses PHPs http_build_query to create the request URLs, and I read that in some versions that function uses ‘&’ instead of ‘&’ to build the queries. So I’ve manually specified that the separator should always be ‘&’ — try it out and let me know if it works and if so I’ll release the patch as 1.3.2
thanks – it’s fun working with Pros!! that fixed it – now showing facebook results too. I will now re-run a full sync and let you know. but for now it seems to be working!
facebook seems to be fine now!
—-
the wp-admin-list (/wp-admin/admin.php?page=social-metrics-tracker) is still limited to 30 posts ?! the sync checked 1480 …
SELECT * FROM wp_postmeta WHERE meta_key LIKE 'socialcount_TOTAL'=> 1,480 results ?
I have selected “show posts published anytime” – any idea?
The XSL-Export is fine too, 1480 entries.π found it …
$limit = 30; // Filter our query results add_filter( 'posts_where', array($this, 'date_range_filter') ); add_filter( 'pre_get_posts', array($this, 'handle_dashboard_sorting') ); $querydata = new WP_Query(array( 'posts_per_page'=> $limit, 'post_status' => 'publish', 'post_type' => $post_types ));should be: “$limit = -1;”
right?Be careful with -1. That could be a performance hazard. What if you have 100,000 posts? This could crash the site, no?
you’re right, but than something else is wrong with the pagination. seems to be not done the wordpress-way …
Oh, THAT’s what you meant by “only 30 posts”
Yes, I’ve been meaning to fix that. I found that with many posts, the WP_List_Table class seemed to really slow down and take forever to load if I tried to do a paginated table with more than a couple of pages. My quick fix long ago was to just limit the display to 30 posts, and I just never changed it.
So regardless of the number of posts tracked, the table will only show you the top 30 for your query. Even when you switch to “Show Posts Published Anytime” it limits to 30. But if you change the sort column, it will still show you the correct results, but only the top 30.
In a future version I’ll figure out a better way to handle that pagination…. or if you’d like to contribute on Github and send a pull request that would be awesome too! The whole “smt-dashboard.php” file is a bit messy and needs to be optimized in my opinion =P
For now, I have a quick solution for the post limit:
file “settings/smt-general.php”, add to line 97:
array( 'id' => 'default_limit', 'title' => 'Default Posts Limit', 'desc' => 'Number of posts to display in reports. ("No Limit" might be slow for blogs over 5000 posts)', 'type' => 'select', 'std' => '30', 'choices' => array( '30' => '30', '60' => '60', '100' => '100', '200' => '200', '500' => '500', '1000' => '1000', '2000' => '2000', '5000' => '5000', '-1' => 'No Limit' ) ), array( 'id' => 'default_posts_per_page', 'title' => 'Default Posts per Page', 'desc' => 'Number of posts per page to display in reports', 'type' => 'select', 'std' => '10', 'choices' => array( '10' => '10', '20' => '20', '30' => '30', '40' => '40', '50' => '50', '100' => '100' ) ),file “smt-dashboard.php”, add to line 215:
$per_page = empty( $this->smt->options[ 'smt_options_default_posts_per_page' ] ) ? 10 : $this->smt->options[ 'smt_options_default_posts_per_page' ];file “smt-dashboard.php”, add to line 228:
$limit = empty( $this->smt->options[ 'smt_options_default_limit' ] ) ? 30 : $this->smt->options[ 'smt_options_default_limit' ];You can now set the limit and posts per page in the configurations panel.
Thanks, super awesome! I added your code to the plugin for the next version (1.3.3) which should be ready soon.
And actually, while I was there I realized that my WP_Query for the reporting dashboard was not properly using pagination parameters which is why it was slow when trying to increase the limit. So if the limit was set to 100, it would fetch and crunch numbers for all 100 posts, even though only 10 needed to be displayed on the current page.
I optimized the query, so limit can now always be set to “No Limit” since it will only process the items being shown on the page.
If you’re curious, here are your changes added to the code, and here are optimizations on the WP_Query
The topic ‘No Facebook and only 30 Posts’ is closed to new replies.