value generated for _membership_key meta

When a subscription is successful this meta value is populated with a seemingly random string, is there a way I can make it instead pull from a database or alternatively, if a 100% value coupon code is used, make the coupon value overwrite it?

Thanks for the quick reply. The site is for a discount card where customers are able to register for a website and purchase the card online where the _membership_key value becomes their unique membership ID, this number is then printed on a card with the expiry date and sent out the customer.

However it is also be necessary for customers to be able to purchase the card offline (from highstreet shops) and simply register their card online. These cards will have pre printed numbers on them, which will be their unique membership ID's. I would like to use the coupon feature to apply a 100% discount to the value of the subscription so customers must simply enter the number on the card to earn the subscription.

As is this will then generate a _membership_key for the offline purchasers which will not match the number on the front of their card. I simply need a way to add the string value entered as the coupon code form as additional meta data.

Ideally this coupon code value would overwrite the _membership_key but I feel this is not possible.

So my basic attempt so far:

I have tried making my own custom meta value (offline_subsc_id) and calling the update_user_meta function in coupon.form.php but cannot get it to work.

// Check if there are any coupons and if there are any valid for this subscription
if ( $coupon != false ) {
// Check the coupon is a valid one
$sub_id = (int)$_REQUEST['subscription'];
if ( is_numeric( $sub_id ) && method_exists( $coupon, 'valid_for_subscription' ) && $coupon->valid_for_subscription( $sub_id ) ) {

Hope this makes sense, let me know if not. The database solution would be an alternative where the $key is not generated by combining passwords/time but instead just checks a table of values (there would be thousands) and picks the next unused and sets that as the membership number for the user.

How do you rate me?

Thank you for rating your experience!

We’re thrilled to hear you had a great experience with . Would you like to leave a comment about your experience?
Thanks for voting on your experience with , we’d love to get some feedback please.
Ohh no! We’re really sorry to hear you didn’t have a pleasant experience with , we’re always looking at how we can improve and would appreciate you provide some further feedback here please.
Type your feedback here

it's great that you had a positive one. Based on your experience in this ticket would you please be kind enough to rate us externally on: