arustad
Forum Replies Created
-
Forum: Plugins
In reply to: [Contact Form 7] Any validation, or groupingOK, I think I got it
class testing{ function __construct(){ add_filter( 'wpcf7_validate', array($this,"example"), 20, 2 ); } private function example($result, $tags ) { foreach ( $tags as $tag ) { $tag = new WPCF7_Shortcode( $tag ); //tag stuff here } } return $result; } }
Forum: Plugins
In reply to: [Contact Form 7] Any validation, or groupingI know how to write validation for specific tags, I want one that applies to all tags that take options.
Maybe I am not seeing your point?
- This reply was modified 8 years, 5 months ago by arustad.
Forum: Fixing WordPress
In reply to: PDF, docx, zip… bombsIt would be ridiculous not to round it. Three significant figures is enough.
I got the (pdf) to work. But I still don’t know how to get the file size. But I honestly have not put much time into it, bigger fish to fry.
Forum: Fixing WordPress
In reply to: Test wp_nonce_fieldA plugin, it is for a multi-site, the form will hold a private key so I am trying to throw the book at it for security.
Forum: Fixing WordPress
In reply to: Test wp_nonce_fieldI understand what it is, I just do not know how to check if it is working correctly.
Forum: Fixing WordPress
In reply to: Roles in WordPress.
Forum: Fixing WordPress
In reply to: Roles in WordPressThanks got multi-site working.
I wish wordpress had a wrapper for the customizer so that super-admins could toggle what is site wide appearance and local. EG have a site wide header and main navigation bar. But per-site customization of the sidebar and branding.
I have been accomplishing that by almost rewriting the entire theme, and a bunch of plug ins. But it seems like more work than it should be.
Forum: Fixing WordPress
In reply to: Sem-anyonymous with captchaThanks for replying
I ended up using something like the following copy pasta. My boss wants a href mailto: only. He doesn’t want forms [I don’t understand either].
So on hitting the page, the page is like this.
[Captcha_Hide] Phone:123-4.. Email:[email protected] ... [/Captcha_Hide]
if ($_SESSION['timeout'] + 60*60 /*seconds*/ < time()) { // session timedout $_SESSION["AreYouHuman"] = false; } else { // session ok $_SESSION["timeout"] = time() ; } if(isset($_POST['submit']) && !empty($_POST['submit'])): if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])): //your site secret key $secret = 'Googles-Sectret'; //get verify response data $verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']); $responseData = json_decode($verifyResponse); if($responseData->success): //contact form submission code $_SESSION["AreYouHuman"] = true ; $_SESSION['timeout'] = time(); else: $errMsg = 'Robot verification failed, please try again.'; endif; else: $errMsg = 'Please click on the reCAPTCHA box.'; endif; else: $errMsg = ''; $succMsg = ''; endif; function AreYouHuman($atts,$content=null){ static $foo_count=0; $foo_count++; if ($_SESSION['AreYouHuman']==true){ return do_shortcode($content); } else{ if ($foo_count<>1){ return; }; echo '<script src="https://www.google.com/recaptcha/api.js" async defer> $(document).ready(function(){ document.getElementById("Submit").disabled = true; }); </script> <form id="recaptcha-email" action="" method="POST"> <div class="g-recaptcha" data-callback="enableBtn" data-sitekey="SiteSecret"></div> <input id="Submit" type="submit" name="submit" value="Continue"> </form>'; }; } add_shortcode("Captcha_Hide","AreYouHuman")