Created
February 4, 2019 12:02
-
-
Save PGeorgiev/c9a939d4a51c20b9fe38aea7f2c56339 to your computer and use it in GitHub Desktop.
shortcode signup page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------------------------------------------------ | |
// A simple registration form for the signup page | |
// ------------------------------------------------ | |
function signup_page_form_new() { | |
// Configuration. Set these accordingly. | |
$returnUrl = "https://www.brosix.com/signup/"; | |
$partnerID = "en.brosix.com-signup"; | |
// Do not change | |
$WHITELABEL_API_URL = "https://box-n2.brosix.com/net/signup/process/creating/"; | |
// NOT WORKING $WHITELABEL_API_URL = "https://box-n2.brosix.com/net/signup/process/creating/"; | |
// Language | |
// Form texts | |
$lang_Editbox_team_name = "* Give Your Team a Name"; | |
$lang_Editbox_person_name = "* First and Last Name"; | |
$lang_Editbox_Email = "* Email"; | |
$lang_Editbox_Confirm = "* Confirm your work email"; | |
$lang_Editbox_password = "* Password"; | |
$lang_Button_Signup = " Sign Up "; | |
// Form texts | |
// Error text | |
$lang_Error_Unspecified = "Unspecified error. We apologize for the inconvenience. Please try again later."; | |
$lang_Error_ParameterMissing = "Please fill in all fields."; | |
$lang_Error_EmailInvalid = "Invalid e-mail address."; | |
$lang_Error_EmailInUse = "This e-mail address is already in use.<br />Please, provide another one."; | |
$lang_Error_Partner = "Partner not identified."; | |
$lang_Error_Confirm = "Please confirm your email"; | |
// Error text | |
// END OF Language | |
ob_start(); | |
?> | |
<style> | |
#errormessage | |
{ | |
background: orange; | |
margin-top: 10px; | |
margin-bottom: 10px; | |
padding: 3%; | |
} | |
#errormessage p | |
{ | |
color: #000000 !important; | |
margin-top: 10px; | |
margin-bottom: 10px; | |
} | |
{ | |
width: 90%; | |
height: 40px; | |
padding-left:5px; | |
} | |
</style> | |
<?php | |
$errCode = $_GET["error_code"]; | |
$email = $_GET["email"]; | |
$confirm = $_GET["confirm"]; | |
$team_name = $_GET["team_name"]; | |
$person_name = $_GET["person_name"]; | |
$password = $_GET["password"]; | |
$partnerIDParam = $_GET["partner_id"]; | |
if( ! empty( $partnerIDParam ) ) // Partner ID is passed | |
$partnerID = $partnerIDParam; | |
if( ! isset( $errCode ) || $errCode != 1 ) // Initial page load | |
{ | |
?> | |
<form id="contacts" action="<?php echo $WHITELABEL_API_URL ?>" method="post"> | |
<p><input class="team_name" id="team_name" type="text" name="team_name" placeholder="<?php echo $lang_Editbox_team_name; ?>" value='<?php echo $teamname ?>' required /></p> | |
<p class="info-box">We suggest using your company name, but feel free to choose anything appropriate. You can always change it in the future.</p> | |
<p><input class="person_name" id="person_name" type="text" name="person_name" placeholder="<?php echo $lang_Editbox_person_name; ?>" value='<?php echo $names ?>' required /></p> | |
<p><input class="email" id="email" type="email" name="email" placeholder="<?php echo $lang_Editbox_Email; ?>" value='<?php echo $email ?>' required /></p> | |
<p><input class="confirm" id="confirm" type="email" name="confirm" placeholder="<?php echo $lang_Editbox_Confirm; ?>" value='<?php echo $confirm ?>' required /></p> | |
<p><input class="password" id="password" type="password" name="password" placeholder="<?php echo $lang_Editbox_password; ?>" value='<?php echo $password ?>' required /></p> | |
<p class="pwd-info">The password you'll use to login to Brosix.</p> | |
<div class="checkmark-info"> | |
<input type="checkbox" name="vehicle" value="check">* By clicking "I Agree" you accepted our <a href="https://www.brosix.com/privacy/">Terms of Services and Privacy Policy.</a></p> | |
</div> | |
<p><input class="btn btn-lg btn-primary" type="submit" value="<?php echo $lang_Button_Signup; ?>" /></p> | |
<input id="partner_id" type="hidden" name="partner_id" value="<?php echo $partnerID ?>" /> | |
<input id="return_url" type="hidden" name="return_url" value="<?php echo $returnUrl ?>" /> | |
</form> | |
<script>/*document.getElementById("network_name").focus();*/</script> | |
<?php | |
} | |
?> | |
<?php | |
if( isset( $errCode ) ) // A request has been processed. Let's see the response code. | |
{ | |
switch( $errCode ) | |
{ | |
case 1: // SUCCESS = 1, | |
// The message displayed to the user | |
unset( $msg ); | |
// Redirect to the ./confirm/ page | |
header('Location: /signup/confirm/' ); | |
break; | |
case 2: // ERROR_UNSPECIFIED = 2 | |
$msg = $lang_Error_Unspecified; | |
break; | |
case 3: // PARAMETER_MISSING = 3, // Required parameter missing | |
$msg = $lang_Error_ParameterMissing; | |
break; | |
case 4: // EMAIL_INVALID = 4, // Invalid email format | |
$msg = $lang_Error_EmailInvalid; | |
break; | |
case 5: // EMAIL_IN_USE = 5, // Email is used by another Account | |
$msg = $lang_Error_EmailInUse; | |
break; | |
case 6: // NOT_IDENTIFIED_PARTNER = 6, | |
$msg = $lang_Error_Partner; | |
break; | |
case 7: // Confirm email = 7, | |
$msg = $lang_Error_Confirm; | |
} // switch( $errCode ) | |
if( isset( $msg ) ) | |
{ | |
echo "<div id='errormessage'><p>"; | |
echo $msg; | |
echo "</p></div>"; | |
} | |
} | |
// Checkbox validation | |
if(isset($_POST['checkbox']) && $_POST['checkbox']!="") | |
{ | |
echo 'checkbox is checked'; | |
} | |
return ob_get_clean(); | |
} | |
add_shortcode('signup_page_form_new_add', 'signup_page_form_new'); | |
/*End of new signup form */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment