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_hacks_js", 15);
function s2_hacks_js ()
{
echo '<script type="text/javascript">';
include_once dirname (__FILE__) . "/s2-hacks.js";
echo '</script>';
}
?>
jQuery(document).ready (function($)
{
/* Sets default value of home_phone_number to: 999-999-9999. */
if (!$.trim ($ ('input#ws-plugin--s2member-custom-reg-field-home-phone-number').val ()))
$('input#ws-plugin--s2member-custom-reg-field-home-phone-number').val ('999-999-9999');
/**/
/* Sets the default value of preferred_contact_number to the value being entered for home_phone_number. */
$('input#ws-plugin--s2member-custom-reg-field-home-phone-number').keyup (function() /* Key press. */
{
$('input#ws-plugin--s2member-custom-reg-field-preferred-contact-number').val ($ (this).val ());
});
});
So it's relatively easy ( for a developer ) to use jQuery for this, by adding a Hook in the following way.
I've just done a video on this code for you.
Please let us know if you continue to have trouble.
Jason Caldwell wrote:* This code assumes that you're using the default Login/Registration system for WordPress ( i.e. /wp-login.php?action=register )
man-O-media wrote:Jason Caldwell wrote:* This code assumes that you're using the default Login/Registration system for WordPress ( i.e. /wp-login.php?action=register )
And it still works great
jQuery(document).ready (function($)
{
/* Sets default value of home_phone_number to: 999-999-9999. */
if (!$.trim ($ ('input#ws-plugin--s2member-custom-reg-field-home-phone-number').val ()))
$('input#ws-plugin--s2member-custom-reg-field-home-phone-number').val ('999-999-9999');
/**/
/* Sets the default value of preferred_contact_number to the value being entered for home_phone_number. */
$('input#ws-plugin--s2member-custom-reg-field-home-phone-number').keyup (function() /* Key press. */
{
$('input#ws-plugin--s2member-custom-reg-field-preferred-contact-number').val ($ (this).val ());
});
});
s2member-pro-paypal-[checkout|sp-checkout|registration]-custom-reg-field-
jQuery(document).ready (function($)
{
/* Sets default value of home_phone_number to: 999-999-9999. */
if (!$.trim ($('input#s2member-pro-paypal-registration-custom-reg-field-home-phone-number').val ()))
$('input#s2member-pro-paypal-registration-custom-reg-field-home-phone-number').val ('999-999-9999');
/**/
/* Sets the default value of preferred_contact_number to the value being entered for home_phone_number. */
$('input#s2member-pro-paypal-registration-custom-reg-field-home-phone-number').keyup (function() /* Key press. */
{
$('input#s2member-pro-paypal-registration-custom-reg-field-preferred-contact-number').val ($(this).val ());
});
});
Jason Caldwell wrote:Thanks for the follow-up on this thread.
Tab index issues inside Pro Form integrations were corrected in the release of s2Member Pro v110926+.
In Pro Forms, Custom Registration Fields are prefixed by:depending on the type of Pro Form being integrated.
- Code: Select all
s2member-pro-paypal-[checkout|sp-checkout|registration]-custom-reg-field-
jQuery(document).ready (function($)
{
/* This line works in the default wp registration form. */
if (!$.trim ($ ('input#ws-plugin--s2member-custom-reg-field-city').val ()))
$('input#ws-plugin--s2member-custom-reg-field-city').val ('New York');
/* This line does not work in the pro registration form. */
if (!$.trim ($('input#s2member-pro-paypal-registration-custom-reg-field-city').val ()))
$('input#s2member-pro-paypal-registration-custom-reg-field-city').val ('New York');
/**/
/* Sets the default value of preferred_contact_number to the value being entered for home_phone_number. */
$('input#ws-plugin--s2member-custom-reg-field-primary-phone').keyup (function() /* Key press. */
{
$('input#ws-plugin--s2member-custom-reg-field-calling-post-phone').val ($ (this).val ());
});
});
<?php
add_action ("login_head", "s2_hacks_js", 15);
function s2_hacks_js()
{
echo '<script type="text/javascript">';
include_once dirname (__FILE__) . "/s2-hacks.js";
echo '</script>';
}
?>
<?php
add_action ("wp_head", "s2_hacks_js", 15);
function s2_hacks_js()
{
echo '<script type="text/javascript">';
include_once dirname (__FILE__) . "/s2-hacks.js";
echo '</script>';
}
?>
Return to Common Questions/Problems/Tips
Users browsing this forum: No registered users and 2 guests