Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author web-able

    (@web-able)

    There is no documentation for developers but I will assist you with anything you need.
    To answer your specific question: User’s points are stored as user meta with key ‘bp_points’ so you can just use get_user_meta() (if this returns empty string, then the user has not played yet and you have to take the ‘bp_starting_points’ from the options as his points) and update_user_meta()

    So I only to change that value in the profile of the user without use the internal api of that plugin?
    Pretty cool and interesting ??

    Plugin Author web-able

    (@web-able)

    Yep, you only need to use the build-in WordPress functions to achieve simple tasks like reading/updating user’s points or BetPress’ settings.

    I was studying myCred, i think that to do an integration between these plugins will be better few filters on the internal system of betpress to avoid core changes.
    In this way i can integrate and share the points of mycred with betpress and have the leaderboard time based, with all the integration that i need to acquire points.

    Like in:
    line 255 of BetPress.php
    $user_points_db = apply_filters( 'bp_points', get_user_meta($user_ID, 'bp_points', true));

    etc, but in case it is better a function to wrap all the request to that.

    Plugin Author web-able

    (@web-able)

    Integrating other plugin’s points system wouldn’t be an easy task because the BetPress’ code directly use get_user_meta() everywhere where user’s points are needed. What I mean is that this is not encapsulated in a single function so you will need to tweak the code on every place where user’s points are needed.
    The line you quoted is inside of callback and is about showing columns in the admin dashboard -> users page so it is only one of the many places that you will have to tweak the code. But I don’t see how apply_filters() may be helpful for this, however that’s just me and what I think ??

    well if there is a function inside the plugin like:
    function get_user_points($user_ID) { return apply_filters( 'bp_points', get_user_meta($user_ID, 'bp_points', true)) } used everywhere in betpress will be simple to integrate with other plugins.

    Plugin Author web-able

    (@web-able)

    You will need first to register a filter with add_filter and to use callback because as I said earlier a user may still not have played thus you have to return the bp_starting_points from the wp options table.
    But I am afraid you will have to make the fixes you need in your copy of BetPress because the next update is not planned yet.

    Ok probably i will do a public fork of this project with the support for developers because actually is a closed box.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘New way to get virtual coins’ is closed to new replies.