I have a PHP snipped which generates a membership number, whether the person is registering for a membership or ordering a workshop through WooCommerce. I need only members -
if( pmpro_hasMembershipLevel()) - to receive a membership number. How do I assign everyone else (e.g woo commerce customers) a generic designation “Customer”
Here is my logic…
Goal: Generate member_number when a MEMBER is registered, otherwise enter default CUSTOMER notation
Check if the user has an active membership level.
if membership level exists then they get a membership number which is the same as the user_id
otherwise assign $asta_number = “Customer”;
—code in use is below—
$asta_number = get_user_meta($user_id, “asta_number”, true);
// Update the user’s member number when they first signup for a membership.
$asta_number = $user_id; update_user_meta($user_id, "asta_number", $asta_number); //save to user meta update_user_meta($user_id, "asta_number", $asta_number); return $asta_number; }
I tried to edit previous post but accidentally deleted. Apologies.