WordPress.org

Forums

EZ DB Backup and SQL Reports Shortcode and Widget
[resolved] how to create a report for each user based on there login or user id (11 posts)

  1. overdog1981
    Member
    Posted 2 years ago #

    I want to show access log information that is unquie to each user how can I create a query that will only show the data that is for that user one report fits all but the data is only that users data
    I dont want to create a report for each user but instead have one report and when that user is logged in and he clicks the link the info returned is based on his user id

    thank you very much for your time !!

    http://wordpress.org/extend/plugins/elisqlreports/

  2. Eli
    Member
    Plugin Author

    Posted 2 years ago #

    I have not allowed any parameters to be passed to a forward facing report for security reasons. I don't want to leave the door open for SQL Injection attempts. However, your specific need could be be achieved without added risk.

    Can yo provide some more details?
    Do you just need this done to one report?
    What is your report called?
    Do you have any other reports?

    I'm thinking this would be a custom hack just for your version but I want to understand you need and usage better.

    Aloha, Eli

  3. overdog1981
    Member
    Posted 2 years ago #

    Eli thank you very much for getting back to me !

    Pretty simple concept we run a website for locksmiths in the automotive industry
    they purchase keycodes from us .
    we log all this into a table called code_log with 8 different columns inside vin, pin, returncode , ip techid, workid, locid,make ,type and these values are distinct per user
    we need to be able to allow them to search this data by vin , etc and return this info to their member profile based on there userdid

    1. yes one report for all user does the same thing
    2. yes we will have others to make
    3. report would be called My code History

    thanks again your plugin is very cool nice to have SQL !!!
    John

  4. Eli
    Member
    Plugin Author

    Posted 2 years ago #

    I think this is something I could do. I would hesitate to put unrestricted variables into the SQL for fear of abuse but a strictly controlled user_id would be save.

    Is this something you would still like me to add? If so, would you be willing to give me WP Admin access to your site to make the necessary changes and test the report?

    You can send direct email to me here:
    wordpress at ieonly dot com

  5. FGarcia@technologycustoms.com
    Member
    Posted 2 years ago #

    Eli,

    Were you ever able to complete this? I am needing something VERY similar.

    SELECT * FROM CODES WHERE {USER_ID}

    Would show all records where User_ID (Or other WP Token) matches.

    Any help would be appreciated.

    Thanks,
    Fernando

  6. Eli
    Member
    Plugin Author

    Posted 2 years ago #

    overdog never got back to me. I think I can make this change for you today though, if I keep it simple.

    Just to make sure I've got it: You want a tag that you can use in your SQL statement that will be substituted for the $current_user->ID value of the user who is logged in viewing the report.

    I think I could have this done by tomorrow.

  7. Eli
    Member
    Plugin Author

    Posted 2 years ago #

    Ok, I just released an update that allows you to use php in the sql query. Here is an example of a query that would show the display_name for the current_user:

    SELECT display_name FROM wp_users WHERE ID = '<?php $current_user->ID ?>'

    Please let me know how if this does the trick or if you were needing something else.

    Aloha, Eli

  8. FGarcia@technologycustoms.com
    Member
    Posted 2 years ago #

    Thanks, I will try this today. Can I use any toekn or only the user id?

    Thanks!

  9. Eli
    Member
    Plugin Author

    Posted 2 years ago #

    You should be able to use any global variable or public function.

    Let me know how you are wanting to use this and I will make sure it works that way.

    Aloha, Eli

  10. FGarcia@technologycustoms.com
    Member
    Posted 2 years ago #

    Yes,

    I think this would be a good addition to the plugin, as I can see this plugin being used to create reports for end-users by defining the user ID in WP.

    I will be using this to tie in a key generator DB and WP by allowing resellers to view all keys that their account is tied to in a specific page.

    Reseller 1: Key 1, 3, 4, 5, 6, 9
    Reseller 2: Key 2, 7, 8,

    Make sense? Just thought you might like a reference as to how this is being used.

  11. Eli
    Member
    Plugin Author

    Posted 2 years ago #

    Cool,

    I'm marking this topic resolved then, but please let me know if you need more help.

    Aloha, Eli

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic