Skip to content

Instantly share code, notes, and snippets.

@mwhiteley16
Created December 31, 2017 19:08
Show Gist options
  • Save mwhiteley16/80d9f7abaae28491fe2b415a9d842117 to your computer and use it in GitHub Desktop.
Save mwhiteley16/80d9f7abaae28491fe2b415a9d842117 to your computer and use it in GitHub Desktop.
Change User Role when Cancelled EDD Subscription
function wd_downgrade_fieldstaff( $sub_id, $subscription ) {
$u = new WP_User( $subscription->customer->user_id );
$u->remove_role( 'fieldstaff' );
$u->add_role( 'subscriber' );
}
add_action( 'edd_subscription_cancelled', 'wd_downgrade_fieldstaff', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment