Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] CubePoints and BuddyPress Intregration?


  • Tosh
    Participant

    @xberserker

    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

    @armandmorin

    What is are you calling this?


    Tosh
    Participant

    @xberserker

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


    gregfielding
    Participant

    @gregfielding

    Any thoughts on how this could work with MU?


    Tosh
    Participant

    @xberserker

    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

    @r-a-y

    @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/


    Tosh
    Participant

    @xberserker

    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

    @r-a-y

    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.


    Tosh
    Participant

    @xberserker

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


    gpo1
    Participant

    @gpo1

    Does it work for WPMU & where can I download it


    Tosh
    Participant

    @xberserker

    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