Here's where I've got to so far (no idea if this is of interest to anyone else or not but thought I'd share what I've done anyway)
I've settled on a membership number of the format YYYYMMDDD-nnnnnn
I get the YYMMDD bit from the registration date of the user and the nnnnnn bit from the unique userid assigned by wordpress.
So a wee bit of PHP using strtotime and date to format the registration timestamp to pick out the YYYYMMDD part and a wee function to pad out the nnnnnn part with the correct number of leading zeroes.
I'm using the Headway theme which allows you to add PHP/HTML 'leafs' (Headway terminology not mine) so the php code can be dropped in without having to use any php exec plugins.
All of that is displayed dynamically to a logged in user only using s2If shortcode conditionals
What I now need to do is see if I can export these dynamically created membership numbers for card printing purposes. I've installed amr-users which is quite good at giving a gui type interface for user metadata in the admin dashboard - this includes all of the s2member stuff too and as it also allows export to CSV etc it is ideal for our purposes. I can set up a list with name, address, postcode, email etc, export it and then do a mailmerge for the cards.
the only snag I have is I can't (yet) see a way of applying the formatting for a membership number as used dynamically on the site. Might be able to do something in libreoffice excel though
it would all be so much simpler if there was a separate membership number field in s2members...
anyway - thanks to those who have offered advice and I hope this is maybe helpful to someone
I've included the code I used to strip out and format the data. Maybe someone will find it handy - or at least it might save a trip to the php manual...
- Code: Select all
<?php
function number_pad($number,$n) {
return str_pad((int) $number,$n,"0",STR_PAD_LEFT);
}
?>
<?php
echo "Membership number: ";
echo date("Ymd", strtotime(get_userdata(get_current_user_id( ))->user_registered)); ?>
<?php
global $userdata;
get_currentuserinfo();
echo "-" . number_pad( $userdata->ID,6 );
?>