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/woocommerce/includes/admin.php +76 -0 7.9.0 → 8.0.5 View file →
@@ -1,0 +1,76 @@
1 +<?php
2 +/**
3 + * Admin
4 + *
5 + * @package GamiPress\WooCommerce\Admin
6 + * @since 1.0.0
7 + */
8 +// Exit if accessed directly
9 +if( !defined( 'ABSPATH' ) ) exit;
10 +
11 +require_once GAMIPRESS_WC_DIR . 'includes/admin/recount-activity.php';
12 +
13 +function gamipress_wc_meta_boxes() {
14 +
15 + // Start with an underscore to hide fields from custom fields list
16 + $prefix = '_gamipress_wc_';
17 +
18 + // Grab our points types as an array
19 + $points_types_options = array(
20 + '' => 'Default'
21 + );
22 +
23 + foreach( gamipress_get_points_types() as $slug => $data ) {
24 + $points_types_options[$slug] = $data['plural_name'];
25 + }
26 +
27 + // Download Points
28 + new_cmb2_box( array(
29 + 'id' => 'gamipress-wc-product-points',
30 + 'title' => __( 'Award points', 'gamipress' ),
31 + 'object_types' => array( 'product' ),
32 + 'context' => 'side',
33 + 'priority' => 'default',
34 + 'fields' => apply_filters( 'gamipress_wc_product_points_defaults_meta_box_fields', array(
35 + array(
36 + 'name' => __( 'Award points to users that purchase this product?', 'gamipress' ),
37 + 'desc' => '',
38 + 'id' => $prefix . 'award_points',
39 + 'type' => 'checkbox',
40 + 'classes' => 'gamipress-switch',
41 + ),
42 + array(
43 + 'name' => __( 'Points', 'gamipress' ),
44 + 'desc' => ' '.__( 'Points awarded for purchasing this product.', 'gamipress' ),
45 + 'id' => $prefix . 'points',
46 + 'type' => 'text_small',
47 + ),
48 + array(
49 + 'name' => __( 'Points Type', 'gamipress' ),
50 + 'desc' => ' '.__( 'Points type to award for purchasing this product.', 'gamipress' ),
51 + 'id' => $prefix . 'points_type',
52 + 'type' => 'select',
53 + 'options' => $points_types_options
54 + ),
55 + ), $prefix )
56 + ) );
57 +
58 +}
59 +add_action( 'cmb2_admin_init', 'gamipress_wc_meta_boxes' );
60 +
61 +/**
62 + * WooCommerce automatic updates
63 + *
64 + * @since 1.0.2
65 + *
66 + * @param array $automatic_updates_plugins
67 + *
68 + * @return array
69 + */
70 +function gamipress_wc_automatic_updates( $automatic_updates_plugins ) {
71 +
72 + $automatic_updates_plugins['gamipress'] = __( 'WooCommerce integration', 'gamipress' );
73 +
74 + return $automatic_updates_plugins;
75 +}
76 +add_filter( 'gamipress_automatic_updates_plugins', 'gamipress_wc_automatic_updates' );