PluginProbe
MyRewards / trunk
MyRewards vtrunk
5.7.8 5.7.7 5.7.6 trunk 1.2.2 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.1 2.2.0 2.3.0 2.4.0 2.4.1 2.5.0 2.6.4 2.6.6 3.0.0.0 3.1.0 3.1.2 3.1.2.1 3.10.4 3.10.9 All 165 releases
woorewards / include / pointsflow / methods / yith.php

yith.php in MyRewards trunk, at include/pointsflow/methods/yith.php

30 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace LWS\WOOREWARDS\PointsFlow\Methods;
3
4 // don't call the file directly
5 if( !defined( 'ABSPATH' ) ) exit();
6
7 /** Get the total points for users.
8 * that will be rounded (floor) at import in MyRewards (points are integer). */
9 class Yith extends \LWS\WOOREWARDS\PointsFlow\ExportMethod
10 {
11 /** @return (array) the json that will be send,
12 * An array with each entries as {email, points} */
13 public function export($value, $arg)
14 {
15 global $wpdb;
16 $table = $wpdb->prefix . 'yith_ywpar_points_log';
17 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter -- third-party table name
18 $results = $wpdb->get_results("SELECT u.user_email as `email`, SUM((yith.amount)) as `points` FROM {$table} as yith INNER JOIN {$wpdb->users} as u ON u.ID=yith.user_id GROUP BY yith.user_id");
19 if ($wpdb->last_error) {
20 \wp_die("Yith Points and Rewards must be installed and active", 410);
21 }
22 return $results;
23 }
24
25 /** @return (string) human readable name */
26 public function getTitle()
27 {
28 return __("Yith Points and rewards", 'woorewards-lite');
29 }
30 }