   <div id="login_shortcode_popup" style="display:block;" class="popup_div_outer">

    <div class="live-links-outer" id="login_shortcode_popup_inner">
    <div class="container login_shortcode_popup_in" id="memberpages_shortcode_popup_button">
     <h3 class="mb-4 border-bottom pb-2"><i class="fa fa-users" aria-hidden="true"></i> Member Login 
      <a href="<?= admin_url('admin.php?page=dap_memberpages'); ?>" title="Back to Member Pages" class="member_backicon">Return to Member Pages</a></h3>
 
 
		<table width="100%" cellpadding="2" cellspacing="2" class="table-outer">
			
		<tr class="table-outer">	 
			<td valign="middle" width="100%" style="padding-bottom:0;">
				<table width="100%" cellpadding="2" cellspacing="2">
					<tr class="my_content_heading">
						<th> Template Options </th>
						<th>&nbsp;</th>
					</tr>
					<tr>
						<td>Sidebar or Page Template?</td>
						<td valign="middle" width="50%">
							<select style="" name="selecttemp" id="selecttemp" style=" width: 55% !important;">
							<option value="seltemplate1" selected="selected">Page Template</option>
							<option value="seltemplate2">Sidebar Template</option>
							</select>
						</td>
					</tr>
					 <tr id="pagetemplate" class="template_box">  
						<td>Select a Page Template</td>
						<td valign="middle" width="50%">
							<select style="" name="selectpagetemplate" id="selectpagetemplate" style=" width: 55% !important;">
							<option value="template1">Template1</option>
							<option value="template2">Template2</option>
							<option value="template3">Template3</option>
							<option value="template4">Template4</option>
							<option value="template5" selected="selected">Template5</option>
							<option value="template6">Template6</option>
							</select>
						</td>
					</tr>
					 <tr id="sidebartemplate" class="template_box">  
					<td>Select a Sidebar Page Template </td>
						<td valign="middle" width="50%">
							<select style="" name="selectsidebarpagetemplate" id="selectsidebarpagetemplate" style=" width: 55% !important;">
							<option value="sidebar1" selected="selected">Sidebar template1</option>
							<option value="sidebar2">Sidebar template2</option>
							</select>
						</td>
					</tr>
					
				<tr>  
					<td>Post Login URL </td>
						<td valign="middle" width="50%">
					 
							<input type="url" value="" class="redirect_url"  name="redirect" id="redirect"  />							 
						</td>
					</tr>
				</table>
			</td>
		</tr>
		
		<tr class="table-outer forgot-password-div">	 
			<td valign="middle" width="100%" style="padding-bottom:0;">
				<table width="100%" cellpadding="2" cellspacing="2">
					<tr class="my_content_heading">
						<th> Forgot Password Options </th>
						<th>&nbsp;</th>
					</tr>
					<tr>
						<td>Forgot Password on Login Form</td>
						<td valign="middle" width="50%">
							<input type="text" value="Forgot Password?" class="forgot_pass_loginform"  name="forgotpasswordtext" id="forgotpasswordtext"  />	
						</td>
					</tr>
					<tr>
						<td>Forgot Password Heading</td>
						<td valign="middle" width="50%">
							<input type="text" value="Forgot Your Password?" class="forgot_pass_heading"  name="forgotpasswordheading" id="forgotpasswordheading"  />	
						</td>
					</tr>
					<tr>
						<td>Forgot Password Subheading</td>
						<td valign="middle" width="50%">
							<input type="text" value="Enter your email address below and we'll send you a link to reset your password." class="forgot_pass_subheading"  name="forgotpasswordsubheading" id="forgotpasswordsubheading"  />	
						</td>
					</tr>
					<tr>
						<td>Forgot Password Email Placeholder</td>
						<td valign="middle" width="50%">
							<input type="text" value="Email Address" class="forgot_pass_emailplaceh"  name="forgotpasswordemailplaceholder" id="forgotpasswordemailplaceholder"  />	
						</td>
					</tr>
					<tr>
						<td>Send Reset Link Button Text</td>
						<td valign="middle" width="50%">
							<input type="text" value="Send reset link" class="forgot_pass_btntext"  name="forgotpasswordbtntext" id="forgotpasswordbtntext"  />	
						</td>
					</tr>
					<tr>   
						<td>Send Reset Link Button Background</td>
						<td valign="middle" width="50%">
							<div id="forgotpass_btnbg_div" class="input-group colorpicker-component input-group-outer">
							<input type="text" value="#66b14c" id="forgotpasswordbtnbg" class="forgot_pass_btnbg"  name="forgotpasswordbtnbg"  />
							<span class="input-group-addon "><i></i></span>
							</div>							 
					
						</td>
					</tr>
					<tr>
						<td>Forgot Password Email Missing Message</td>
						<td valign="middle" width="50%">
							<input type="text" value="Sorry, no user found with the email address." class="forgot_pass_missingemail"  name="forgotpasswordmissingemail" id="forgotpasswordmissingemail"  />	
						</td>
					</tr>
					<tr>
						<td>Forgot Password Link Sent Message</td>
						<td valign="middle" width="50%">
							<input type="text" value="Please check your email shortly for a link to reset your password." class="forgot_pass_linksent"  name="forgotpasswordlinksent" id="forgotpasswordlinksent"  />	
						</td>
					</tr>
					
				</table>
			</td>
		</tr>
		
		<tr class="table-outer reset-password-div">	 
			<td valign="middle" width="100%" style="padding-bottom:0;">
				<table width="100%" cellpadding="2" cellspacing="2">
					<tr class="my_content_heading">
						<th> Reset Password Options </th>
						<th>&nbsp;</th>
					</tr>
					<tr>
						<td>Reset Password Heading</td>
						<td valign="middle" width="50%">
							<input type="text" value="Reset Your Password" class="reset_pass_heading"  name="resetpasswordheading" id="resetpasswordheading"  />	
						</td>
					</tr>
					
					<tr>
						<td>New Password Placeholder</td>
						<td valign="middle" width="50%">
							<input type="text" value="Enter New Password" class="reset_pass_placeh"  name="resetpasswordplaceholder" id="resetpasswordplaceholder"  />	
						</td>
					</tr>
					<tr>
						<td>Re-Enter New Password Placeholder</td>
						<td valign="middle" width="50%">
							<input type="text" value="Re-Enter Password" class="re_reset_pass_placeh"  name="reresetpasswordplaceholder" id="reresetpasswordplaceholder"  />	
						</td>
					</tr>
					<tr>
						<td>Reset Password Button Text</td>
						<td valign="middle" width="50%">
							<input type="text" value="Reset Password" class="reset_pass_btntext"  name="resetpasswordbtntext" id="resetpasswordbtntext"  />	
						</td>
					</tr>
					<tr>   
						<td>Reset Password Button Background</td>
						<td valign="middle" width="50%">
							<div id="resetpass_btnbg_div" class="input-group colorpicker-component input-group-outer">
							<input type="text" value="#66b14c" id="resetpasswordbtnbg" class="reset_pass_btnbg"  name="resetpasswordbtnbg"  />
							<span class="input-group-addon "><i></i></span>
							</div>							 
					
						</td>
					</tr>
					<tr>
						<td>Reset Password success Message</td>
						<td valign="middle" width="50%">
							<input type="text" value="Your Password has been reset." class="reset_pass_success"  name="resetpasswordsuccess" id="resetpasswordsuccess"  />	
						</td>
					</tr>
				</table>
			</td>
		</tr>


		<tr class="table-outer captcha-outer-div">	 
			<td valign="middle" width="100%" style="padding-bottom:0;">
				<table width="100%" cellpadding="2" cellspacing="2">
					<tr class="my_content_heading">
						<th> Show/Hide Captcha </th>
					</tr>
					<tr>
						<td>Do you want to show captcha? <div class="tool-tip">
                      <i class="fa fa-info-circle" aria-hidden="true">
                      </i>
                      <div class="toll-tip-desc">Be sure to set Google ReCaptcha Key in DAP setup >> config page >> <a href="%%GOOGLESECTIONDAP%%" target="_blank">google section</a> . <a href="//www.google.com/recaptcha/admin" target="_blank">Click here for more details </a> on how to get the Google keys.
                    </div> </div></td>
						<td valign="middle" width="50%">
							<select  name="showcaptcha" id="showcaptcha" style="">
								<option value="no" selected="selected">No</option>
								<option value="yes">Yes</option>
							</select>	
						</td>
					</tr>
					
				</table>
			</td>
		</tr>
		
		<tr class="table-outer captcha-outer-div">	 
			<td valign="middle" width="100%" style="padding-bottom:0;">
				<table width="100%" cellpadding="2" cellspacing="2">
					<tr class="my_content_heading">
						<th> GDPR Settings</th>
					</tr>
					<tr>
						<td>Do you want to enable GDPR checks?
						</td>
						<td valign="middle" width="50%">
							<select  name="gdprenabled" id="gdprenabled" style="">
								<option value="">Select</option>
								<option value="Y">Yes</option>
								<option value="N">No</option>
							</select>	
						</td>
					</tr>
					
				</table>
			</td>
		</tr>
		
		<tr class="table-outer captcha-outer-div gdpr_redirect_url" style="display:none;">	 
			<td valign="middle" width="100%" style="padding-bottom:0;">
				<table width="100%" cellpadding="2" cellspacing="2">
					<tr>
						<td>Enter GDPR Redirect URL<div class="tool-tip">
                      <i class="fa fa-info-circle" aria-hidden="true">
                      </i>
                      <div class="toll-tip-desc"> This rule will ONLY be applied to users from GDPR countries.  It will NOT be applied to other users. If a GDPR users tries to login, DAP will check if the user has accepted or declined GDPR terms. If they have not done either, then you can enter a REDIRECT url here.  These users will be sent to that page first and will have to accept or reject terms to proceed further.You can create a "My Profile" page with GDPR terms and set that as the GDPR redirect page.
                    </div> </div></td>
						<td valign="middle" width="50%">
							<input type="url" id="gdprredirecturl" name="gdprredirecturl">
						</td>
					</tr>
					
				</table>
			</td>
		</tr>
	
	</table>
		  <div class="shortcode_container" style="display:none;">  
			   <h5>Here is the DAP Login Shortcode</h5>
			 <textarea> </textarea>
		  </div>  
        
		<div align="center" class="btn_outer"><a href="<?= admin_url('admin.php?page=dap_memberpages'); ?>"><button class="button-primary back-btn" id="backbtn">Back</button> </a>
 		  <button class="button-primary next-btn" id="myloginbtn">Generate Shortcode</button></div>     
   			 
    	</div> 
</div> 
</div>
 
<script>

jQuery('#myloginbtn').on('click',function() {

	var selOption = window.Var4;
	
	if(selOption === undefined || selOption === null || selOption === "") {
		 var template = "template5";
	}else{
		var template = window.Var4;
	}

	var myLandingPage = jQuery('input#redirect').val();
	var forgotPasswordHeading = jQuery('.forgot_pass_heading').val();
	var forgotPasswordSubHeading = jQuery('.forgot_pass_subheading').val();
	var forgotPasswordEmailPlaceholder = jQuery('.forgot_pass_emailplaceh').val();
	var forgotPasswordBtnText = jQuery('.forgot_pass_btntext').val();
	var forgotPasswordBtnbg = jQuery('.forgot_pass_btnbg').val();
	var forgotPasswordMissingEmail = jQuery('.forgot_pass_missingemail').val();
	var forgotPasswordLinkSent = jQuery('.forgot_pass_linksent').val();
	var resetPasswordHeading = jQuery('.reset_pass_heading').val();
	var resetPasswordPlaceholder = jQuery('.reset_pass_placeh').val();
	var reresetPasswordPlaceholder = jQuery('.re_reset_pass_placeh').val();
	var resetPasswordBtnText = jQuery('.reset_pass_btntext').val();
	var resetPasswordBtnbg = jQuery('.reset_pass_btnbg').val();
	var resetPasswordSuccess = jQuery('.reset_pass_success').val();
	var showCaptcha = jQuery('#showcaptcha').val();
	var gdprenabled = jQuery('#gdprenabled').val();
	var gdprredirecturl = jQuery('#gdprredirecturl').val();
	var forgotpasswordtext = jQuery('#forgotpasswordtext').val();
	
	
	if(gdprenabled == ''){
		alert('Please select a GDPR option');
		return false;
	}
	
	if(gdprenabled == 'Y' && gdprredirecturl == ''){
		alert('Please enter GDPR redirect URL to proceed.');
		return false;
	}
	
	if(gdprredirecturl != ''){
		if(ValidinputURL(gdprredirecturl) == false){
			return false;
		}
	}
	
 
	var shortcode = '[DAPLoginForm template="'+template+'" forgotPasswordHeading="'+forgotPasswordHeading+'"  forgotPasswordSubHeading="'+forgotPasswordSubHeading+'" forgotPasswordEmailPlaceholder="'+forgotPasswordEmailPlaceholder+'" forgotPasswordBtnText="'+forgotPasswordBtnText+'" forgotPasswordBtnbg="'+forgotPasswordBtnbg+'" forgotPasswordMissingEmail="'+forgotPasswordMissingEmail+'" forgotPasswordLinkSent="'+forgotPasswordLinkSent+'"  resetPasswordHeading="'+resetPasswordHeading+'" resetPasswordPlaceholder="'+resetPasswordPlaceholder+'" reresetPasswordPlaceholder="'+reresetPasswordPlaceholder+'" resetPasswordBtnText="'+resetPasswordBtnText+'" resetPasswordBtnbg="'+resetPasswordBtnbg+'" resetPasswordSuccess="'+resetPasswordSuccess+'" showCaptcha="'+showCaptcha+'" gdprEnabled="'+gdprenabled+'" gdprRedirectURL="'+gdprredirecturl+'"   forgotPasswordText="'+forgotpasswordtext+'"' ;
	 
	if(myLandingPage != ""){
		shortcode = shortcode + ' redirect="'+myLandingPage+'"]';
	}else{
		shortcode = shortcode +']';
	}
	jQuery('.shortcode_container').show();
	jQuery('.shortcode_container textarea').html(shortcode);
});
jQuery(function() {	
	
	    jQuery('#resetpass_btnbg_div').colorpicker();
        jQuery('#forgotpass_btnbg_div').colorpicker();
        
	/*for gdpr option in memeber login*/
	jQuery('#gdprenabled').click(function(){
		if(jQuery(this).val() == 'Y'){
			jQuery('.gdpr_redirect_url').show();
		}else{
			jQuery('.gdpr_redirect_url').hide();
		}
	})
	
	jQuery('#sidebartemplate').hide();
	var selOption = jQuery('select[name="selectpagetemplate"] option:selected').val();

	 
	jQuery('.reset-password-div').show();
	jQuery('.forgot-password-div').show();
	 
	window.Var4 = selOption;
	jQuery('select[name="selectpagetemplate"]').on('change',function() {
		var selOption = jQuery('select[name="selectpagetemplate"] option:selected').val();
		jQuery('.reset-password-div').show();
		jQuery('.forgot-password-div').show();
		window.Var4 = selOption;
	});
	jQuery('#selecttemp').on('change',function() {
		var selectdrop = jQuery('select#selecttemp option:selected').val();
		if(selectdrop == "seltemplate1"){
			jQuery('#sidebartemplate').hide();
			jQuery('#pagetemplate').show();
	
			var selOption = jQuery('select[name="selectpagetemplate"] option:selected').val();
			jQuery('.reset-password-div').show();
			jQuery('.forgot-password-div').show();
			window.Var4 = selOption;
			jQuery('select[name="selectpagetemplate"]').on('change',function() {
				var selOption = jQuery('select[name="selectpagetemplate"] option:selected').val();
				jQuery('.reset-password-div').show();
			    jQuery('.forgot-password-div').show();
				window.Var4 = selOption;
			});
		}else{
			jQuery('#pagetemplate').hide();		 
			jQuery('#sidebartemplate').show();
			jQuery('.reset-password-div').show();
			jQuery('.forgot-password-div').show();
			var selOption = jQuery('select[name="selectsidebarpagetemplate"] option:selected').val();
			window.Var4 = selOption;
			jQuery('select[name="selectsidebarpagetemplate"]').on('change',function() {
				var selOption = jQuery('select[name="selectsidebarpagetemplate"] option:selected').val();
				window.Var4 = selOption;
			});
		}
	});	
});	
    
function ValidinputURL(input_val) {
	var pattern = new RegExp("^(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&amp;%\$\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&amp;%\$#\=~_\-]+))*$");
	if (!pattern.test(input_val)) {
		alert("Please enter a valid URL.");
		return false;
	} else {
		return true;
	}
}    
</script>

<?php
  

/******* get template  ********/    
function getDripTemplateDAPLoginFormContent($template_path, $courseTemplateName, $customCourseTemplateName)
{
	
	if(file_exists($template_path.$customCourseTemplateName)) {
	  $course_temp_content = file_get_contents($template_path.$customCourseTemplateName);
	}
	
	if($course_temp_content == "") {
		if(file_exists($template_path.$courseTemplateName)) {
			$course_temp_content = file_get_contents($template_path.$courseTemplateName);
		}
		else{
			$course_temp_content = "";
		}
	  
		logToFile("DAP-Loginform: no custom template found=".$template_path.$courseTemplateName,LOG_INFO_DAP);
	} else {
		logToFile("DAP-Loginform: custom template found=".$template_path.$customCourseTemplateName,LOG_INFO_DAP);  
	}	
	
	return $course_temp_content; 
	
}
 

?>
