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.

Home Forums Devra

About: Devra

Sorry, I've not written a description yet. I'll get to it soon!


My Latest Replies (From Various Topics)

Viewing 6 replies - 1 through 6 (of 6 total)
Author Replies
Author Replies
Posted: Tuesday Jul 2nd, 2013 at 3:57 pm #52910
Devra
Username: devra

Any update on when this fix will be available?

Posted: Tuesday Dec 18th, 2012 at 4:48 pm #34968
Devra
Username: devra

I was able to cobble together code that does what I need. Hope this will help someone else. It’s brute force, but it works. Perhaps Jason will want to smooth out the loose ends?

I am concatenating 2 checkbox values and 3 text box values to create the userid I want. Then I am using the Email Login plugin by Beau Lebens to allow the user to login with their email address, so they don’t have to remember this long userid. The userids are ugly but quite useful to my client.

<?php
add_action ("login_head", "s2_customize_login", 1000);
function s2_customize_login ()
	{
		/* 12/18/12 - DFG Strip all blanks out of first and last name. Concatenate
		        N/S + unitnum  + first + last + Status. */
?>
	<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. */
                {    
                    /* If this is the register page, customize it */
                    if(getParameterByName('action') == 'register')
			{
			    	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';
			    	var unitnumber 	= 'input#ws-plugin--s2member-custom-reg-field-unit-number';
				var valNS ;	
				var valRES ;	
				var newfirst ;
				var newlast ;
				var newunit ;
 				$(login).closest ('p').hide();  // This hides the closest P above the login field,
								//    which is the p containing the login field.
								
									 $('input:radio[name=ws_plugin__s2member_custom_reg_field_north_south]').click(function() {
   	valNS = $('input:radio[name=ws_plugin__s2member_custom_reg_field_north_south]:checked').val();
  	$(login).val( valNS + newunit + "_" + newfirst + "_" + newlast + "_" + valRES  );
 }); 
						
						$('input:radio[name=ws_plugin__s2member_custom_reg_field_resident_status]').click(function() {
   	valRES = $('input:radio[name=ws_plugin__s2member_custom_reg_field_resident_status]:checked').val();
  	$(login).val( valNS + newunit + "_" + newfirst + "_" + newlast + "_" + valRES  );
}); 	
 
	$ (firstname).blur (function () 
	{
		newfirst = $.trim( $(firstname).val() );
		newfirst = newfirst.split(' ').join('');
		$(login).val( valNS + newunit + "_" + newfirst + "_" + newlast + "_" + valRES  );
 	}); 
 	
	$ (lastname).blur (function () 
	{
		newlast  = $.trim( $(lastname).val() );
		newlast = newlast.split(' ').join('');
		$(login).val( valNS + newunit + "_" + newfirst + "_" + newlast + "_" + valRES  );
	}); 
	
	$ (unitnumber).blur (function () 
	{
		newunit  = $.trim( $(unitnumber).val() );
		$(login).val( valNS + newunit + "_" + newfirst + "_" + newlast + "_" + valRES  );
	});                           
}
 });
        }) (jQuery);
           </script>
<?php
     }
?>

Thanks again to Jason and Raam for the code model.

Posted: Monday Dec 17th, 2012 at 10:24 pm #34875
Devra
Username: devra

Do you know if there is a hook that would be triggered by the registration submit, but takes place before the page validation, so that I don’t get caught by the validation for a blank userid?

Giving the user a javascript error message because they didn’t fill in their name before they filled in their unit number seems rather unprofessional. Or, if the user fills in the unit, but then goes back to correct a typo in the name, that correction would never be captured.

Thanks.

Posted: Monday Dec 17th, 2012 at 12:16 pm #34848
Devra
Username: devra

Can someone tell me if what I want to do is even possible?

Thanks.

Posted: Wednesday Jul 25th, 2012 at 9:50 am #20202
Devra
Username: devra

I would also be interested in this answer.

Posted: Wednesday Jul 25th, 2012 at 9:49 am #20200
Devra
Username: devra

I would also be interested in this answer.

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

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.