Code

Discussion on Opt-In Downloads - WordPress Plugin

Discussion on Opt-In Downloads - WordPress Plugin

4.51 (79 ratings) 4.51 stars
Cart 1,338 sales

halfdata supports this item

Supported

289 comments found.

I changed it so that only these domains are accepted, if trying with a temporary email is not allowed.

136

In my Child theme have…


- mycustom.js
- functions.php
- mycustom.css

mycustom.js

jQuery(document).on("keyup", ".opd-container input[name='email']", function (event) { var error_msg = '<div class="err_msg" style="color: red;border: 1px solid red;padding: 5px;">O endereço de email que indicou não é permitido!</div>'; jQuery('.opd-container .opd-message').html(''); jQuery('.opd-container .opd-submit').removeClass('allow_btn'); jQuery('.custom_spin').remove(); var current_ele = jQuery(this); var email = current_ele.val(); if(email){ if(validateEmail(email)){ jQuery('.opd-container .opd-submit').parent().append('<i class="fas fa-spinner fa-spin custom_spin" />'); jQuery.ajax({ url: ajax_url, aysnc: false, type: 'post', data: { 'action': 'check_valid_emails', 'email': email, }, success: function (data) { console.log(data); var data = JSON.parse(data); if(data.status == "valid"){ jQuery('.opd-container .opd-submit').addClass('allow_btn'); jQuery('.opd-container .opd-message').html(''); } else { jQuery('.opd-container .opd-submit').removeClass('allow_btn'); jQuery('.opd-container .opd-message').html(error_msg); } jQuery('.custom_spin').hide(); }, error: function (errorThrown) { console.log(errorThrown); } }); } else { jQuery('.opd-container .opd-submit').removeClass('allow_btn'); jQuery('.opd-container .opd-message').html(''); } } else { jQuery('.opd-container .opd-submit').removeClass('allow_btn'); jQuery('.opd-container .opd-message').html(''); } }); function validateEmail(email) { const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(String(email).toLowerCase()); }

functions.php

<?php add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' ); function my_theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'mycustom', get_stylesheet_directory_uri() . '/css/mycustom.css' ); wp_enqueue_script( 'mycustom', get_stylesheet_directory_uri().'/js/mycustom.js', array('jquery'), false, true ); } add_action('wp_ajax_check_valid_emails', 'check_valid_emails'); add_action('wp_ajax_nopriv_check_valid_emails', 'check_valid_emails'); function check_valid_emails() { $result_arr = []; $email = isset($_POST['email']) ? $_POST['email'] : ''; if($email){ $valid_email_domains = array("gmail.com", "hotmail.com", "outlook.pt", "outlook.com", "yahoo.com", "sapo.pt", "live.com.pt", "msn.com", "netcabo.pt", "portugalmail.com", "portugalmail.pt", "live.com", "netmadeira.com", "protonmail.com", "yandex.com"); $valid = false; foreach( $valid_email_domains as $d ){ $d_length = strlen( $d ); $current_email_domain = strtolower( substr( $email, -($d_length), $d_length)); if( $current_email_domain == strtolower($d) ){ $valid = true; break; } } // Return error message for invalid domains if( $valid === false ){ $result_arr['status'] = 'invalid'; } else { $result_arr['status'] = 'valid'; } } print_r(json_encode($result_arr)); exit; } ?>

mycustom.css

/*-------------------------------------------------------------- ## Download Plugin --------------------------------------------------------------*/ .opd-container .opd-submit{pointer-events: none; opacity: 0.7;} .opd-container .opd-submit.allow_btn{pointer-events: auto; opacity: 1;} .loading { height: 0; width: 0; padding: 15px; border: 6px solid #ccc; border-right-color: #888; border-radius: 60px; -webkit-animation: rotate 1s infinite linear; /* left, top and position just for the demo! */ position: absolute; left: 50%; top: 50%; } @-webkit-keyframes rotate { /* 100% keyframe for clockwise. use 0% instead for anticlockwise */ 100% { -webkit-transform: rotate(360deg); } }

Hi, I have a pre-sales question. I have a 50MB file but I can only upload 32MB max at a time. It is possible for the subscriber to download two files?

Hi. Unfortunately, no.

OrkmesB

OrkmesB Purchased

Hello,

I purchased this plugin as it is compatible with mailster. To download the file, a mailster subscription is sent to the e-mail address, but the download link is not provided. I look forward to your support to fix this problem.

Thanks & Best Regards,

Please provide access to WP dashboard and URL of the page where I can see the form. I’ll check what’s wrong.

OrkmesB

OrkmesB Purchased

I’ve sent you a message

OK. Here I go again. What is the process for embedding the forms into an external website? All I am seeing is a shortcode and a download url. Does that download url automatically generate a download or something?

You use it with Halfdata Admin Panel. Right? In your admin panel please go to “How To Use” page. It explains how to use the script.

Is it possible to use a different form style for this? These are not very attractive at all. And again the documentation for embedding them on a website is very vague and incomplete. An example is rounded corners in fields and in Boxes. These are very sharp and I am not seeing any way to rouns corners or create attractive forms.

Thanks for details. Please also send me your GetResponse key.

It will be in your email in 2 minutes

Thanks. Seems GetResponse updated their API. I’ve already included the fix into script/plugin. You can download new version from CodeCanyon.

Hi, Im looking for a plugin where I can generate multiple links to download in a website section, I have a place with links download in my website but I need to have also name, mail and phone. Can I do this with your plugin? And is possible to show the links in my website? (dont send in a mail) Thanks

Unfortunately, there is no such feature.

Thanks for letting me know. I’ll check and inclide into todo list.

Hello!

Is it compatible with Polylang?

Unfortunately, I’m not familiar with this plugin.

eiffel04

eiffel04 Purchased

Hello ! Since yesterday, i’ve got an AJAX error when i try to click the submit button form (I looked at the Dev console ):

d7c68.js:102 Uncaught TypeError: Cannot read property ‘ajax-url’ of undefined

And the more detailed part of the code where problem occurs :

jQuery.ajax({
      url: opd_vars["ajax-url"],
      data: form_data,
      method: (opd_vars["mode"]  "remote" ? "get" : "post"),
      dataType: (opd_vars["mode"]  "remote" ? "jsonp" : "json"),
      async: true,
      success: function(return_data)

Maybe something change in AJAX libraries ?

Thanks ;)

Nothing changed. Looks like you combined js files and included inline js into file. And fid incorrectly.

by
by
by
by
by
by