latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Incremental code for username

Home Forums Community Forum Incremental code for username

This topic contains 10 replies, has 2 voices. Last updated by  Raam Dev 4 years, 9 months ago.

Topic Author Topic
Posted: Wednesday Mar 21st, 2012 at 10:45 am #8738

List Of Topic Replies

Viewing 10 replies - 1 through 10 (of 10 total)
Author Replies
Author Replies
Posted: Wednesday Mar 21st, 2012 at 11:22 am #8746
Raam Dev
Username: Raam
Staff Member

Hi Laurent,

I implemented something similar a few months ago. Please see this thread on the old forum for more details:
http://www.primothemes.com/forums/viewtopic.php?f=4&t=15672&p=49082#p49082

Posted: Wednesday Mar 21st, 2012 at 12:21 pm #8760

Fantastic!

Thanks a lot Raam!

I will immediately implement it.

Posted: Wednesday Mar 21st, 2012 at 12:42 pm #8767

Raam,

Is this code also supposed to work with S2member paypal pro-forms?
I added the php file like you said, but I don’t see any change.

Thanks!

Posted: Thursday Mar 22nd, 2012 at 12:13 pm #8837
Raam Dev
Username: Raam
Staff Member

Hi Laurent,

For a Pro-Form example, please see this thread:
http://www.s2member.com/forums/topic/make-username-field-optional-and-hide-it/#post-7797

Posted: Wednesday Mar 28th, 2012 at 11:37 am #9342

Hi Raam,

What if I don’t use multisite?
Should I put the php in the plugins folder? Because I tried and it didn’t work.

Thanks,
Laurent.

Posted: Wednesday Mar 28th, 2012 at 6:15 pm #9392
Raam Dev
Username: Raam
Staff Member

Hi Laurent,

The mu-plugins folder isn’t for Multisite; the mu stands for Must Use:

The mu-plugins directory holds Must Use Plugins. These plugins are activated and run automatically with WordPress and do not require manual activation.

The code I linked to should go in wp-content/mu-plugins/ regardless of whether you’re using Multisite. I’m currently using that code on my personal site and it’s working as expected, so I’m not sure what might be wrong with yours.

Unfortunately, debugging custom code is outside the scope of our support policy (see s2Member® » Support Policy » Outside Scope).

Posted: Friday Mar 30th, 2012 at 9:26 am #9579

Seems to be working.
Thanks a lot Raam!

I guess that the 1000 in the first line is the maximum number of members.
If I wish to increase the number of possible members do I just have to increase the value of this number or do I need to change something else?

Now, imagine that I want that all members have the same prefix for their username, for example CPY.
ex: CPY-0009, CPY-0125…
Is this possible?

Regards,
Laurent.

Posted: Monday Apr 2nd, 2012 at 2:10 pm #9778
Raam Dev
Username: Raam
Staff Member

Hi Laurent,

The 1000 is a priority setting for the add_action() function. Please see the add_action() function reference on WordPress.org.

You can certainly modify the code in my example to generate usernames in whatever fashion you like. The important thing to remember is that usernames must be unique, otherwise WordPress won’t let you create the user. That’s why I decided to go with prefix of email address + a random number, as that decreases the chances of generating a duplicate.

Posted: Tuesday Apr 3rd, 2012 at 5:33 pm #9979

Thank you Raam, your help is very much appreciated!

Posted: Wednesday Apr 4th, 2012 at 2:25 pm #10049
Raam Dev
Username: Raam
Staff Member

No problem, Laurent! Glad to help. :)

Viewing 10 replies - 1 through 10 (of 10 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.