• Hi all,

    We have a basic wp web page and we would like to include a user area where each user will be able to see their monthly consumption. Currently we have a cvs file with each month consumption information and the user. We plan to import it to the wp database (somehow)

    Do you know the best way to display each user unique information of the month and ideally historical? How do you suggest to tackle the problem?

    Thank you! all ideas are welcome

Viewing 4 replies - 1 through 4 (of 4 total)
  • $blogusers = get_users( 'blog_id=1&orderby=nicename&role=subscriber' );
    // Array of WP_User objects.
    foreach ( $blogusers as $user ) {
    	echo '<span>' . esc_html( $user->user_email ) . '</span>';
    }

    It returns all default user meta.

    For get default and custom user meta refer below link
    user_meta

    It depends upon what you’ve got in your cvs file. What type of data this cvs file contains to show some historical background of user??

    Thread Starter jbilbao

    (@jbilbao)

    Hi all thank you for the answers!:

    @Anandaraj:

    thank you this I know the think is I would like to retrieve some sort of a DB rather than just the name of the User. i was wonder if there is a best way to do it, some sort of framework developed or if I have to develop everything from scratch: front and back end (to upload the cvs).

    @irfanahmad7272: the CVS will contain only the consumption of the current month, so we will need to keep in a DB the previous months. Each cvs contains a list of users ID with a consumption value and a date.

    Moderator bcworkz

    (@bcworkz)

    This sounds like a reason to create a dedicated table (or maybe tables) to contain the imported data. Design the table so that it is easy to query for any user’s data for any timespan and output the data in a meaningful manner. This means dates should be stored as timestamps, not date strings. Avoid redundant data. For instance, don’t store both the user ID and name, given an ID, the name can be taken from the users table, no need for it to be in your custom table.

    You will need data to tie things to existing WP data, like the user ID to tie things to the users table. Don’t be influenced by the format of the CVS file, whatever it is can be translated into the optimal form by PHP as the data is imported and stored.

    Design a PHP page that makes it as easy as possible to fetch the CVS data and import it into the table(s). Ideally, it would just be a GO button and the script takes care of getting the data, parsing it, transforming it, and saving it. Something so automated may not be possible. Maybe there needs to be a file dialog. The more the script can do the better.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘User area data display’ is closed to new replies.