• Hi,

    Is there a way to access a logged in users prediction count on the front end?

    The use case is I want to show some messages to users. For people who have predictions, we’ll show their current rank and points. But for those who haven’t made any predictions, I want to show a message encouraging them to get involved in the game.

    I have tried re-purposing the fp-user-ranking shortcode code in a new custom shortcode but I get a undefined index error when trying to access ‘num_predictions’ from the ranking table.

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author AntoineH

    (@antoineh)

    The score breakdown extension adds the prediction count to the ranking.

    If you want to show the prediction count somewhere else, e.g. via a shortcode, then I would advise to take the [fp-user-score] as start point and instead of getting the user score from the Football_Pool_Pool class, you can use the method get_prediction_count_per_user from the same class to get the prediction count for the user (please note that this method always returns an array also if you only get the count for one user).

    • This reply was modified 3 years, 6 months ago by AntoineH. Reason: forgot the link
    Thread Starter haydnjames

    (@haydnjames)

    Thank you so much! Just that little pointer made solving this problem so much easier!! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get a users prediction count on front end?’ is closed to new replies.