Forum Replies Created

Viewing 15 replies - 31 through 45 (of 187 total)
  • Thread Starter solosails

    (@solosails)

    Yep – definitely page cache is the culprit.

    Makes no difference if I have disk basic or disk enhanced enabled, WP only prints live IP results with page cache turned off.

    Thread Starter solosails

    (@solosails)

    Ah, I can see there is this option which seems a likely culprit, but it is unchecked and greyed out!???

    Reject HEAD requests: Disable caching of HEAD HTTP requests
    If disabled, HEAD requests can often be cached resulting in “empty pages” being returned for subsequent requests for a URL.

    Thread Starter solosails

    (@solosails)

    I think I’ve discovered the problem area, I switched off page cache and the Client IP’s are now live for every change of IP address …

    So,…. what to add or change in W3 Total Cache settings for page cache to ensure client IP addresses don’t get cached?

    If anyone can solve this, I’ll buy them a virtual pint! Thanks!

    Thread Starter solosails

    (@solosails)

    Hi Kimberly,

    I tried putting your code in the theme’s functions and removing my code from the wp-config –

    refreshed the total cache and I did indeed get the correct IP, HOWEVER, I then restarted my router to get a new IP assigned from my ISP, which was fine, but on my website I’m still seeing the previous IP as if it were cached…?

    IE it is not updating with a new client IP, it’s just reporting the last one that successfully was registered?

    Thread Starter solosails

    (@solosails)

    Hi Kimberly,

    Thanks for taking the time to look at this –

    I haven’t tried entering it as a filter, will give this a go and see if it can fix it

    RE it being Gravity forms, I don’t think this is the case as I did a test on a non Gravity forms page using this php code and still get the same incorrect IP address

    <?php
    
    function getIp() {
    
     $ip = $_SERVER['REMOTE_ADDR'];
    
     if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
    
     $ip = $_SERVER['HTTP_CLIENT_IP'];
    
     } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    
     $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    
     }
    
     return $ip;
    }
    $ip = getIp();
    
    $ip2 = $HTTP_SERVER_VARS['HTTP_X_CLUSTER_CLIENT_IP']; 
    
    echo $ip;
    print "</br>";
    echo $ip2;
    $ip3 = $_SERVER['REMOTE_ADDR'];
    $ip4 = $_SERVER['HTTP_X_FORWARDED_FOR'];
    $ip5 = $_SERVER['HTTP_VIA'];
    $ip6 = $_SERVER['HTTP_CLIENT_IP'];
    echo $ip3;
    print "</br>";
    print "IP4 is $ip4";
    print "</br>";
    print "IP5 is $ip5";
    print "</br>";
    print "IP6 is $ip6";
    print "</br>";
    
    ?>

    (however, I did a test with this code on a page outside of wordpress and it works fine) you can see this working correctly here …

    https://www.solosails.com/test.php

    I’ll give your suggestion a go and see if it works!

    Thread Starter solosails

    (@solosails)

    Any ideas about this one – I’m really keen to get this working and have tried everything I can to no avail – just currently it seems to be stuck on the site host’s server IP as the Client IP which is obviously wrong.

    Thanks in advance for any help here.

    Thread Starter solosails

    (@solosails)

    I note that my security software gets the correct ip addresses using x-forwarded-for , yet the gravity forms which uses the standard

    $_SERVER['REMOTE_ADDR'];

    seems to be getting the wrong results.

    I have tried entering the following into my wp-config file, as it seemed to be the most logical approach, but still no joy…

    if ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] )
         && preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/',
                         $_SERVER['HTTP_X_FORWARDED_FOR'] ) )
            $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];

    I am not sure if it is the CDN or The caching settings that cause the issue. either way, it would be great to get to the bottom of it as my limited knowledge has come to a dead end.

    Thanks.

    Thread Starter solosails

    (@solosails)

    Perfect, thanks Jason

    We have been seeing this for months now, have tried the heartbeat plugin, as well as alternative ajax methods, but still seeing this ajax call as the biggest drain and page complete problem on our site

    Thread Starter solosails

    (@solosails)

    If you would like to show the time data in the shop category and tag etc pages under each image, as well as in the single product image, you can add the following to your functions.php …

    // Add custom field to shop loop
    
    add_action( 'woocommerce_after_shop_loop_item_title', 'ins_woocommerce_product_excerpt', 1, 2);  
    
    if (!function_exists('ins_woocommerce_product_excerpt'))
    {
    function ins_woocommerce_product_excerpt() {
    global $post;
    if ( is_home() || is_shop() || is_product_category() || is_product_tag() ) {
    echo '<span class="excerpt">';
    echo "Taken : ", get_post_meta( $post->ID, 'ss_exif_DateTimeOriginal', true );
    echo '</span>';
    }
    }
    }
    
    // Add Time taken to single product page 
    
    add_action( 'woocommerce_single_product_summary', 'add_custom_field', 5, 2 );
    
    function add_custom_field() {
        global $post;
    
        echo "Taken : ", get_post_meta( $post->ID, 'ss_exif_DateTimeOriginal', true );
    
        return true;
    }
    Thread Starter solosails

    (@solosails)

    This is an update on the progress of this thread which I’m pleased to say through the excellent support of the Symbiostock team, we now have fully functioning!

    The following might help others wishing to also add the ability to sort by EXIF time/date taken in the woocommrece front end.

    The first step is to assign the required EXIF data in Symbiostock settings (a new feature) …

    go to – symbiostock/settings/Read Extra Metadata

    Add >> “DateTimeOriginal” [without Quotes]

    This will add the “ss_exif_DateTimeOriginal” meta and corresponding EXIF date/time value as a custom meta entry for every new image product uploaded.

    (If you need to apply this to all of your previous image products, check the box “Force Reading of Extra Metadata” which will add the new meta data automatically to 1000 images per day in your back catalogue. (remember to de-select this once all images have been updated))

    Next you need to add the following code to your active theme’s functions.php …

    * Adds WooCommerce catalog sorting options using postmeta, such as custom fields
     **/
    function symbiostock_add_postmeta_ordering_args( $sort_args ) {
    
    	$orderby_value = isset( $_GET['orderby'] ) ? wc_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
    	switch( $orderby_value ) {
    
    		// Name your sortby key whatever you'd like; must correspond to the $sortby in the next function
    
    		case 'File-Time-Asc':
    			$sort_args['orderby']  = 'meta_value';
    			// Sort by meta_value because we're using alphabetic sorting
    			$sort_args['order']    = 'asc';
    			$sort_args['meta_key'] = 'ss_exif_DateTimeOriginal';
    			// use the meta key you've set for your custom field, i.e., something like "ss_exif_DateTimeOriginal"
    			break;
    
    		case 'File-Time-Desc':
    			$sort_args['orderby'] = 'meta_value';
    			// We use meta_value_num here because points are a number and we want to sort in numerical order
    			$sort_args['order'] = 'desc';
    			$sort_args['meta_key'] = 'ss_exif_DateTimeOriginal';
    			break;
    
    	}
    
    	return $sort_args;
    }
    add_filter( 'woocommerce_get_catalog_ordering_args', 'symbiostock_add_postmeta_ordering_args' );
    // Add these new sorting arguments to the sortby options on the frontend
    function symbiostock_add_new_postmeta_orderby( $sortby ) {
    
    	// Adjust the text as desired
    	$sortby['File-Time-Asc'] = __( 'Sort by: Time Taken Asc', 'woocommerce' );
    	$sortby['File-Time-Desc'] = __( 'Sort by: Time Taken Desc', 'woocommerce' );
    
    	return $sortby;
    }
    add_filter( 'woocommerce_default_catalog_orderby_options', 'symbiostock_add_new_postmeta_orderby' );
    add_filter( 'woocommerce_catalog_orderby', 'symbiostock_add_new_postmeta_orderby' );

    That’s it! You should now have two new options in the woocommerce’s ‘sort by’ drop down box allowing you to sort images by EXIF time taken in ascending and descending order.

    You can modify these setting as you like to order by any of the EXIF values that your camera may output (and hasn’t been stripped by any editing software).

    Of course we immediately found out subsequently that one of our photographers had his camera’s date set to a previous year, which totally screws up the whole principle! so that is a lesson learned – make sure your camera’s setting are up to date!

    Hope this helps other users – Thanks again to the Symbiostock team for their awesome support and speedy implementation of this function.

    Thread Starter solosails

    (@solosails)

    Hi Kristarella,

    Thanks for the reply, I am not a coder by any means, I have some very rudimentary understanding of PHP just through my own tinkering over the last couple of years.

    I did find this on-line which might be a start…

    <?php wp_get_attachment_metadata( $attachment_id, $unfiltered ); ?>

    but I don’t know how to parse that into the post as a new custom field which could then be called on for list order …

    Cheers, Andrew

    Thread Starter solosails

    (@solosails)

    Hi there,

    Thanks for speedy response once again.

    So, at present you cannot create a Symbiostock ‘License’ that allows a non downloadable product variation that could be a physical order yet? … This has to be added manually inside the individual ‘product’ — Is this correct?

    Also on a similar vein, in the front end is there a way to set a default licence option for all products, rather than having the ‘Chose an option’ as the first option.

    (IE when the customer visits the ‘product’, there is already a license selected rather than a chose option notice)

    Many thanks!

    Hi there,

    Thanks for clarifying this, it was your point that it was going to run multiple instances that was worrying me, so thanks for clarifying this!

    On this subject, I added the entire cron line to a cron job on my Cpanel server to automate this.

    Am I correct in adding the entire cron line as shown in the Symbiostock settings?

    I have also requested that it runs every minute in Cpanel, but I dont know if the whole string pasted in already tells the server to run it anyway?

    Thanks.

Viewing 15 replies - 31 through 45 (of 187 total)