• I saw the warning about it not being updated in forever, so I was a little skeptical, but I checked out the code prior to activating the plugin, and it looked so simple that I figured it would work.

    I didn’t want to have to use a short-code to make the list appear, as I just want it to be an admin-only feature to grab email addresses, and other user information for importing into another mailing list program, so I copied the plugin, and am in the process of modifying it to how I want.

    Once I’m done, I’ll either post the code here, or make a new plugin for more general use.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Augusto

    (@gutobenn)

    Thanks for reporting. I’ve just tested it on WP 4.1 and changed ‘tested up to’ information on README.

    I wrote this piece of code 2 years ago and couldn’t imagine it would reach 400+ downloads. Feel free to contribute! ??

    Thread Starter jondaley

    (@jondaley)

    thanks for reminding me. Here is the code I’m using. I don’t remember how much I modified your code – maybe just added in the paging stuff?

    <?php
    define("JONDALEY_EMAIL_MAX_USERS",10000);
    
    function jondaley_get_users_info($role, $pageNum=0){
      $ret = array();
    
      if(!$role)
        return $ret;
    
      $columns = array("Registered Date" => "user_registered",
                       "Email address" => "user_email",
                       "Login ID" => "user_login",
                       "Display Name" => "display_name",
                       "URL" => "user_url");
    
      $group_users = get_users(array('role' => $role,
                                     'offset' => $pageNum*JONDALEY_EMAIL_MAX_USERS,
                                     'number'=> JONDALEY_EMAIL_MAX_USERS));
    
      $ret['columns'] = $columns;
    
      foreach($group_users as $user){
        foreach($columns as $column){
          $user_info[$column] = $user->$column;
        }
        $ret['users'][] = $user_info;
      }
    
      return $ret;
    }
    
    function jondaley_list_emails(){
    
      $roles = get_editable_roles();
    
      print "Find: ";
      foreach($roles as $roleId => $role){
        print "<a href='".add_query_arg(array('role' => $roleId, 'pageNum' => 0))."'>".$role['name']."s</a>&nbsp;&nbsp;";
      }
      print "<br/>";
    
      $role = isset($_GET['role']) ? $_GET['role'] : '';
      $pageNum = isset($_GET['pageNum']) ? preg_replace("[^0-9]", "", $_GET['pageNum']) : '';
    
      if(!$role || !array_key_exists($role, $roles))
        return;
    
      print "Searching for ${role}s...<br/>";
    
      $infos = jondaley_get_users_info($role, $pageNum);
    
      print "<pre>";
      foreach($infos['columns'] as $column_header => $unused){
        print $column_header . "\t";
      }
      print "<br/>";
    
      foreach ($infos['users'] as $user) {
        foreach($infos['columns'] as $column){
          print $user[$column] . "\t";
        }
        print "<br/>";
      };
    
      print "</pre>";
    
      if(count($infos['users']) == JONDALEY_EMAIL_MAX_USERS)
        print "<a href='".add_query_arg('pageNum',$pageNum+1)."'>Next Page</a><br />\n";
    }
    Plugin Author Augusto

    (@gutobenn)

    Thanks for sharing!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Works great.’ is closed to new replies.