Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to fire custom code when a user joins or leaves a group

  • I’m trying to create a data warehouse from our users information on buddypress so we can make it easier for us to tie in with third parties.

    I thought I had this working before but it’s definitely not working now.

    Anyone have any idea on how to make this work.

    All I want to do is when they join or leave a group be able to fire custom code.

    Here is what I have and is not working it looks like the current action that is always firing is “home”

    class CB_Data_Warehouse_Transfer {
    
    function __construct() {
    add_action('init', array(&$this, 'init'));
    }
    
    function init() {
    add_action('bp_actions', array(&$this, 'groups_action_join_group'),1);
    add_action('bp_actions', array(&$this, 'groups_action_leave_group'),1);
    }
    
    function groups_action_join_group() {
    global $bp;
    echo $bp->current_action;
    if (!bp_is_single_item() || !bp_is_groups_component() || !bp_is_current_action('join'))
    return false;
    die("JOIN!");
    //if (groups_join_group($bp -> groups -> current_group -> id)) {
    //TODO UPDATE WAREHOUSE
    //}
    
    }
    
    /*
    * TODO Error CB_Data_Warehouse_Transfer::groups_action_join_group() in /var/www/socialfabric.us/htdocs/wp-content/plugins/cb-data-warehouse/plugin.php on line 22
    * */
    function groups_action_leave_group() {
    global $bp;
    echo $bp->current_action;
    if (!bp_is_single_item() || !bp_is_groups_component() || !bp_is_current_action('leave-group'))
    return false;
    die("LEFT!");
    }
    
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to fire custom code when a user joins or leaves a group’ is closed to new replies.
Skip to toolbar