Modal on closing a page and can you add the bot check to the footer subscribe ?

5 replies · opened May 5, 2020

GGavinBaylisMay 5, 2020

Is it possible to load a modal on someone exiting the site / closing the page down ?

And in the footer we have the code below - is it possible to add the botcheck code to that as well due to Spam issues?

Many thanks

			

**Subscribe** to Our Newsletter for Family Office News & Topics

Subscribe
									
								
							
						
SSemicolon WebSTAFFMay 6, 2020

Hello,

  1. Unfortunately, this is currently not built in and will need significant customization for this to work correctly. So we will try including this in an Update.

  2. This is Possible. You can add the following HTML Code inside the <form> Tag:


&#x9;

and then the following code inside the include/subscribe.php File:


if( !empty( $_POST[&apos;widget-subscribe-form-botcheck&apos;] ) ) {
&#x9;echo &apos;{ "alert": "error", "message": "Bot Detected!" }&apos;;
&#x9;exit;
}

This will definitely work fine. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

GGavinBaylisMay 8, 2020

Hi there - please advise where exactly to put the botcheck code in the subscribe.php as I tried in a couple of places and the form did not work ?

 'domain.com', // Your Email Address
				'name' => 'Gavin Baylis' // Your Name
			);
		

// Form Processing Messages
$message_success = 'We have **successfully** received your Message and will get Back to you as soon as possible.';

$mail = new PHPMailer();

// If you intend you use SMTP, add your SMTP Code after this Line

if( isset( $_POST['widget-subscribe-form-email'] ) ) {
	if( $_POST['widget-subscribe-form-email'] != '' ) {

		$email = $_POST['widget-subscribe-form-email'];

		$subject = 'Subscribe me to the List';

		$mail->SetFrom( $email , 'New Subscriber' );
		$mail->AddReplyTo( $email );
		foreach( $toemails as $toemail ) {
			$mail->AddAddress( $toemail['email'] , $toemail['name'] );
		}
		$mail->Subject = $subject;

		$email = isset($email) ? "Email: $email

" : '';

		$referrer = $_SERVER['HTTP_REFERER'] ? '

This Form was submitted from: ' . $_SERVER['HTTP_REFERER'] : '';

		$body = "$email $referrer";

		$mail->MsgHTML( $body );
		$sendEmail = $mail->Send();

		if( $sendEmail == true ):
			echo '{ "alert": "success", "message": "' . $message_success . '" }';
		else:
			echo '{ "alert": "error", "message": "Email **could not** be sent due to some Unexpected Error. Please Try Again later.

**Reason:**
' . $mail->ErrorInfo . '" }';
		endif;
	} else {
		echo '{ "alert": "error", "message": "Please **Fill up** all the Fields and Try Again." }';
	}
} else {
	echo '{ "alert": "error", "message": "An **unexpected error** occured. Please Try Again later." }';
}

?>
SSemicolon WebSTAFFMay 8, 2020

Hello,

Just after this line of code:


if( $_POST['widget-subscribe-form-email'] != '' ) {

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

GGavinBaylisMay 15, 2020

Have tried that removing } in case it was that but did not work - this is the code

if( isset( $_POST['widget-subscribe-form-email'] ) ) {
	if( $_POST['widget-subscribe-form-email'] != '' ) {
	if( !empty( $_POST[&apos;widget-subscribe-form-botcheck&apos;] ) ) {
	echo &apos;{ "alert": "error", "message": "Bot Detected!" }&apos;;
	exit;
}

Also to help not recieving Spam - is it possible to add Company Name to the Subscribe form code in the Footer?

`<h4>Subscribe to Our Newsletter to get Important News about our Events:</h4>
<div class="widget-subscribe-form-result"></div>
<form id="widget-subscribe-form" action="include/footer-box.php" method="post" class="nobottommargin">
<div class="input-group divcenter">
<div class="input-group-prepend">
<div class="input-group-text"><i class="icon-email2"></i></div>
</div>
<input type="email" id="widget-subscribe-form-email" name="widget-subscribe-form-email" class="form-control required email" placeholder="Enter your Email">

<div class="hidden">
<input type="text" id="widget-subscribe-form-botcheck" name="widget-subscribe-form-botcheck" value="" class="form-control" />
</div>
<div class="input-group-append">
<button class="btn btn-success" type="submit">Subscribe</button>
</div>
</div>
</form>

SSemicolon WebSTAFFMay 16, 2020

Hello,

  1. Unfortunately, the PHP Codes appear to be incorrect. Please make sure that the PHP Codes are error-free for successful execution.

  2. This feature is currently not available within the Default Templates. We will surely consider adding this in Our Future Updates and will send you a Notification once this is available. Meanwhile, as we currently do not provide Customization related Support according to the Item Support Policy: https://themeforest.net/page/item_support_policy, you will need to manually code this or Hire a Freelancer to help you out.

Let us know if we can help you with anything else or if you find any further issues.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard