hametuha/sharee
最新稳定版本:1.0.1
Composer 安装命令:
composer require hametuha/sharee
包简介
Library to share revenue to users.
README 文档
README
WordPress library for Reward manager.
Installation
composer require hametuha/sharee
To enable sharee, call bootstrap method.
// Call before after_setup_theme \Hametuha\Sharee::get_instance();
Features
Reward List
Reward list on WordPress Dashboard.
Payment List
Payment list is an expected payment list for user's reward. Works fine with hametuha/hashboard.
/** * Enable payment list * * @param bool $enabled Default false. * @param bool $service Service name to be enabled. */ add_filter( 'sharee_should_enable', function( $enabled, $service ) { switch ( $service ) { case 'billing': // Billing is billing list. return true; default: return $enabled; } }, 10, 2 );
API
Sharee has no screen to add reward record. Some lines of code are required.
Add Record
// Add revenue. $result = RevenueModel::get_instance()->add_revenue( 'kdp', $user_id, $price, [ 'unit' => $unit, 'total' => $total, 'tax' => $tax, 'deducting' => $deducting, 'description' => $label ] ); if ( $result && ! is_wp_error( $result ) ) { $success++; }
Query User
There are 2 additional query vars for user query.
paid_since: Filter users who have been paid since the date.paid_until: Filter users who have been paid until the date.
This works with WP_User_Query.
// get users who got paid between Year 2018. $query = new WP_User_Query( [ 'role' => 'subscriber', 'paid_since' => '2018-01-01', 'paid_until' => '2018-12-31', 'number' => 10, 'paged' => 1, ] );
统计信息
- 总下载量: 1.43k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2018-10-09