WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
Mfunc Not Working (9 posts)

  1. senator94
    Member
    Posted 1 year ago #

    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/

  2. senator94
    Member
    Posted 1 year ago #

    <!-- 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} -->
  3. MikeHerpDerp
    Member
    Posted 1 year ago #

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

  4. Sean Donovan
    Member
    Posted 1 year ago #

    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.

  5. mbrinson
    Member
    Posted 1 year ago #

    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.

  6. mbrinson
    Member
    Posted 1 year ago #

    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/

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

  8. mbrinson
    Member
    Posted 1 year ago #

    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?

  9. mbrinson
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags