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

MyRewards, version trunk. 30 lines.

- Page: https://pluginprobe.com/plugins/woorewards/trunk/code/include/pointsflow/methods/yith.php
- Raw: https://pluginprobe.com/plugins/woorewards/trunk/raw/include/pointsflow/methods/yith.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/yith.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.
 * that will be rounded (floor) at import in MyRewards (points are integer). */
class Yith 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 . 'yith_ywpar_points_log';
		// 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((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");
		if ($wpdb->last_error) {
			\wp_die("Yith Points and Rewards must be installed and active", 410);
		}
		return $results;
	}

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