How to create a button that updates a custom field using MB Views?

Support MB Views How to create a button that updates a custom field using MB Views?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #38828
    John ChenJohn Chen
    Participant

    I'm basically trying to create a gamification engine that gives users points. Points have been installed as a Number on the User post type.

    I want to create a button which will give users 100 points when they click on a button, 200 and so on.

    1. Create a button using MB Views that will generate a shortcode upon completion.
    2. Add in the right code that can update that user's Points custom field in the User post type.
    3. Use that shortcode anywhere in my site as I wish.

    Problem is, I have no idea how this is to be achieved since there is not much documentation on this.

    Please help. Thank you.

    #38834
    Long NguyenLong Nguyen
    Moderator

    Hi John,

    It is a complicated case and needs to use more code (JS, PHP) to update a field value on the frontend when clicking on a button. If you are familiar with coding, you can follow this documentation to know how to use AJAX in WordPress to update the field value
    https://codex.wordpress.org/AJAX_in_Plugins

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.