Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] CubePoints and BuddyPress Intregration?

  • @xberserker

    Participant

    I’ve been using CubePoints with my single WP install to get people on contribute to my site.

    They get points for posts, comments, forum posts, daily visit. I have giveaways and they

    donate there points to a lottery account that I randomly pick from.

    http://wordpress.org/extend/plugins/cubepoints/

    Anyway, they provide a simple API, so I was just wondering where I could put this code.

    
    if( function_exists('cp_alterPoints') && is_user_logged_in() ){
    
        cp_alterPoints(cp_currentUser(), 10);
    
     }

    So if they create a group they get some points, if they post an update/reply, etc.

Viewing 10 replies - 26 through 35 (of 35 total)
  • @armandmorin

    Participant

    What is are you calling this?

    @xberserker

    Participant

    Right now “Cubepoints Buddypress Integration” until I can think of a better name.

    @gregfielding

    Participant

    Any thoughts on how this could work with MU?

    @xberserker

    Participant

    mm, that’s a question to ask the makers of the CubePoints plugin. I’m just extending it’s use to BuddyPress right now.

    @r-a-y

    Keymaster

    @Tosh

    global $bp;
    if ( !$bp->loggedin_user->is_site_admin )
    return false;

    This goes above the function_exists call.

    Just an FYI, make sure that your plugin is BP-aware:

    https://codex.buddypress.org/how-to-guides/make-your-plugin-buddypress-aware-v1-2/

    @xberserker

    Participant

    Thanks I added that admin code. Not sure if I understand how to make my Plugin BP-aware.

    Is this correct? I tried this and it still works, so ..? lol Am I good? My plugin is only 1 file other than the readme.txt

    // BuddyPress aware
    function cubepointsbp() {

    my ninja code here

    }

    if ( defined( 'BP_VERSION' ) )
    cubepointsbp();
    else
    add_action( 'bp_init', 'cubepointsbp' );
    // END BuddyPress aware

    @r-a-y

    Keymaster

    Yup that’s right.

    The other thing is you might need to ensure that CubePoints is loaded as well.

    Try something like this in your cubepointsbp() function:

    function cubepointsbp() {
    if ( function_exists( 'cp_init' ) ) {
    //your ninja code
    }
    else {
    // display error message
    add_action( 'admin_notices', 'cubepointsbp_error_msg');
    }
    }

    function cubepointsbp_error_msg(){
    echo '<div class="error fade" style="background-color:red;"><p><strong>CubePoints for BP requires the CubePoints plugin in order to work. Please deactivate this plugin or activate <a href="https://wordpress.org/extend/plugins/cubepoints/">CubePoints</a>.</strong></p></div>';
    }

    Untested… but see if that works.

    @xberserker

    Participant

    @r-a-y That works! You are a genius! That’s very helpful.

    @gpo1

    Participant

    Does it work for WPMU & where can I download it

    @xberserker

    Participant

    Here is the official thread on the new plugin :) Download link is there as well. I haven’t tested CubePoints with WordPressMU.

Viewing 10 replies - 26 through 35 (of 35 total)
  • The topic ‘[Resolved] CubePoints and BuddyPress Intregration?’ is closed to new replies.
Skip to toolbar