Skip to content

Instantly share code, notes, and snippets.

@benhuson
Created April 4, 2013 21:47
Show Gist options
  • Save benhuson/5314680 to your computer and use it in GitHub Desktop.
Save benhuson/5314680 to your computer and use it in GitHub Desktop.
Patch for the Users 2 CSV WordPress plugin. Change the first column heading to UID rather than duplicate URL title. Fixes some PHP warnings for variables.
Index: users2csv.php
===================================================================
--- users2csv.php (revision 277117)
+++ users2csv.php (working copy)
@@ -26,7 +26,7 @@
if ( is_admin() ) {
- if ($_GET['page'] == "users2csv.php") {
+ if ( isset( $_GET['page'] ) && $_GET['page'] == 'users2csv.php' ) {
function _valToCsvHelper($val, $separator, $trimFunction) {
if ($trimFunction) $val = $trimFunction($val);
//If there is a separator (;) or a quote (") or a linebreak in the string, we need to quote it.
@@ -146,7 +146,7 @@
break;
case 'users':
default:
- $fields = array('URL','E-Mail','URL','Display Name','Registration Date','First Name','Last Name','Nickname');
+ $fields = array('UID','E-Mail','URL','Display Name','Registration Date','First Name','Last Name','Nickname');
break;
}
$csv = arrayToCsvString($fields, $sep);
@@ -209,7 +209,7 @@
add_action('admin_menu','yoast_getcsv');
}
- if ( ! class_exists( 'Users2CSV' ) && !$_GET['csv'] == "true" ) {
+ if ( ! class_exists( 'Users2CSV' ) && ( ! isset( $_GET['csv'] ) || ! $_GET['csv'] == 'true' ) ) {
class Users2CSV {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment