• I noticed that using Contact Form 7 with a Really Simple Captcha on the form placed on a SSL page attempts to load the image from a https:// only URL, triggering unsafe content notices in some browsers.

    This can be easily improved by editing the wpcf7_upload_dir() function in cf7/includes/functions.php to take SSL into account:

    function wpcf7_upload_dir( $type = false ) {
    	$uploads = wp_upload_dir();
    
    	$uploads = apply_filters( 'wpcf7_upload_dir', array(
    		'dir' => $uploads['basedir'],
    		'url' => $uploads['baseurl'] ) );
    
         // SSL mod
         if (is_ssl()):
             $uploads['url'] = str_replace("https://","https://",$uploads['url']);
         endif;
         // end SSL mod
    
    	if ( 'dir' == $type )
    		return $uploads['dir'];
    	if ( 'url' == $type )
    		return $uploads['url'];
    
    	return $uploads;
    }

    I’m sure this can be done better or safer, but this worked for me.

    https://www.ads-software.com/plugins/contact-form-7/

Viewing 1 replies (of 1 total)
  • Here is a different method that worked for me. See the following post for the source of this solution.

    https://www.ads-software.com/support/topic/wp_content_url-based-defines-do-not-work-over-ssl-https

    Essentially, I edited wp-includes/default-constants.php and changed the wp_plugin_directory_constants function as follows:

    function wp_plugin_directory_constants( ) {
    /**
            if ( !defined('WP_CONTENT_URL') )
                    define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up
    **/
            if ( !defined('WP_CONTENT_URL') )
                    define( 'WP_CONTENT_URL', site_url( 'wp-content') ); // full url - WP_CONTENT_DIR is define with https or http per connection

    Hopefully this will be helpful to others.

Viewing 1 replies (of 1 total)
  • The topic ‘CF7 / Really Simple Captha and HTTPS/SSL’ is closed to new replies.