• Resolved tspencer1966

    (@tspencer1966)


    I’m trying to find a way of exporting or using a DB query to get all the players that have had yellow cards awarded in matches.

    What I ultimately want is, player name and date of game. I have 6 years worth of data on our website and can’t find an easy way of doing this.

    I’m trying to backfill our club history database with all yellow cards awarded to players.

    Thanks for any help

    Tony

Viewing 1 replies (of 1 total)
  • Plugin Contributor Savvas

    (@savvasha)

    Hi @tspencer1966 ,

    SportsPress stores player performance data (including yellow cards) as post meta in the WordPress database, which makes it possible to extract this information using a custom database query. The yellow cards are typically stored as performance statistics linked to events (matches) and players, so you’ll need to join the posts table with the postmeta table to get player names and match dates where yellow cards were recorded.

    You should use a 3nd party plugin like JSM Show Post Metadata to identify on an event how the stats are stored and related to your players. You will also need to identify the key/slug of yellow cards stats which can be easily found at SportsPress->Configure.

    After you have all needed information, I will propose to use WP_Query class instead of direct DB query to fetch your data. First you will get all events, then you should loop through all events and for each event you should loop through player performances to extract yellow cards per player. These data should be saved in an array, which then can be easily exported to a csv for future using.

    Thanks,
    Savvas

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.