BuddyDev

Search

Auto assign user badge on a fulfilled requirement

  • Participant
    Level: Enlightened
    Posts: 69
    evil lizard on #43716

    Im trying to achieve something with this user badge plugin: https://buddydev.com/plugins/buddypress-user-badges/

    Photo reference: https://postimg.cc/FdpcFPKz

    —-

    If a users MLM_level gets filled up

    He automatically gets a buddydev badge(on each level fill) and some money/points (maybe in his afilatewp_mla earnings) or some other point system.

    – a congratulatory message on each badge achievement would be nice too if possible.

    Is there a snippet to help me or some better way i can achieve this ?


    Plugins of concern:

    Buddypress-user-badges

    Afiliatwp_version_277

    Afiliatwp_mla (by click studio)

    Afiliatwp_mlm (by christian freeman)

    Some strings that may need to be called:

    $network_stats[$level][‘affiliate_count’];

    mla_level

    mla_affiliates_count

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #43726

    Hi Iken,
    The badge plugin is not suited for your use case. A much better option will be to use GamiPress to award.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 69
    evil lizard on #43738

    I tried the plugin last night

    & I followed a tutorial article and tried to trigger if a user has completed a level or has reached max-widith in his matrix tree

    The function i used below:

     function my_prefix_custom_activity_triggerso( $triggers ) {
        // The array key will be the group label
        $triggers['award point on level complete'] = array(
            // Every event of this group is formed with:
            // 'event_that_will_be_triggered' => 'Event Label'
            'affwp_mlm_check_level_1_complete' => __( 'if mlm level is complete', 'gamipress' ),
            // Also, you can add as many events as you want
            // 'my_prefix_another_custom_event' => __( 'Another custom event label', 'gamipress' ),
            // 'my_prefix_super_custom_event' => __( 'Super custom event label', 'gamipress' ),
        );
        return $triggers;
    }
    add_filter( 'gamipress_activity_triggers', 'my_prefix_custom_activity_triggerso' );
    
    function my_prefix_custom_listenerx( $args ) {
        // Call to the gamipress_trigger_event() function to let know GamiPress this event was happened
        // GamiPress will check if there is something to award automatically
        gamipress_trigger_event( array(
            // Mandatory data, the event triggered and the user ID to be awarded
            'event' => 'affwp_mlm_check_level_1_complete',
            'user_id' => get_current_user_id()
            // Also, you can add any extra parameters you want
            // They will be passed too on any hook inside the GamiPress awards engine
            // 'date' => date( 'Y-m-d H:i:s' ),
            // 'custom_param' => 'custom_value',
        ) );
    }
    // The listener should be hooked to the desired action through the WordPress function add_action()
    add_action( 'affwp_mlm_is_level_complete', 'my_prefix_custom_listenerx' ); 


    but it’s not triggering still, i don’t know if i have the function set correctly

  • Participant
    Level: Enlightened
    Posts: 69
    evil lizard on #43739

    i mean an event like:

    // See if the 1st level for this cycle is full
    if ( $level_1_count == $cycle_max_width )

    Or

    // See if the 1st level is full
    if ( $level_1_count == $max_width )

    loop through all levels

    If yes and the level max_width is filled up

    Then add trigger action to award the current user a badge/point/rank. ..etc for filling up his level to max width

    ….
    ….

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #43741

    Hi Iken,
    Please contact GamiPress support for assistance with it. They are in a lot better position to assit you quickly.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 69
    evil lizard on #43745

    I did thru email ..thing is most of these guys are hardly ever responsive .. It’s a major reason why i’m always here… They never respond boss ..

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #43749

    Hi Iken,
    Please try contacting via the forums. Most of the developers(including us) are more comfortable with forum reply as it allows to manage the questions/issues in better way.

    For a 3rd party plugin, we will need to spend a lot more time going through them before assisting. That’s why hour policy is to limit the support to BuddyPress and our own plugins unless we specify compatibility.

    I hope you understand that.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 69
    evil lizard on #43769

    Ok

You must be logged in to reply to this topic.

This topic is: not resolved