Statistics: Posted by Raam Dev — January 7th, 2012, 7:05 pm
Statistics: Posted by mcmcmc — January 6th, 2012, 12:53 pm
Statistics: Posted by Raam Dev — January 5th, 2012, 7:14 pm
<?php
add_action ("login_head", "s2_email_to_username", 1000);
function s2_email_to_username ()
{
?>
<script type = "text/javascript">
(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()*999999);
var email = 'input#user_email';
var login = 'input#user_login';
var firstname = 'input#ws-plugin--s2member-custom-reg-field-first-name';
var lastname = 'input#ws-plugin--s2member-custom-reg-field-last-name';
/* Hide stuff we don't want to show on the registration form */
$('p.message').hide();
$('div.ws-plugin--s2member-custom-reg-field-divider-section').hide();
$('#reg_passmail').hide();
$('#nav').hide();
/* $(login).closest ('p').hide(); */
$('#wp-submit').val('Subscribe'); /* Change 'Register' button to 'Subscribe' */
/* 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
}
?>
Statistics: Posted by mcmcmc — January 4th, 2012, 8:32 pm
Statistics: Posted by Raam Dev — January 4th, 2012, 6:13 pm
Statistics: Posted by mcmcmc — January 4th, 2012, 6:11 pm
Statistics: Posted by Raam Dev — January 4th, 2012, 6:07 pm
Statistics: Posted by mcmcmc — January 4th, 2012, 3:03 pm
Statistics: Posted by Raam Dev — January 2nd, 2012, 5:47 pm
Statistics: Posted by mcmcmc — December 30th, 2011, 9:05 pm