# woorewards/trunk/include/pointsflow/methods/sumo.php

MyRewards, version trunk. 31 lines.

- Page: https://pluginprobe.com/plugins/woorewards/trunk/code/include/pointsflow/methods/sumo.php
- Raw: https://pluginprobe.com/plugins/woorewards/trunk/raw/include/pointsflow/methods/sumo.php
- Modified: 2026-02-17T11:50:30+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/woorewards/trunk/code/include/pointsflow/methods/sumo.php#L10-L20`.

```php
<?php
namespace LWS\WOOREWARDS\PointsFlow\Methods;

// don't call the file directly
if( !defined( 'ABSPATH' ) ) exit();

/** Get the total points for users.
 * @warning Sumo support float values,
 * that will be rounded (floor) at import in MyRewards (points are integer). */
class Sumo extends \LWS\WOOREWARDS\PointsFlow\ExportMethod
{
	/** @return (array) the json that will be send,
	 * An array with each entries as {email, points} */
	public function export($value, $arg)
	{
		global $wpdb;
		$table = $wpdb->prefix . 'rspointexpiry';
		// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter -- third-party table name
		$results = $wpdb->get_results("SELECT u.user_email as `email`, SUM((sumo.earnedpoints-sumo.usedpoints)) as `points` FROM {$table} as sumo INNER JOIN {$wpdb->users} as u ON u.ID=sumo.userid WHERE sumo.expiredpoints IN(0) GROUP BY sumo.userid");
		if ($wpdb->last_error) {
			\wp_die("SUMO must be installed and active", 410);
		}
		return $results;
	}

	/** @return (string) human readable name */
	public function getTitle()
	{
		return __("Sumo", 'woorewards-lite');
	}
}
```
