Skip to content

Instantly share code, notes, and snippets.

@wpmudev-sls
Created December 6, 2018 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpmudev-sls/5c5edc4f3ae29e71bc9e3ce01fc87ada to your computer and use it in GitHub Desktop.
Save wpmudev-sls/5c5edc4f3ae29e71bc9e3ce01fc87ada to your computer and use it in GitHub Desktop.
<?php
/**
* Plugin Name: Membership - Fixed woocommerce Invalid Subscription issue
* Description: Membership - Fixed woocommerce Invalid Subscription issue
* Author: Ariful Islam @ WPMUDEV
* Author URI: https://premium.wpmudev.org/profile/itsarifulislam
* License: GPLv2 or later
*/
add_filter( 'ms_rule_memberroles_model_modify_caps', function( $real_caps, $caps ) {
global $wp;
if ( ! isset($wp->query_vars['view-subscription']) || 'shop_subscription' != get_post_type(absint($wp->query_vars['view-subscription'])) ) return $real_caps;
foreach ( $caps as $key => $value ) {
if ( $value == 'view_order' ) $real_caps[$value] = 1;
}
return $real_caps;
}, 2, 10 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment