hametuha / sharee
Library to share revenue to users.
Installs: 1 279
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 2
Requires
- php: >=7.2
- hametuha/pattern: ^1.0
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: ^1.0
- fakerphp/faker: ^1.20.0
- hametuha/hashboard: ^0.9.1
- phpcompatibility/php-compatibility: ^9.3
- phpunit/phpunit: ~5.7|^6|^7
- squizlabs/php_codesniffer: ^3.5
- wp-coding-standards/wpcs: ~2.3
- yoast/phpunit-polyfills: ^1.0
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 a expected payment list for user's reward. Works fine with 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. You have to enter one manually.
Add Record
$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++; }