PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 8.0.5
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v8.0.5
8.0.5 8.0.4 8.0.3 8.0.1 8.0.2 8.0.0 7.9.9.7 7.9.9.6 7.9.9.5 7.9.9.4 7.9.9.3 7.9.9.2 7.9.9.1 7.9.9 7.9.8 7.9.7 7.9.6 7.9.5 7.9.4 7.9.3 7.9.2 7.9.1 7.9.0 7.8.9 7.8.8 All 47 releases
← All changes | integrations/affiliatepress/includes/triggers.php +57 -0 7.9.2 → 8.0.5 View file →
@@ -1,0 +1,57 @@
1 +<?php
2 +/**
3 + * Triggers
4 + *
5 + * @package GamiPress\AffiliatePress\Triggers
6 + * @since 1.0.0
7 + */
8 +// Exit if accessed directly
9 +if( !defined( 'ABSPATH' ) ) exit;
10 +
11 +/**
12 + * Register plugin triggers
13 + *
14 + * @since 1.0.0
15 + *
16 + * @param array $triggers
17 + * @return mixed
18 + */
19 +function gamipress_affiliatepress_activity_triggers( $triggers ) {
20 +
21 + $triggers[__( 'AffiliatePress', 'gamipress' )] = array(
22 +
23 + 'gamipress_affiliatepress_become_affiliate' => __( 'Become as affiliate', 'gamipress' ),
24 + 'gamipress_affiliatepress_earn_commission' => __( 'Earn a commission', 'gamipress' ),
25 + 'gamipress_affiliatepress_get_payment' => __( 'Get a generated payment', 'gamipress' ),
26 +
27 + );
28 +
29 + return $triggers;
30 +
31 +}
32 +add_filter( 'gamipress_activity_triggers', 'gamipress_affiliatepress_activity_triggers' );
33 +
34 +/**
35 + * Get user for a given trigger action.
36 + *
37 + * @since 1.0.0
38 + *
39 + * @param integer $user_id user ID to override.
40 + * @param string $trigger Trigger name.
41 + * @param array $args Passed trigger args.
42 + * @return integer User ID.
43 + */
44 +function gamipress_affiliatepress_trigger_get_user_id( $user_id, $trigger, $args ) {
45 +
46 + switch ( $trigger ) {
47 + case 'gamipress_affiliatepress_become_affiliate':
48 + case 'gamipress_affiliatepress_earn_commission':
49 + case 'gamipress_affiliatepress_get_payment':
50 + $user_id = $args[0];
51 + break;
52 + }
53 +
54 + return $user_id;
55 +
56 +}
57 +add_filter( 'gamipress_trigger_get_user_id', 'gamipress_affiliatepress_trigger_get_user_id', 10, 3 );