Title: Admin users panel ETH addreses column code help
Last modified: January 30, 2021

---

# Admin users panel ETH addreses column code help

 *  Resolved [JSSdev](https://wordpress.org/support/users/jonatest/)
 * (@jonatest)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/admin-users-panel-eth-addreses-column-code-help/)
 * Hi, I need help with the following, you might be also interested into adding 
   this functionality too.
 * [SCREENSHOT EXPLANATION](https://prnt.sc/xubq46)
 * I give you the following code, it shows each ETH address from your WP plugin 
   own database table from each user by your plugin.
 * I would like them to be shown into the users admin panel, so I can see the address
   owners in the admin panel, I know I’m just a step of getting it but I got stuck.
 * **¿Could you please give me some input?**
    Here’s my code working on a new .php
   file in the root of a WordPress installation: w w w.YOURWEBSITE.com/testfile.
   php (it will show “echo” the addresses from database)
 *     ```
       <?php
   
       require_once('wp-load.php');
   
       $get = $wpdb->get_results("
       			SELECT 
       					ethpress_addresses.name 
       			FROM 
       				".$wpdb->prefix."ethpress_addresses as ethpress_addresses
   
       				");
   
       foreach ( $get as $print )   { ?>
   
                         <pre>  <?php echo $print->name; ?> </pre>
   
                   <?php }
   
       ?>
       ```
   
 * **Here is the code for making the new column:**
 *     ```
       add_action('manage_users_columns','eth_modify_user_columns');
       function eth_modify_user_columns($column_headers) {
         $column_headers['eth_address'] = 'ETHaddress';
         return $column_headers;
       }
       ```
   
 * I need the code to get each addres belonging from each user ID (I guess is “id”)
   and input them on each user. 🙁
 * Can’t get to make it happen, help would be much appreciated, you can also get
   this code to your plugin to add such functionality of course.
    -  This topic was modified 5 years, 4 months ago by [JSSdev](https://wordpress.org/support/users/jonatest/).
    -  This topic was modified 5 years, 4 months ago by [JSSdev](https://wordpress.org/support/users/jonatest/).
    -  This topic was modified 5 years, 4 months ago by [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/).

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [lynn999](https://wordpress.org/support/users/lynn999/)
 * (@lynn999)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/admin-users-panel-eth-addreses-column-code-help/#post-13980944)
 * Hi,
 * You might want to make a query for each user in the row instead.
 * For reference: [https://developer.wordpress.org/reference/hooks/manage_users_custom_column/](https://developer.wordpress.org/reference/hooks/manage_users_custom_column/)
 * Then you might do
 *     ```
       add_filter('manage_users_custom_column', function($value, $column, $user_id) {
         if ($column === "eth_address") {
           $address = \losnappas\Ethpress\Address::find_by_user($user_id);
           if (!is_wp_error($address) {
             $value = $address->get_coinbase();
           }
         }
         return $value
       }
       ```
   
 * For reference: [https://gitlab.com/losnappas/ethpress/-/blob/master/app/Address.php#L259](https://gitlab.com/losnappas/ethpress/-/blob/master/app/Address.php#L259)
 * That might work. Didn’t actually test that code, I’m a bit occupied with other
   stuff. Let me know if that one works!
 * That code also gets just one address, but you can copy and paste the code from
   the GitLab link, and modify it to return em all!
 * Let me know how it works!
    -  This reply was modified 5 years, 4 months ago by [lynn999](https://wordpress.org/support/users/lynn999/).
 *  Thread Starter [JSSdev](https://wordpress.org/support/users/jonatest/)
 * (@jonatest)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/admin-users-panel-eth-addreses-column-code-help/#post-13983206)
 * Hi Lynn999, thanks for your quick response, well, I’ll take a closer look at 
   it of course, I tried to paste this code into the functions.php, for now it only
   creates the column, your code just crashes, but its my fault for sure since I
   don’t have much more knowledge in PHP.
 * This is what I pasted in functions.php, without succeed.
 *     ```
       add_action('manage_users_columns','eth_modify_user_columns');
       function eth_modify_user_columns($column_headers) {
         $column_headers['eth_address'] = 'ETHaddress';
         return $column_headers;
       }
   
       add_filter('manage_users_custom_column', function($value, $column, $user_id) {
         if ($column === "eth_address") {
           $address = \losnappas\Ethpress\Address::find_by_user($user_id);
           if (!is_wp_error($address)) {
             $value = $address->get_coinbase();
           }
         }
         return $value;
       })
       ```
   
 * Also debuged code syntax etc.. and tried to put a different ..\losnappas\Ethpress\
   Address.. path so I can see why it fails but I don’t have any skills into debuging
   php code from WordPress yet, CSS, JS, jQuery, Html debugging is so much easy 
   for me but PHP I just see it crashes but don’t know why hehe.
 * Thanks for your time and I hope you can still develop this plugin since it’s 
   going to be a huge year for NFT tokens membership sites and will get much more
   attention.
 *  Plugin Author [lynn999](https://wordpress.org/support/users/lynn999/)
 * (@lynn999)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/admin-users-panel-eth-addreses-column-code-help/#post-13983505)
 *     ```
       add_action('manage_users_columns','eth_modify_user_columns');
       function eth_modify_user_columns($column_headers) {
         $column_headers['eth_address'] = 'ETHaddress';
         return $column_headers;
       }
   
       add_filter('manage_users_custom_column', function($value, $column, $user_id) {
         if ($column === "eth_address") {
           $address = \losnappas\Ethpress\Address::find_by_user($user_id);
           if (!is_wp_error($address)) {
             $value = $address->get_coinbase();
           }
         }
         return $value;
       }, 10, 3)
       ```
   
 * Added the “, 10, 3” there at the end.
 * [https://codex.wordpress.org/WP_DEBUG](https://codex.wordpress.org/WP_DEBUG) 
   read that
 * You can also try `wp_die("test")` to see where it’s crashing and so on.
 * Yeah, it’s a nice plugin, too bad I’m so busy, though… It’ll be a slower time
   for now at least from my part, looking for contributors.
 *  Thread Starter [JSSdev](https://wordpress.org/support/users/jonatest/)
 * (@jonatest)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/admin-users-panel-eth-addreses-column-code-help/#post-13983681)
 * It worked like a charm!! I also tried the debug and I’m getting used to, not 
   the chrome console but its enough.
 * Now I’ll try to make that data be stored into the usermeta custom table (I thought
   that it was going to be added, but it’s all like visible but not stored) I will
   then be able to export a CSV including that ETH addresses.
 * [Screenshot](https://prnt.sc/xxy59l)
 * I hope I can help more in the future, for now, I would like to give you my po
   translations es_ES, if I manage to do more things I’ll be here around for sure.
 * [es_ES po-mo Wetransfer](https://we.tl/t-to7SD3u3Ay)
    -  This reply was modified 5 years, 4 months ago by [JSSdev](https://wordpress.org/support/users/jonatest/).
 *  Plugin Author [lynn999](https://wordpress.org/support/users/lynn999/)
 * (@lynn999)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/admin-users-panel-eth-addreses-column-code-help/#post-13989041)
 * Nice!
 * I can give advice once you have some working code again, so don’t be afraid to
   ask.
 * This time it sounds like you’ll want to loop over the addresses from the table
   like you did initially, and then update to wp user meta [https://developer.wordpress.org/reference/functions/update_user_meta/](https://developer.wordpress.org/reference/functions/update_user_meta/)
 * For new users/addresses, you can try hooking to the “ethpress_login” hook (search
   for it in the gitlab repo).
 * Make sure you use a meta key that’s not in use already…
 * Big thanks for the translations, I’ll add then once I get a chance to update!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Admin users panel ETH addreses column code help’ is closed to new replies.

 * ![](https://ps.w.org/ethpress/assets/icon-256x256.png?rev=2371493)
 * [EthPress - Web3 Login](https://wordpress.org/plugins/ethpress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ethpress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ethpress/)
 * [Active Topics](https://wordpress.org/support/plugin/ethpress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ethpress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ethpress/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [lynn999](https://wordpress.org/support/users/lynn999/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/admin-users-panel-eth-addreses-column-code-help/#post-13989041)
 * Status: resolved