PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

setting a membership ID

s2Member Plugin. A Membership plugin for WordPress®.

setting a membership ID

Postby plumber » October 17th, 2011, 6:20 pm

Have searched through the forum but can't find an answer to this fairly simple query.

I'm using s2members more as a membership management tool than an access tool (if you know what I mean) and I need to assign membership numbers as one of the things we need to do is post people out a membership card (it's in the constitution...)

We have lots of people who pay using cheques or cash - rather than paypal - and also quite a lot of people who have paid using paypal in the past - but not via our new site. So the problem I have is trying to coerce everyone on to the site an onto paypal (eventually).

We also have a complex membership payment structure that makes recurring payments difficult. The best I can come up with is making everything Buy Now and forcing expiries after one year. The problem this gives me is that the subscriber ID disappears once the member level reverts to 0 (Free Subscriber)

anyone got any ideas of how I can assign a membership number which will persist through expiries and renewals? Hope that's clear and thanks in advance for any advice or assistance
User avatar
plumber
Registered User
Registered User
 
Posts: 8
Joined: October 14, 2011

Re: setting a membership ID

Postby Eduan » October 17th, 2011, 6:37 pm

So you want people to have their: "Member ID: 7875m8" and that it stays like that?

If so then try this post and see if it helps: viewtopic.php?f=4&t=15492&p=45273&hilit=member+id#p45273

P.S. Remember to report back.
Now officially accepting Professional s2Member installations along with Bruce C (a.k.a. Ace).

If you're interested in a Professional s2Member Installation, or a Custom Coding Job, you can send your request here.
User avatar
Eduan
Experienced User
Experienced User
 
Posts: 1154
Joined: August 27, 2011
Location: Taxco de Alarcón, Guerrero, México.

Re: setting a membership ID

Postby plumber » October 18th, 2011, 12:48 pm

Thanks but that's not really what I was looking for and reading my original post again I don't think I explained it very well - sorry.

I'm looking to set a membership number for every member. We have some members who will sign up with paypal but have a lot who will need to be imported using the import facility and will probably always pay by cash or cheque. My main use of s2members to start with will be a consolidated membership database rather than a means of controlling access to different levels of content - although that is on the roadmap. So I need a unique identifier that will survive membership expiry - the subscriber ID from paypal blanks on expiry. We need to send out a membership card as that is in the club constitution

I couldn't find a way of using a custom field to set up a system generated or pseudo system generated membership ID. Seems such a simple thing to want but I can't find a way of doing it - so far.

Thanks for your reply though
User avatar
plumber
Registered User
Registered User
 
Posts: 8
Joined: October 14, 2011

Re: setting a membership ID

Postby plumber » October 19th, 2011, 8:12 am

I guess there's no answer to this one then? All I'm looking for is a way of assigning a unique number to each account - even manually as we will probably have to set EOT dates on mnually created accounts anyway - so that we can give everyone a permanent membership number that will not be changed by paypal or any other payment gateway. Anyone got any ideas?

Maybe I need to look at another plugin which could add custom fields at a user level
User avatar
plumber
Registered User
Registered User
 
Posts: 8
Joined: October 14, 2011

Re: setting a membership ID

Postby Bruce C » October 19th, 2011, 9:42 pm

WordPress already assigns a special ID to each user. To find out how to get this: check this out:
codex.wordpress.org/Function_Reference/get_currentuserinfo
~Bruce ( a.k.a. Ace )

If you're interested in a Professional Installation, or Custom Coding Job, you can send your request here.

Proud Supporter of:
The Zeitgeist Movement
and Occupy Everything
User avatar
Bruce C
Experienced User
Experienced User
 
Posts: 337
Joined: July 20, 2011

Re: setting a membership ID

Postby plumber » October 20th, 2011, 2:12 am

Thanks. Had a look at that already and am thinking I might construct a number from the wpuser array. Perhaps combine the date registered timestamp and the unique number. Problem I would have is storing them in the account or in the admin userlist as I may need an admin to be able to go in and export the list so that a mailmerge of sorts can be done tp print cards

That's my current line of thinking
User avatar
plumber
Registered User
Registered User
 
Posts: 8
Joined: October 14, 2011

Re: setting a membership ID

Postby plumber » October 21st, 2011, 4:11 am

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 );
?>
User avatar
plumber
Registered User
Registered User
 
Posts: 8
Joined: October 14, 2011

Re: setting a membership ID

Postby Eduan » October 21st, 2011, 7:40 am

Okay thanks, might come in handy!
Now officially accepting Professional s2Member installations along with Bruce C (a.k.a. Ace).

If you're interested in a Professional s2Member Installation, or a Custom Coding Job, you can send your request here.
User avatar
Eduan
Experienced User
Experienced User
 
Posts: 1154
Joined: August 27, 2011
Location: Taxco de Alarcón, Guerrero, México.

Re: setting a membership ID

Postby ecowebdesign » November 9th, 2011, 8:20 am

Hello,
I am using the following code to display Member ID when users logs in:

<?php
global $userdata;
get_currentuserinfo();


echo 'MEMBER ID: GR-'. date('dmy', $regunixDate) ;
echo '-'. S2MEMBER_CURRENT_USER_ID;
?>

It is a junction form registration date & ID.
Which output like this: MEMBER ID: GR-150211-1

I would like to send this Member ID in the user registration e-mail, as i am doing with %user_login% or %user_pass%.

How it is possible ?
User avatar
ecowebdesign
Registered User
Registered User
 
Posts: 2
Joined: May 10, 2011

Re: setting a membership ID

Postby Cristián Lávaque » November 11th, 2011, 1:52 am

You could pass the current date in a custom value and then use it in the customized email. WP Admin -> s2Member -> PayPal Buttons -> Shortcode Attributes -> custom

Then in the custom New User email you can do something like GR-%%cv1%%-%%user_id%%. WP Admin -> s2Member -> General Options -> Email Configuration -> New User

I hope that helps. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: setting a membership ID

Postby ecowebdesign » November 11th, 2011, 8:12 am

Thank you so much Cristián !

It works !
Thumbs Up for s2 Member coding & support !
User avatar
ecowebdesign
Registered User
Registered User
 
Posts: 2
Joined: May 10, 2011

Re: setting a membership ID

Postby Cristián Lávaque » November 12th, 2011, 2:22 am

Excellent! Thanks for reporting back and the kudos! :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: setting a membership ID

Postby plumber » November 12th, 2011, 4:01 am

Any plans for adding a membership number field? It seems such a basic and easy think to do. For those of us having to migrate from an existing manual system it would be really beneficial
User avatar
plumber
Registered User
Registered User
 
Posts: 8
Joined: October 14, 2011

Re: setting a membership ID

Postby Cristián Lávaque » November 12th, 2011, 3:18 pm

Doesn't a custom registration/profile field work for you to do this? WP Admin -> s2Member -> General Options -> Registration/Profile
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: setting a membership ID

Postby plumber » November 12th, 2011, 3:27 pm

I don't want the user to be able to add or edit. can custom registration fields be hidden?
User avatar
plumber
Registered User
Registered User
 
Posts: 8
Joined: October 14, 2011

Re: setting a membership ID

Postby Cristián Lávaque » November 12th, 2011, 3:47 pm

When you create/edit the custom field, there's a setting titled "Allow Profile Edits". You can use that to remove the field from the person's profile.

To hide it from the registration form you can use CSS. viewtopic.php?f=4&t=14706

I hope that helps. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: setting a membership ID

Postby plumber » November 13th, 2011, 5:20 pm

That's worked perfectly thank you. Still a couple of tweaks to handle the CSS but it will do for now. It would be good if you could add the ability to hide custom registration fields in a future release though as it looks like I need to change login,css and any changes will be overwritten when wp is upgraded. Thanks for an elegant solution in the interim though
User avatar
plumber
Registered User
Registered User
 
Posts: 8
Joined: October 14, 2011

Re: setting a membership ID

Postby Cristián Lávaque » November 15th, 2011, 1:36 am

You're welcome. Glad I could help you. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: No registered users and 1 guest

cron