Patreon Wordpress Plugin: Echo out variable for patron's username or email when logged in?

Hello!

  • I am creating a trivia quiz for my patrons
  • I have already created the “trivia” part how to answer questions, and how score is kept in PHP
  • I have figured out how to hide the quiz within Wordpress’s content so it can be seen by logged in patrons and not seen by non-patrons
  • I am working on how to attach a patron’s score with their own account. My first idea was to simply have them re-enter their email or nickname when they log in, but I am worried people might try and sabotage other player’s scores by entering in their emails and getting bad scores (hah). So I would like to instead tie their score to their patreon account that the wordpress plugin is checking to make sure they are logged in to patreon.

Is it possible to capture the email or username of the current Patreon user in the wordpress plugin?

Or some other unique variable to their account, even if its an ID number, so they can’t retake the quiz or take someone else’s quiz?

Thank you! I hope my second question on this nice forum is a little more on topic! Cheers!

Plugin already gets user details for logged in patrons:

patreon_user user meta carries user’s Patreon vanity name ( i believe that is the username you are looking for)
patreon_user_id carries user’s Patreon user id

and,

display_name
first_name
last_name

would carry the user’s first, last names (if given at Patreon) and a generated display name (wordpress).

The last 3 are updated into default WP user details. The earlier 2, you will have to get from user’s meta.

1 Like