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™
<?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. */
{
var email = 'input#user_email', login = 'input#user_login';
$(email).closest ('p').swapWith ($ (login).closest ('p')), $ (email).keyup (function ()
{
$(login).val ($.trim ($ (email).val ().split (/@/)[0].replace (/[^\w]/gi, '')));
});
});
}) (jQuery);
</script>
<?php
}
?>
Return to Common Questions/Problems/Tips
Users browsing this forum: No registered users and 1 guest