Skip to:
Content
Pages
Categories
Search
Top
Bottom

User profile field to log their height or weight growth – Possible?


  • Clemmo21
    Participant

    @clemmo21

    Hi there.
    Being a bit of a noob I’m not sure if what I’m trying is easy, hard, been asked a million times, or even possible.

    I will have user profiles that have the usual name, DOB, address, email, etc.
    I would then like to have field/s that a user can enter their height or a field to enter their weight. These fields are simple enough being integers but is it possible to log this information as the user’s height grows? Say they update their height every 3 months and it shows their growth over 12 months?

    I’m just trying to find the direction I should be heading in to get started.
    Thank you for any help.

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

  • Boone Gorges
    Keymaster

    @boonebgorges

    It’s not possible to use a regular BP profile field to keep track of data changes over time. BP doesn’t keep records of old profile field values – it only stores the most recent one.

    There are a number of ways you could accomplish it. If you had the technical know-how, you could build a tool that hooks into XProfile and syncs user-entered data to another system (maybe an array in usermeta or something like that). Another option is to manually created new fields every 3 months, but then you’d need to do some customization to the way fields are displayed on the front end so that the profile doesn’t show all past entries as separate items. Either way, some customization would be required.

    Maybe someone on this forum knows of an existing tool that will help.


    Clemmo21
    Participant

    @clemmo21

    Thanks Boone for your suggestions.

    I’ve been considering the plug-in WP Datatables to access MySQL database and create a table for each user and then a new row each time the user enters a new height.

    I’ve got some homework to do on this one but I thought I would try and investigate if there was already a solution and not try and re-invent the wheel. :))

    It does sound like a simple task of logging but inevitably a complex solution. 🙁

    Thanks. Peter.


    ripulkr
    Participant

    @ripulkr

    A better alternative may be to use Activity meta tables


    Clemmo21
    Participant

    @clemmo21

    I have worked out a solution or at least a direction for me to head in. :))

    @ripulkr
    and @boonebgorges gave me the idea of using a MySQL database and the use of tables to store the user’s data and their meta data.
    I jumped on the WPdatatables plug-in which allowed me to easily use MySQL queries to the WordPress database (WPDB). I then created a table within the WPDB and created columns for the fields I wanted like height, weight, length. I also have a couple of other columns in the table to associate the record number and the user id.
    WPdatatables also has an add-on for Gravity Forms so it was simple for users to fill out a form to submit data direct to the table. I then create a page for the users showing the WPDB table for them to only see their entries. It has a reports and chart feature too. :))
    WPdatatables full use of MySQL queries allows me to join tables within the WPDB which makes it nice to be able to match up and show their user data too.
    I’m pretty happy with how it works and its potential.
    A very high level explanation but would be happy to explain further if needed. :))

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar