Skip to content
Advertisement

Display user name and phone on WordPress Dashboard custom widget

i am trying to display a custom widget on the dashboard, where the widget shows register date, user name and billing phone.

i found an old plugin that has the php code but doesn’t show the billing phone, so i add the billing phone as the following

JavaScript

the problem is am getting only the current login user phone for all other users.


How can i let it show the correct number of each user?

Here is the full plugin code that i edit to add to my theme functions.php

JavaScript

this is a screenshot of the result am getting

https://ibb.co/wrngtZK

Advertisement

Answer

Instead of using get_current_user_id(), you should use $user->ID

So you get:

JavaScript

Related: How to show WooCommerce new user registrations in WordPress Dashboard widget

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement