Wordpress - [FIX] function wpscf_my_shortcode_head()
First unread post • 3 posts
• Page 1 of 1
Wordpress - [FIX] function wpscf_my_shortcode_head()
Hi friend,
i found a fix for your function wpscf_my_shortcode_head().
File: sexy-contact-form/includes/display-functions.php
Line: 12
Change from:
to:
This fix allow to prevent an error stops if the array $matches won't have three items.
i found a fix for your function wpscf_my_shortcode_head().
File: sexy-contact-form/includes/display-functions.php
Line: 12
Change from:
- Code: Select all
if (is_array($matches) && $matches[2] == 'sexyform') {
to:
- Code: Select all
if (is_array($matches) && isset($matches[2]) && $matches[2] == 'sexyform') {
This fix allow to prevent an error stops if the array $matches won't have three items.
- masterix21
- Posts: 12
- Joined: Wed Oct 02, 2013 10:09 pm
Re: Wordpress - [FIX] function wpscf_my_shortcode_head()
I found another problem when the page requested doesn't exist.
These are the changes that i applied to the file display-functions.php:
These are the changes that i applied to the file display-functions.php:
- Code: Select all
function wpscf_my_shortcode_head(){
global $posts;
global $wpscf_token;
if (!is_array($posts) || !isset($posts[0]))
return;
$pattern = get_shortcode_regex();
preg_match('/(\[(sexyform) id="([0-9]+)"\])/s', $posts[0]->post_content, $matches);
if (is_array($matches) && isset($matches[2]) && $matches[2] == 'sexyform') {
$form_id = (int) $matches[3];
wpscf_enqueue_front_scripts($form_id);
//set token
$wpscf_token = md5(time() * rand(1000,9999));
$_SESSION['sexycontactform_token'] = $wpscf_token;
}
}
- masterix21
- Posts: 12
- Joined: Wed Oct 02, 2013 10:09 pm
Re: Wordpress - [FIX] function wpscf_my_shortcode_head()
Thanks for your help to make Sexy Contact Form better.
-
Simon - Site Admin
- Posts: 1306
- Joined: Wed Jul 13, 2011 8:53 pm
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest