How to create new WordPress table and store high scores from a Unity game (4 posts)

  1. sixfootjames
    Posted 4 years ago #


    I was hoping someone might be able to help me with this. I need a way to capture high scores from a Unity browser game and store those scores in the WP database please.

    Only logged in users will be able to play the game so therefore, the table would have to be linked to the user table in WP.

    If there is a way to store this kind of information, I would really appreciate some help please.

    Many thanks!

  2. vtxyzzy
    Posted 4 years ago #

    Here is an article with sample code that shows how to create tables and insert and retrieve rows using WP functions.


  3. sixfootjames
    Posted 4 years ago #

    That's a great start thanks vtxyzzy.
    Now all I need is a way to associate the creation of the hi scores table with the user table information. :)

  4. vtxyzzy
    Posted 4 years ago #

    The article below in the Codex shows how to check if the current user is logged in and how to get the user ID.


    All you need to do is include the user ID in your custom table so it can be joined with the wp_users table if necessary. I think you would want to use the user ID as the primary key.

Topic Closed

This topic has been closed to new replies.

About this Topic