Member ID Pattern requires to include a token (to make it unique).
This is not necessary IMHO if you check the autoincrement number checkbox.

Steps to reproduce:

  • Go to /admin/memberships/types/manage/$your_membership_type, go to membership options, and choose "Token ID".
  • Then, in the "Member ID pattern", enter e.g. "XYZ" or anything else, as prefix for the ID.
  • Check "Add an incrementing numeric suffix", take any suffix length (e.g. 5)

I would think that this is unique enough: any name and an incremental number, separated by a hyphen (the default)

After clicking on "Save configuration", I get an error message, that Member ID Pattern must have at least one token to be unique.

This must be a bug...?

Comments

nerdoc created an issue. See original summary.

nerdoc’s picture

The problem is that MembershipEntityTokenMemberId.class.php contains '#min_tokens' => 1, in line 91 for $form['pattern'] in the settingsForm.

If I replace the 1 with 0; everything works.
I know there has to be another validation, but this can't be done with the build_in token_element_validate() callback. It needs to check: If token_count = 0, see if the autoincrement counter is activated. If so, everything's fine.

The #min_tokens does not help neither, because you can take a token like the current domain etc. which does not change. This is not unique then without the counter, but passes the validation check.

nerdoc’s picture

A workaround: if you add the [membership_entity:member-id] token (which seems to be unassigned at the moment of creation), it is left out and the config can be saved.
This is just a workaround tough.

  • draenen committed 81f52ba on 7.x-1.x
    Issue #2595095: Why must include Member ID Pattern a token?
    
draenen’s picture

Status: Active » Fixed
lisa.rae’s picture

Has this been merged into the 7.x-1.x branch?

draenen’s picture

Yes, this is on 7.x-1.x

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.