Restore unified paid download model
This commit is contained in:
@@ -136,15 +136,15 @@ class AKSRT_Content_Visibility {
|
||||
*/
|
||||
public static function can_download_resource($post = null, int $user_id = 0) {
|
||||
$resource_post = get_post($post);
|
||||
if (!($resource_post instanceof WP_Post) || !function_exists('aksrt_is_resource_post') || !aksrt_is_resource_post($resource_post)) {
|
||||
return new WP_Error('aksrt_not_resource', __('该内容不是可下载资源。', 'aksrt'));
|
||||
if (!($resource_post instanceof WP_Post) || !function_exists('aksrt_is_downloadable_content') || !aksrt_is_downloadable_content($resource_post)) {
|
||||
return new WP_Error('aksrt_not_downloadable', __('该内容未启用下载能力。', 'aksrt'));
|
||||
}
|
||||
|
||||
$state = self::get_post_access_state($resource_post, $user_id);
|
||||
$uid = $user_id > 0 ? $user_id : get_current_user_id();
|
||||
|
||||
if (($state['pay_type'] ?? '') !== AKSRT_Domain_Model::PAY_TYPE_DOWNLOAD) {
|
||||
return new WP_Error('aksrt_not_downloadable', __('该内容不是可下载资源。', 'aksrt'));
|
||||
return new WP_Error('aksrt_not_downloadable', __('该内容未启用下载能力。', 'aksrt'));
|
||||
}
|
||||
|
||||
if (!empty($state['need_login']) && $uid <= 0) {
|
||||
|
||||
Reference in New Issue
Block a user