Hi Ryan,
WordPress requires a username, however you can work around this by dynamically generating a username based on the email address and then hide the Username field (so when the user registers, they will actually get a username — they just won’t know what it is and they won’t see that field).
Then, you can use the WP Email Login plugin to allow your users to login with their email address.
You’ll also need to tweak any emails that go to the user so they don’t mention the username.
Please see this thread from the old forum that explains how I achieved this: http://www.primothemes.com/forums/viewtopic.php?f=4&t=15672&p=49082#p49082
To do something similar on the Pro-Forms during checkout, you can hook into the Pro-Form as follows (this would go in a .php file inside your mu-plugins folder, as described in the aforementioned thread):
<?php
add_action ("ws_plugin__s2member_pro_before_sc_paypal_form", "s2_customize_pro_form", 1000);
function s2_customize_pro_form ($vars = array())
{
/* Don't pre populate when/if the Pro Form has just been POSTd, and/or if it's a Modification Form
with modify="1", because s2Member already pre populates Pro Forms in that scenario, with the
User's existing Email and Username. */
if(empty ($_POST["s2member_pro_paypal_checkout"]) && empty($vars["attr"]["modify"])) {
?>
<script type = "text/javascript">
function getParameterByName(name)
{
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.href);
if(results == null)
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
(function ($) /* Wraps this `$ = jQuery` routine. */
{
$.fn.swapWith = function (to) /* Utility extension for jQuery. */
{
return this.each (function ()
{
var $to = $ (to).clone (true), $from = $ (this).clone (true);
$(to).replaceWith ($from), $ (this).replaceWith ($to);
});
};
/**/
$(document).ready (function () /* Handles email-to-username on keyup. */
{
/* Generate random number to append to username,
hopefully making it unique (yes, this isn't perfect!) */
var randomNum = Math.ceil(Math.random()*999);
if($('input#s2member-pro-paypal-checkout-email').length) {
var email = 'input#s2member-pro-paypal-checkout-email';
var login = 'input#s2member-pro-paypal-checkout-username';
$('#s2member-pro-paypal-checkout-form-username-div').hide();
} else {
var email = 'input#s2member-pro-paypal-registration-email';
var login = 'input#s2member-pro-paypal-registration-username';
$('#s2member-pro-paypal-registration-form-username-div').hide();
}
/* Fill hidden username field with first part of email address
and append randomNum to hopefully make it unique. */
$ (email).keyup (function ()
{
$(login).val ($.trim ($ (email).val ().split (/@/)[0].replace (/[^\w]/gi, '')) + randomNum.toString());
});
});
}) (jQuery);
</script>
<?php
}
}
?>