PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 7.9.8
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v7.9.8
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 7.8.7 All 46 releases
gamipress / integrations / thrive-ovation / includes / triggers.php

triggers.php in GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI 7.9.8, at integrations/thrive-ovation/includes/triggers.php

83 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Triggers
4 *
5 * @package GamiPress\Thrive_Ovation\Triggers
6 * @since 1.0.0
7 */
8
9 // Exit if accessed directly
10 if( !defined( 'ABSPATH' ) ) exit;
11
12 /**
13 * Register plugin specific triggers
14 *
15 * @since 1.0.0
16 *
17 * @param array $triggers
18 * @return mixed
19 */
20 function gamipress_thrive_ovation_activity_triggers( $triggers ) {
21
22 $triggers[__( 'Thrive Ovation', 'gamipress' )] = array(
23
24 'gamipress_thrive_ovation_submit_testimonial' => __( 'Submit a testimonial', 'gamipress' ),
25
26 );
27
28 return $triggers;
29
30 }
31 add_filter( 'gamipress_activity_triggers', 'gamipress_thrive_ovation_activity_triggers' );
32
33 /**
34 * Get user for a given trigger action.
35 *
36 * @since 1.0.0
37 *
38 * @param integer $user_id user ID to override.
39 * @param string $trigger Trigger name.
40 * @param array $args Passed trigger args.
41 * @return integer User ID.
42 */
43 function gamipress_thrive_ovation_trigger_get_user_id( $user_id, $trigger, $args ) {
44
45 switch ( $trigger ) {
46
47 case 'gamipress_thrive_ovation_submit_testimonial':
48 $user_id = $args[1];
49 break;
50
51 }
52
53 return $user_id;
54
55 }
56 add_filter( 'gamipress_trigger_get_user_id', 'gamipress_thrive_ovation_trigger_get_user_id', 10, 3 );
57
58 /**
59 * Extended meta data for event trigger logging
60 *
61 * @since 1.0.0
62 *
63 * @param array $log_meta
64 * @param integer $user_id
65 * @param string $trigger
66 * @param integer $site_id
67 * @param array $args
68 *
69 * @return array
70 */
71 function gamipress_thrive_ovation_log_event_trigger_meta_data( $log_meta, $user_id, $trigger, $site_id, $args ) {
72
73 switch ( $trigger ) {
74
75 case 'gamipress_thrive_ovation_submit_testimonial':
76 $log_meta['testimonial_id'] = $args[0];
77 break;
78
79 }
80
81 return $log_meta;
82 }
83 add_filter( 'gamipress_log_event_trigger_meta_data', 'gamipress_thrive_ovation_log_event_trigger_meta_data', 10, 5 );