WordPress.org

Support

Support » Plugins and Hacks » W3 Total Cache » Mfunc Not Working

Mfunc Not Working

  • After the upgrade my mfunc stop working properly.

    I am using APC to cache pages and MEMCACHE to cache database and object cache.

    <!-- mfunc 
    
    $ref=getenv('HTTP_REFERER');
    if (strpos($ref,'www.google.com')>0)
    {
        echo 'hello google';
    
    }
    else if (strpos($ref, 'bing.com')>0)
    {
    	echo "hello bing";
    }
    else
    {
        echo "<script src='http://www.mydomain.com/js/fabulous.js' type='text/javascript'></script>
    ";
    };
    -->
    <!-- /mfunc -->

    http://wordpress.org/extend/plugins/w3-total-cache/

Viewing 8 replies - 1 through 8 (of 8 total)
  • <!-- mfunc {whatgoesinhere}
    
    $ref=getenv('HTTP_REFERER');
    if (strpos($ref,'www.google.com')>0)
    {
        echo 'hello google';
    
    }
    else if (strpos($ref, 'bing.com')>0)
    {
    	echo "hello bing";
    }
    else
    {
        echo "<script src='http://www.mydomain.com/js/fabulous.js' type='text/javascript'></script>
    ";
    };
    -->
    <!-- /mfunc {whatgoesinhere} -->

    latest update broke mfunc for me as well. any way to rollback to the previous version?

    It didn’t “break”, they improved it. From the change log:

    Improved security for mfunc, now disabled by default and requires security string in order to execute

    And in the FAQ:

    How do I implement page fragment caching?

    First you need to define W3TC_DYNAMIC_SECURITY in your wp-config.php file.

    define(‘W3TC_DYNAMIC_SECURITY’, ‘somesecurestring’);

    Edit your templates with the following syntax to ensure that dynamic features remain so. Replace with content of the constant:

    Example 1:
    <!– mfunc {the W3TC_DYNAMIC_SECURITY string} any PHP code –><!– /mfunc {the W3TC_DYNAMIC_SECURITY string} –>
    Example 2:
    <!– mfunc {the W3TC_DYNAMIC_SECURITY string} –>any PHP code<!– /mfunc {the W3TC_DYNAMIC_SECURITY string} –>
    Example 3:
    <!–MFUNC {the W3TC_DYNAMIC_SECURITY string} –>
    echo rand();
    <!–/mfunc {the W3TC_DYNAMIC_SECURITY string} –>
    (etc….)
    Be aware that WordPress functions will not be available.

    Following the instructions above worked for me.

    Thanks so much for the tip Sean. Unfortunately it’s not working for me.
    Just wanted to report back on my experience.
    I am running version 0.9.2.9 and I have made the changes you described. Still no joy. PHP code is not being parsed. Being displayed in plain text in HTML output of the page.

    For others who may be looking for a workaround, this is the only thing I know to do to get it to work – roll back to version 0.9.2.5. That’s the last version I know for certain to be working.

    You can download it here -> http://wordpress.org/extend/plugins/w3-total-cache/download/

    Moderator Jan Dembowski

    @jdembowski

    Brute Squad and Volunteer Moderator

    You really, really, Really do not want to do that. It’s just not safe. See this post for a good explanation why.

    Thanks for that Jan, that’s very good info I wasn’t aware of.

    Any thoughts as to what else I should check if the changes mentioned here are not working for me?

    Woohoo! I found the answer.
    This support topic -> http://wordpress.org/support/topic/mfunc-still-not-working?replies=13#post-4130664 provided the answer.

    Go check out my post there for the explanation.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Mfunc Not Working’ is closed to new replies.
Skip to toolbar