Change wp role after a trial period
-
When a user complete an order I change his role from customer to vip_customer (custom role) with this code
function wpa_120656_convert_paying_customer( $order_id ) { $order = new WC_Order( $order_id ); if ( $order->user_id > 0 ) { update_user_meta( $order->user_id, 'paying_customer', 1 ); $user = new WP_User( $order->user_id ); // Remove role $user->remove_role( 'customer' ); // Add role $user->add_role( 'vip_customer' ); } } add_action( 'woocommerce_order_status_completed', 'wpa_120656_convert_paying_customer' );
now , I need a way to rechange wp role to woocommerce customer after a trial period of 1 year.
Can you Help me?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Change wp role after a trial period’ is closed to new replies.