Skip to content

Instantly share code, notes, and snippets.

@jondavidjohn
Created November 21, 2012 20:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jondavidjohn/4127490 to your computer and use it in GitHub Desktop.
Save jondavidjohn/4127490 to your computer and use it in GitHub Desktop.
Social Debugger WordPress Plugin
<?php
/*
Plugin Name: Social Debugger
Description: Plugin to print debugging information by appending ?social_debug=true to the url within the admin
Version: 0.1
Author: Crowd Favorite
Author URI: http://crowdfavorite.com/
*/
/** README
*
* Once activated, simply go to any page in the admin and append the query string argument social_debug=true
*
* Example:
*
* http://yourdomain.com/wp-admin/index.php?social_debug=true
*/
function social_print_debug() {
if ($_GET['social_debug'] == 'true') {
$current_time = current_time('mysql', 1);
$mysql_version = mysql_get_server_info();
$php_version = phpversion();
$wp_version = get_bloginfo('version');
$social_version = Social::$version;
$social_locked = get_option('social_locked', "Doesn't Exist");
$social_unlocked = get_option('social_unlocked', "Doesn't Exist");
$social_last_lock_time = get_option('social_last_lock_time', "Doesn't Exist");
$social_semaphore = get_option('social_semaphore', "Doesn't Exist");
$server = print_r($_SERVER, true);
$message = <<<OUT
<pre>
# Social Debug
Current Time: $current_time
## Software Versions
MySQL: $mysql_version
WordPress: $wp_version
PHP: $php_version
Social: $social_version
WebServer: {$_SERVER['SERVER_SOFTWARE']}
## Social options
social_locked: $social_locked
social_unlocked: $social_unlocked
social_last_lock_time: $social_last_lock_time
social_semaphore: $social_semaphore
</pre>
OUT;
die($message);
}
}
if (is_admin()) {
add_action( 'wp_loaded', 'social_print_debug', 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment