|
View:
New views
13 Messages
—
Rating Filter:
Alert me
|
|
|
Handling cookies with wp-plugin and wp-supercacheHi,
I hope this isn't too offtopic, but I was hoping someone might be able to give me a hint or idea. :) The situation: I wrote a simple plugin for wordpress that reads the http-referrer and sets a cookie with info about searchengine or email referrals. This cookie is available in the entire session until the user closes the browser. The value can be used with a function in template files, or shortcodes in pages/posts. With Firefox plugin refspoof I simulate different referrers. This all works great both as wp-plugin and outside of wordpress as included object. I installed wp-supercache, added my cookiename to supercache's rewrite rules in .htaccess, [...] RewriteCond %{REQUEST_URI} !^.*[^/]$ RewriteCond %{REQUEST_URI} !^.*//.*$ RewriteCond %{REQUEST_METHOD} !POST RewriteCond %{QUERY_STRING} !.*=.* RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_|MYCOOKIENAME).*$ [...] and I used the following for my test markup: <!-- mfunc AgoraCapture::html() --> <?php AgoraCapture::html(); ?> <!-- /mfunc--> The function html() returns some html markup with to display the value(s) and a link to remove the cookie. I also defined some shortcodes which work great without supercache and still need to be tested with supercache, once I get the html() test working. The problem: My test function doesn't seem to be able to update or delete the cookie once wp-supercache is activated. If I visit the site by typing in the url directly, my code will set a value indicating it's a direct visit. If I then choose to remove and spoof a new referrer the directvisit-value stays and remains unchanged. If I manually delete the cookie from the browser's cookie list I'm able to simulate another referrer, but once the cookie is set, it stays there until I manually remove it again. This makes it a bit difficult to test different scenarios, and I'm not able to tell if the site would set the proper values in a real-world situation. I have the feeling it might just be a minor detail I have overlooked, and I can't imagine I'm the first to handle cookies in a wp-supercache environment. Have you ever developed a plugin or wordpress extension that handles cookies and had to work with wp-supercache? Any hint is really appreciated. Many thanks in advance, Gerrit _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Handling cookies with wp-plugin and wp-supercache> My test function doesn't seem to be able to update or delete the cookie once
> wp-supercache is activated. If I visit the site by typing in the url > directly, my code will set a value indicating it's a direct visit. If I then > choose to remove and spoof a new referrer the directvisit-value stays and > remains unchanged. If I manually delete the cookie from the browser's cookie > list I'm able to simulate another referrer, but once the cookie is set, it > stays there until I manually remove it again. This makes it a bit difficult > to test different scenarios, and I'm not able to tell if the site would set > the proper values in a real-world situation. Plugins/Cookies and Super Cache can work together with a little extra planning. 1. "Full on" super-cached pages -- that is, those served from the wp-content/cache/sitename/path/index.html -- cannot set, remove or change cookies directly because the pages are served directly by Apache and never loaded from WordPress at all. Alternatives: (1) The Header directive in Apache or (2) set/remove the cookie in Javascript. 2. "Half on" cached pages can set, remove or change cookies directly but you have to edit wp-cache-phase1.php -- before line 110 -- because the pages are served directly by wp-super-cache without running plugins at all. See the ff. code. Alternatives: (1) Load before Super Cache does or (2) set/remove the cookie in Javascript. header( 'WP-Super-Cache: WP-Cache' ); // <-- add your Cookie-setting PHP here. Go nuts. if ( $meta[ 'dynamic' ] ) { include($cache_file); } else { readfile( $cache_file ); } die(); Does this make sense? You may need to state your problem more succinctly because I don't understand. W 2009/11/1 Gerrit Wessendorf <celeph@...>: > Hi, > I hope this isn't too offtopic, but I was hoping someone might be able to > give me a hint or idea. :) > > The situation: > I wrote a simple plugin for wordpress that reads the http-referrer and sets > a cookie with info about searchengine or email referrals. This cookie is > available in the entire session until the user closes the browser. The value > can be used with a function in template files, or shortcodes in pages/posts. > With Firefox plugin refspoof I simulate different referrers. > > This all works great both as wp-plugin and outside of wordpress as included > object. > > I installed wp-supercache, added my cookiename to supercache's rewrite rules > in .htaccess, > > [...] > RewriteCond %{REQUEST_URI} !^.*[^/]$ > RewriteCond %{REQUEST_URI} !^.*//.*$ > RewriteCond %{REQUEST_METHOD} !POST > RewriteCond %{QUERY_STRING} !.*=.* > RewriteCond %{HTTP:Cookie} > !^.*(comment_author_|wordpress_logged_in|wp-postpass_|MYCOOKIENAME).*$ > [...] > > and I used the following for my test markup: > > <!-- mfunc AgoraCapture::html() --> > <?php AgoraCapture::html(); ?> > <!-- /mfunc--> > > The function html() returns some html markup with to display the value(s) > and a link to remove the cookie. > > I also defined some shortcodes which work great without supercache and still > need to be tested with supercache, once I get the html() test working. > > The problem: > My test function doesn't seem to be able to update or delete the cookie once > wp-supercache is activated. If I visit the site by typing in the url > directly, my code will set a value indicating it's a direct visit. If I then > choose to remove and spoof a new referrer the directvisit-value stays and > remains unchanged. If I manually delete the cookie from the browser's cookie > list I'm able to simulate another referrer, but once the cookie is set, it > stays there until I manually remove it again. This makes it a bit difficult > to test different scenarios, and I'm not able to tell if the site would set > the proper values in a real-world situation. > > I have the feeling it might just be a minor detail I have overlooked, and I > can't imagine I'm the first to handle cookies in a wp-supercache > environment. Have you ever developed a plugin or wordpress extension that > handles cookies and had to work with wp-supercache? > > Any hint is really appreciated. > Many thanks in advance, > Gerrit > _______________________________________________ > wp-hackers mailing list > wp-hackers@... > http://lists.automattic.com/mailman/listinfo/wp-hackers > wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Handling cookies with wp-plugin and wp-supercacheHi William,
Yes, it makes perfect sense. I was afraid Javascript might be the answer to my problem, but I will try the other options first. Thanks for the suggestions! Gerrit On Sun, Nov 1, 2009 at 3:53 PM, William Canino < william.canino@...> wrote: > > My test function doesn't seem to be able to update or delete the cookie > once > > wp-supercache is activated. If I visit the site by typing in the url > > directly, my code will set a value indicating it's a direct visit. If I > then > > choose to remove and spoof a new referrer the directvisit-value stays and > > remains unchanged. If I manually delete the cookie from the browser's > cookie > > list I'm able to simulate another referrer, but once the cookie is set, > it > > stays there until I manually remove it again. This makes it a bit > difficult > > to test different scenarios, and I'm not able to tell if the site would > set > > the proper values in a real-world situation. > > Plugins/Cookies and Super Cache can work together with a little extra > planning. > > 1. "Full on" super-cached pages -- that is, those served from the > wp-content/cache/sitename/path/index.html -- cannot set, remove or > change cookies directly because the pages are served directly by > Apache and never loaded from WordPress at all. Alternatives: (1) The > Header directive in Apache or (2) set/remove the cookie in Javascript. > > 2. "Half on" cached pages can set, remove or change cookies directly > but you have to edit wp-cache-phase1.php -- before line 110 -- because > the pages are served directly by wp-super-cache without running > plugins at all. See the ff. code. Alternatives: (1) Load before > Super Cache does or (2) set/remove the cookie in Javascript. > > header( 'WP-Super-Cache: WP-Cache' ); > // <-- add your Cookie-setting PHP here. Go nuts. > if ( $meta[ 'dynamic' ] ) { > include($cache_file); > } else { > readfile( $cache_file ); > } > die(); > > Does this make sense? You may need to state your problem more > succinctly because I don't understand. > > W > > > > 2009/11/1 Gerrit Wessendorf <celeph@...>: > > Hi, > > I hope this isn't too offtopic, but I was hoping someone might be able to > > give me a hint or idea. :) > > > > The situation: > > I wrote a simple plugin for wordpress that reads the http-referrer and > sets > > a cookie with info about searchengine or email referrals. This cookie is > > available in the entire session until the user closes the browser. The > value > > can be used with a function in template files, or shortcodes in > pages/posts. > > With Firefox plugin refspoof I simulate different referrers. > > > > This all works great both as wp-plugin and outside of wordpress as > included > > object. > > > > I installed wp-supercache, added my cookiename to supercache's rewrite > rules > > in .htaccess, > > > > [...] > > RewriteCond %{REQUEST_URI} !^.*[^/]$ > > RewriteCond %{REQUEST_URI} !^.*//.*$ > > RewriteCond %{REQUEST_METHOD} !POST > > RewriteCond %{QUERY_STRING} !.*=.* > > RewriteCond %{HTTP:Cookie} > > !^.*(comment_author_|wordpress_logged_in|wp-postpass_|MYCOOKIENAME).*$ > > [...] > > > > and I used the following for my test markup: > > > > <!-- mfunc AgoraCapture::html() --> > > <?php AgoraCapture::html(); ?> > > <!-- /mfunc--> > > > > The function html() returns some html markup with to display the value(s) > > and a link to remove the cookie. > > > > I also defined some shortcodes which work great without supercache and > still > > need to be tested with supercache, once I get the html() test working. > > > > The problem: > > My test function doesn't seem to be able to update or delete the cookie > once > > wp-supercache is activated. If I visit the site by typing in the url > > directly, my code will set a value indicating it's a direct visit. If I > then > > choose to remove and spoof a new referrer the directvisit-value stays and > > remains unchanged. If I manually delete the cookie from the browser's > cookie > > list I'm able to simulate another referrer, but once the cookie is set, > it > > stays there until I manually remove it again. This makes it a bit > difficult > > to test different scenarios, and I'm not able to tell if the site would > set > > the proper values in a real-world situation. > > > > I have the feeling it might just be a minor detail I have overlooked, and > I > > can't imagine I'm the first to handle cookies in a wp-supercache > > environment. Have you ever developed a plugin or wordpress extension that > > handles cookies and had to work with wp-supercache? > > > > Any hint is really appreciated. > > Many thanks in advance, > > Gerrit > > _______________________________________________ > > wp-hackers mailing list > > wp-hackers@... > > http://lists.automattic.com/mailman/listinfo/wp-hackers > > > _______________________________________________ > wp-hackers mailing list > wp-hackers@... > http://lists.automattic.com/mailman/listinfo/wp-hackers > wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Plugin repository not accepting a new tag?My apologies if this isn't a good place to ask this, but I wasn't sure
posting in the forums wouldn't fall on mostly deaf ears (and I don't know where would be better to be fair). I'm trying to tag a new release of a plugin in the repository, but it refuses to commit my changes, and I'm a little frustrated not knowing what I'm doing wrong. I modified the files in trunk, and checked them in without any problems. I then tried to tag the latest release, via $ svn cp trunk tags/0.2.5 Works fine, but then when I try to check in the new tag, I'm getting this error: $ svn ci -m "Tagging version 0.2.5" Adding tags/0.2.5 Adding tags/0.2.5/kstats-reloaded.php Adding tags/0.2.5/lib/cleanup.php svn: Commit failed (details follow): svn: File '/kstats-reloaded/tags/0.2.5/lib/cleanup.php' already exists This didn't happen when I tagged the first two releases. Neither Trac nor the SVN repo show my latest tags, yet the repository itself updated the archive and claims to have 0.2.5 available, which makes me wonder if it's just pulling it from trunk (despite the readme in trunk stating 0.2.5 as stable and not trunk)? Can I just rm the directories and try it again, or am I just going to make a mess of svn? I feel really lost right now. :( Trying to figure out the problem on the SVN FAQs isn't helping either, the only answer I could find for that error had to do with file name case, resulting from using svn under Windows, yet I'm running the svn on my linux box, so... bah. -- Mark Waterous _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Plugin repository not accepting a new tag?Hmph. After everything else, just deleting my local copy and checking it out
again let me set a new tag. Sorry for the noise. -- Mark Waterous > -----Original Message----- > From: wp-hackers-bounces@... [mailto:wp-hackers- > bounces@...] On Behalf Of mark waterous > Sent: Sunday, November 01, 2009 4:16 PM > To: wp-hackers@... > Subject: [wp-hackers] Plugin repository not accepting a new tag? > > My apologies if this isn't a good place to ask this, but I wasn't sure > posting in the forums wouldn't fall on mostly deaf ears (and I don't > know > where would be better to be fair). > > I'm trying to tag a new release... _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Plugin repository not accepting a new tag?On Mon, Nov 2, 2009 at 5:35 AM, mark waterous <mark@...> wrote:
> Hmph. After everything else, just deleting my local copy and checking it > out > again let me set a new tag. Sorry for the noise. > I have similar problems. I think it's a bug in subversion. -- http://scribu.net _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Handling cookies with wp-plugin and wp-supercacheHey Gerrit,
Instead of modifying wp-cache-phase1.php you can use one of the cacheactions. You'll be able to add a supercache plugin in the wp-super-cache/plugins folder that uses that hook. You should probably move the plugins folder out of that directory as the next time you update it'll delete your plugin. Doing this will make it easier to upgrade the plugin. I'd switch to half-on mode. It's almost as fast 99% of the time as full mode and more flexible. Donncha Gerrit Wessendorf wrote: > Hi William, > > Yes, it makes perfect sense. I was afraid Javascript might be the answer to > my problem, but I will try the other options first. > Thanks for the suggestions! > Gerrit > > > > On Sun, Nov 1, 2009 at 3:53 PM, William Canino < > william.canino@...> wrote: > >>> My test function doesn't seem to be able to update or delete the cookie >> once >>> wp-supercache is activated. If I visit the site by typing in the url >>> directly, my code will set a value indicating it's a direct visit. If I >> then >>> choose to remove and spoof a new referrer the directvisit-value stays and >>> remains unchanged. If I manually delete the cookie from the browser's >> cookie >>> list I'm able to simulate another referrer, but once the cookie is set, >> it >>> stays there until I manually remove it again. This makes it a bit >> difficult >>> to test different scenarios, and I'm not able to tell if the site would >> set >>> the proper values in a real-world situation. >> Plugins/Cookies and Super Cache can work together with a little extra >> planning. >> >> 1. "Full on" super-cached pages -- that is, those served from the >> wp-content/cache/sitename/path/index.html -- cannot set, remove or >> change cookies directly because the pages are served directly by >> Apache and never loaded from WordPress at all. Alternatives: (1) The >> Header directive in Apache or (2) set/remove the cookie in Javascript. >> >> 2. "Half on" cached pages can set, remove or change cookies directly >> but you have to edit wp-cache-phase1.php -- before line 110 -- because >> the pages are served directly by wp-super-cache without running >> plugins at all. See the ff. code. Alternatives: (1) Load before >> Super Cache does or (2) set/remove the cookie in Javascript. >> >> header( 'WP-Super-Cache: WP-Cache' ); >> // <-- add your Cookie-setting PHP here. Go nuts. >> if ( $meta[ 'dynamic' ] ) { >> include($cache_file); >> } else { >> readfile( $cache_file ); >> } >> die(); >> >> Does this make sense? You may need to state your problem more >> succinctly because I don't understand. >> >> W >> >> >> >> 2009/11/1 Gerrit Wessendorf <celeph@...>: >>> Hi, >>> I hope this isn't too offtopic, but I was hoping someone might be able to >>> give me a hint or idea. :) >>> >>> The situation: >>> I wrote a simple plugin for wordpress that reads the http-referrer and >> sets >>> a cookie with info about searchengine or email referrals. This cookie is >>> available in the entire session until the user closes the browser. The >> value >>> can be used with a function in template files, or shortcodes in >> pages/posts. >>> With Firefox plugin refspoof I simulate different referrers. >>> >>> This all works great both as wp-plugin and outside of wordpress as >> included >>> object. >>> >>> I installed wp-supercache, added my cookiename to supercache's rewrite >> rules >>> in .htaccess, >>> >>> [...] >>> RewriteCond %{REQUEST_URI} !^.*[^/]$ >>> RewriteCond %{REQUEST_URI} !^.*//.*$ >>> RewriteCond %{REQUEST_METHOD} !POST >>> RewriteCond %{QUERY_STRING} !.*=.* >>> RewriteCond %{HTTP:Cookie} >>> !^.*(comment_author_|wordpress_logged_in|wp-postpass_|MYCOOKIENAME).*$ >>> [...] >>> >>> and I used the following for my test markup: >>> >>> <!-- mfunc AgoraCapture::html() --> >>> <?php AgoraCapture::html(); ?> >>> <!-- /mfunc--> >>> >>> The function html() returns some html markup with to display the value(s) >>> and a link to remove the cookie. >>> >>> I also defined some shortcodes which work great without supercache and >> still >>> need to be tested with supercache, once I get the html() test working. >>> >>> The problem: >>> My test function doesn't seem to be able to update or delete the cookie >> once >>> wp-supercache is activated. If I visit the site by typing in the url >>> directly, my code will set a value indicating it's a direct visit. If I >> then >>> choose to remove and spoof a new referrer the directvisit-value stays and >>> remains unchanged. If I manually delete the cookie from the browser's >> cookie >>> list I'm able to simulate another referrer, but once the cookie is set, >> it >>> stays there until I manually remove it again. This makes it a bit >> difficult >>> to test different scenarios, and I'm not able to tell if the site would >> set >>> the proper values in a real-world situation. >>> >>> I have the feeling it might just be a minor detail I have overlooked, and >> I >>> can't imagine I'm the first to handle cookies in a wp-supercache >>> environment. Have you ever developed a plugin or wordpress extension that >>> handles cookies and had to work with wp-supercache? >>> >>> Any hint is really appreciated. >>> Many thanks in advance, >>> Gerrit >>> _______________________________________________ >>> wp-hackers mailing list >>> wp-hackers@... >>> http://lists.automattic.com/mailman/listinfo/wp-hackers >>> >> _______________________________________________ >> wp-hackers mailing list >> wp-hackers@... >> http://lists.automattic.com/mailman/listinfo/wp-hackers >> > _______________________________________________ > wp-hackers mailing list > wp-hackers@... > http://lists.automattic.com/mailman/listinfo/wp-hackers > > wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Handling cookies with wp-plugin and wp-supercache>
> > Instead of modifying wp-cache-phase1.php you can use one of the > cacheactions. You'll be able to add a supercache plugin in the > wp-super-cache/plugins folder that uses that hook. You should probably move > the plugins folder out of that directory as the next time you update it'll > delete your plugin. > > Doing this will make it easier to upgrade the plugin. Donncha, could you describe it (maybe create some small tutorial) somewhere how to do this? I think this will help for numerous wordpress plugins develeopers :) Your plugin (wp super cache) is really popular and in internet many times i saw questions from plugins developers that their plugins doesn't work if wp super cache is installed. Most of them finally decide to write in FAQ to disable wp super cache (truelly i did it also). But this is not good solutions, especially if your plugin is ready to handle this problem. Not everybody read source code of your plugin to find solution and today i first time see that it is possible to set and read cookie with wp super cache enabled :) If you will decide to write this (even shortly) i promise to help you in translating it into polish language. -- (en) regards / (pl) pozdrawiam Konrad Karpieszuk http://konradjestwrwandzie.wordpress.com/ _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Handling cookies with wp-plugin and wp-supercache+1 on starting the Super Cache API documentation.
>> You'll be able to add a supercache plugin in the >> wp-super-cache/plugins folder that uses that hook. You should probably move >> the plugins folder out of that directory as the next time you update it'll >> delete your plugin. Sorry for my language, but this is horrible. > Instead of modifying wp-cache-phase1.php you can use one of the > cacheactions Donncha is referring to wp_cache_served_cache_file. He is right. Instead of my previous code suggestion, I would have suggested this: function cookie-setting-code() { // do stuff } add_cacheaction('wp_cache_served_cache_file', 'cookie-setting-code'); The thing is, I don't know whether to put the code inline in the plugin, in init, in wp_head or in functions.php. I haven't gotten around to trying this and, well, there's no documentation. 2009/11/2 Konrad Karpieszuk <kkarpieszuk@...>: >> >> >> Instead of modifying wp-cache-phase1.php you can use one of the >> cacheactions. You'll be able to add a supercache plugin in the >> wp-super-cache/plugins folder that uses that hook. You should probably move >> the plugins folder out of that directory as the next time you update it'll >> delete your plugin. >> >> Doing this will make it easier to upgrade the plugin. > > > Donncha, could you describe it (maybe create some small tutorial) somewhere > how to do this? I think this will help for numerous wordpress plugins > develeopers :) Your plugin (wp super cache) is really popular and in > internet many times i saw questions from plugins developers that their > plugins doesn't work if wp super cache is installed. Most of them finally > decide to write in FAQ to disable wp super cache (truelly i did it also). > But this is not good solutions, especially if your plugin is ready to handle > this problem. Not everybody read source code of your plugin to find solution > and today i first time see that it is possible to set and read cookie with > wp super cache enabled :) > > If you will decide to write this (even shortly) i promise to help you in > translating it into polish language. > > > -- > (en) regards / (pl) pozdrawiam > Konrad Karpieszuk > http://konradjestwrwandzie.wordpress.com/ > _______________________________________________ > wp-hackers mailing list > wp-hackers@... > http://lists.automattic.com/mailman/listinfo/wp-hackers > wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Handling cookies with wp-plugin and wp-supercacheHi Donncha,
Thank you for the advice! I will have to try and take a look at it again tonight. Wp-supercache will run in half-on mode for now. I might have to look into an optional alternative for full-on users later. @Konrad: I'd be happy to write a tutorial once I have it working, and could offer my plugin as an example. Thanks! Gerrit On Mon, Nov 2, 2009 at 8:14 AM, Donncha O Caoimh <donncha@...> wrote: > Hey Gerrit, > > Instead of modifying wp-cache-phase1.php you can use one of the > cacheactions. You'll be able to add a supercache plugin in the > wp-super-cache/plugins folder that uses that hook. You should probably move > the plugins folder out of that directory as the next time you update it'll > delete your plugin. > > Doing this will make it easier to upgrade the plugin. > > I'd switch to half-on mode. It's almost as fast 99% of the time as full > mode and more flexible. > > Donncha > > > Gerrit Wessendorf wrote: > >> Hi William, >> >> Yes, it makes perfect sense. I was afraid Javascript might be the answer >> to >> my problem, but I will try the other options first. >> Thanks for the suggestions! >> Gerrit >> >> >> >> On Sun, Nov 1, 2009 at 3:53 PM, William Canino < >> william.canino@...> wrote: >> >> My test function doesn't seem to be able to update or delete the cookie >>>> >>> once >>> >>>> wp-supercache is activated. If I visit the site by typing in the url >>>> directly, my code will set a value indicating it's a direct visit. If I >>>> >>> then >>> >>>> choose to remove and spoof a new referrer the directvisit-value stays >>>> and >>>> remains unchanged. If I manually delete the cookie from the browser's >>>> >>> cookie >>> >>>> list I'm able to simulate another referrer, but once the cookie is set, >>>> >>> it >>> >>>> stays there until I manually remove it again. This makes it a bit >>>> >>> difficult >>> >>>> to test different scenarios, and I'm not able to tell if the site would >>>> >>> set >>> >>>> the proper values in a real-world situation. >>>> >>> Plugins/Cookies and Super Cache can work together with a little extra >>> planning. >>> >>> 1. "Full on" super-cached pages -- that is, those served from the >>> wp-content/cache/sitename/path/index.html -- cannot set, remove or >>> change cookies directly because the pages are served directly by >>> Apache and never loaded from WordPress at all. Alternatives: (1) The >>> Header directive in Apache or (2) set/remove the cookie in Javascript. >>> >>> 2. "Half on" cached pages can set, remove or change cookies directly >>> but you have to edit wp-cache-phase1.php -- before line 110 -- because >>> the pages are served directly by wp-super-cache without running >>> plugins at all. See the ff. code. Alternatives: (1) Load before >>> Super Cache does or (2) set/remove the cookie in Javascript. >>> >>> header( 'WP-Super-Cache: WP-Cache' ); >>> // <-- add your Cookie-setting PHP here. Go nuts. >>> if ( $meta[ 'dynamic' ] ) { >>> include($cache_file); >>> } else { >>> readfile( $cache_file ); >>> } >>> die(); >>> >>> Does this make sense? You may need to state your problem more >>> succinctly because I don't understand. >>> >>> W >>> >>> >>> >>> 2009/11/1 Gerrit Wessendorf <celeph@...>: >>> >>>> Hi, >>>> I hope this isn't too offtopic, but I was hoping someone might be able >>>> to >>>> give me a hint or idea. :) >>>> >>>> The situation: >>>> I wrote a simple plugin for wordpress that reads the http-referrer and >>>> >>> sets >>> >>>> a cookie with info about searchengine or email referrals. This cookie is >>>> available in the entire session until the user closes the browser. The >>>> >>> value >>> >>>> can be used with a function in template files, or shortcodes in >>>> >>> pages/posts. >>> >>>> With Firefox plugin refspoof I simulate different referrers. >>>> >>>> This all works great both as wp-plugin and outside of wordpress as >>>> >>> included >>> >>>> object. >>>> >>>> I installed wp-supercache, added my cookiename to supercache's rewrite >>>> >>> rules >>> >>>> in .htaccess, >>>> >>>> [...] >>>> RewriteCond %{REQUEST_URI} !^.*[^/]$ >>>> RewriteCond %{REQUEST_URI} !^.*//.*$ >>>> RewriteCond %{REQUEST_METHOD} !POST >>>> RewriteCond %{QUERY_STRING} !.*=.* >>>> RewriteCond %{HTTP:Cookie} >>>> !^.*(comment_author_|wordpress_logged_in|wp-postpass_|MYCOOKIENAME).*$ >>>> [...] >>>> >>>> and I used the following for my test markup: >>>> >>>> <!-- mfunc AgoraCapture::html() --> >>>> <?php AgoraCapture::html(); ?> >>>> <!-- /mfunc--> >>>> >>>> The function html() returns some html markup with to display the >>>> value(s) >>>> and a link to remove the cookie. >>>> >>>> I also defined some shortcodes which work great without supercache and >>>> >>> still >>> >>>> need to be tested with supercache, once I get the html() test working. >>>> >>>> The problem: >>>> My test function doesn't seem to be able to update or delete the cookie >>>> >>> once >>> >>>> wp-supercache is activated. If I visit the site by typing in the url >>>> directly, my code will set a value indicating it's a direct visit. If I >>>> >>> then >>> >>>> choose to remove and spoof a new referrer the directvisit-value stays >>>> and >>>> remains unchanged. If I manually delete the cookie from the browser's >>>> >>> cookie >>> >>>> list I'm able to simulate another referrer, but once the cookie is set, >>>> >>> it >>> >>>> stays there until I manually remove it again. This makes it a bit >>>> >>> difficult >>> >>>> to test different scenarios, and I'm not able to tell if the site would >>>> >>> set >>> >>>> the proper values in a real-world situation. >>>> >>>> I have the feeling it might just be a minor detail I have overlooked, >>>> and >>>> >>> I >>> >>>> can't imagine I'm the first to handle cookies in a wp-supercache >>>> environment. Have you ever developed a plugin or wordpress extension >>>> that >>>> handles cookies and had to work with wp-supercache? >>>> >>>> Any hint is really appreciated. >>>> Many thanks in advance, >>>> Gerrit >>>> _______________________________________________ >>>> wp-hackers mailing list >>>> wp-hackers@... >>>> http://lists.automattic.com/mailman/listinfo/wp-hackers >>>> >>>> _______________________________________________ >>> wp-hackers mailing list >>> wp-hackers@... >>> http://lists.automattic.com/mailman/listinfo/wp-hackers >>> >>> _______________________________________________ >> wp-hackers mailing list >> wp-hackers@... >> http://lists.automattic.com/mailman/listinfo/wp-hackers >> >> >> _______________________________________________ > wp-hackers mailing list > wp-hackers@... > http://lists.automattic.com/mailman/listinfo/wp-hackers > wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Handling cookies with wp-plugin and wp-supercacheFor the past few weeks I've been meaning to write a "Hacking Supercache
for fun and pleasure" post with tips and tricks and lists of actions and filters that can be used. Unfortunately a lack of time has stopped me writing it so far but maybe this month. If you're curious, have a read through wp-cache-phase1.php. It's a short file but has some interesting stuff, and the plugins/ folder has 2 example plugins. Donncha PS. it's not horrible, really! :P William Canino wrote: > +1 on starting the Super Cache API documentation. > >>> You'll be able to add a supercache plugin in the >>> wp-super-cache/plugins folder that uses that hook. You should probably move >>> the plugins folder out of that directory as the next time you update it'll >>> delete your plugin. > > Sorry for my language, but this is horrible. > >> Instead of modifying wp-cache-phase1.php you can use one of the >> cacheactions > > Donncha is referring to wp_cache_served_cache_file. He is right. > Instead of my previous code suggestion, I would have suggested this: > > function cookie-setting-code() { > // do stuff > } > add_cacheaction('wp_cache_served_cache_file', 'cookie-setting-code'); > > The thing is, I don't know whether to put the code inline in the > plugin, in init, in wp_head or in functions.php. I haven't gotten > around to trying this and, well, there's no documentation. > > > > 2009/11/2 Konrad Karpieszuk <kkarpieszuk@...>: >>> >>> Instead of modifying wp-cache-phase1.php you can use one of the >>> cacheactions. You'll be able to add a supercache plugin in the >>> wp-super-cache/plugins folder that uses that hook. You should probably move >>> the plugins folder out of that directory as the next time you update it'll >>> delete your plugin. >>> >>> Doing this will make it easier to upgrade the plugin. >> >> Donncha, could you describe it (maybe create some small tutorial) somewhere >> how to do this? I think this will help for numerous wordpress plugins >> develeopers :) Your plugin (wp super cache) is really popular and in >> internet many times i saw questions from plugins developers that their >> plugins doesn't work if wp super cache is installed. Most of them finally >> decide to write in FAQ to disable wp super cache (truelly i did it also). >> But this is not good solutions, especially if your plugin is ready to handle >> this problem. Not everybody read source code of your plugin to find solution >> and today i first time see that it is possible to set and read cookie with >> wp super cache enabled :) >> >> If you will decide to write this (even shortly) i promise to help you in >> translating it into polish language. >> >> >> -- >> (en) regards / (pl) pozdrawiam >> Konrad Karpieszuk >> http://konradjestwrwandzie.wordpress.com/ >> _______________________________________________ >> wp-hackers mailing list >> wp-hackers@... >> http://lists.automattic.com/mailman/listinfo/wp-hackers >> > _______________________________________________ > wp-hackers mailing list > wp-hackers@... > http://lists.automattic.com/mailman/listinfo/wp-hackers > > wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Handling cookies with wp-plugin and wp-supercacheAnd here we have it. WP Super Cache for Developers:
http://ocaoimh.ie/wp-super-cache-developers/ If you have feedback, please leave it on my blog post announcing it as the above link is a page with no comment form: http://ocaoimh.ie/wp-super-cache-developer-documentation/ Donncha Donncha O Caoimh wrote: > For the past few weeks I've been meaning to write a "Hacking Supercache > for fun and pleasure" post with tips and tricks and lists of actions and > filters that can be used. > > Unfortunately a lack of time has stopped me writing it so far but maybe > this month. > > If you're curious, have a read through wp-cache-phase1.php. It's a short > file but has some interesting stuff, and the plugins/ folder has 2 > example plugins. > > Donncha > PS. it's not horrible, really! :P > > William Canino wrote: >> +1 on starting the Super Cache API documentation. >> >>>> You'll be able to add a supercache plugin in the >>>> wp-super-cache/plugins folder that uses that hook. You should >>>> probably move >>>> the plugins folder out of that directory as the next time you update >>>> it'll >>>> delete your plugin. >> >> Sorry for my language, but this is horrible. >> >>> Instead of modifying wp-cache-phase1.php you can use one of the >>> cacheactions >> >> Donncha is referring to wp_cache_served_cache_file. He is right. >> Instead of my previous code suggestion, I would have suggested this: >> >> function cookie-setting-code() { >> // do stuff >> } >> add_cacheaction('wp_cache_served_cache_file', 'cookie-setting-code'); >> >> The thing is, I don't know whether to put the code inline in the >> plugin, in init, in wp_head or in functions.php. I haven't gotten >> around to trying this and, well, there's no documentation. >> >> >> >> 2009/11/2 Konrad Karpieszuk <kkarpieszuk@...>: >>>> >>>> Instead of modifying wp-cache-phase1.php you can use one of the >>>> cacheactions. You'll be able to add a supercache plugin in the >>>> wp-super-cache/plugins folder that uses that hook. You should >>>> probably move >>>> the plugins folder out of that directory as the next time you update >>>> it'll >>>> delete your plugin. >>>> >>>> Doing this will make it easier to upgrade the plugin. >>> >>> Donncha, could you describe it (maybe create some small tutorial) >>> somewhere >>> how to do this? I think this will help for numerous wordpress plugins >>> develeopers :) Your plugin (wp super cache) is really popular and in >>> internet many times i saw questions from plugins developers that their >>> plugins doesn't work if wp super cache is installed. Most of them >>> finally >>> decide to write in FAQ to disable wp super cache (truelly i did it >>> also). >>> But this is not good solutions, especially if your plugin is ready to >>> handle >>> this problem. Not everybody read source code of your plugin to find >>> solution >>> and today i first time see that it is possible to set and read cookie >>> with >>> wp super cache enabled :) >>> >>> If you will decide to write this (even shortly) i promise to help you in >>> translating it into polish language. >>> >>> >>> -- >>> (en) regards / (pl) pozdrawiam >>> Konrad Karpieszuk >>> http://konradjestwrwandzie.wordpress.com/ >>> _______________________________________________ >>> wp-hackers mailing list >>> wp-hackers@... >>> http://lists.automattic.com/mailman/listinfo/wp-hackers >>> >> _______________________________________________ >> wp-hackers mailing list >> wp-hackers@... >> http://lists.automattic.com/mailman/listinfo/wp-hackers >> >> > _______________________________________________ > wp-hackers mailing list > wp-hackers@... > http://lists.automattic.com/mailman/listinfo/wp-hackers > > wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Handling cookies with wp-plugin and wp-supercacheDonncha, thank you :) Sorry that i answer so late but i wanted first to
check this tutorial in practice, and then say thank you, but i see that in incoming days i will nto have opportunity to check it :) so now i just send you thanks for this and when i will use your suggestion in my plugins, then i will ask more if i will have any questions :) at end i see that this is not finished so i hope soon you will give us more :) On Tue, Nov 3, 2009 at 9:27 PM, Donncha O Caoimh <donncha@...> wrote: > And here we have it. WP Super Cache for Developers: > http://ocaoimh.ie/wp-super-cache-developers/ > > If you have feedback, please leave it on my blog post announcing it as the > above link is a page with no comment form: > http://ocaoimh.ie/wp-super-cache-developer-documentation/ > > Donncha > > > Donncha O Caoimh wrote: > >> For the past few weeks I've been meaning to write a "Hacking Supercache >> for fun and pleasure" post with tips and tricks and lists of actions and >> filters that can be used. >> >> Unfortunately a lack of time has stopped me writing it so far but maybe >> this month. >> >> If you're curious, have a read through wp-cache-phase1.php. It's a short >> file but has some interesting stuff, and the plugins/ folder has 2 example >> plugins. >> >> Donncha >> PS. it's not horrible, really! :P >> >> William Canino wrote: >> >>> +1 on starting the Super Cache API documentation. >>> >>> You'll be able to add a supercache plugin in the >>>>> wp-super-cache/plugins folder that uses that hook. You should probably >>>>> move >>>>> the plugins folder out of that directory as the next time you update >>>>> it'll >>>>> delete your plugin. >>>>> >>>> >>> Sorry for my language, but this is horrible. >>> >>> Instead of modifying wp-cache-phase1.php you can use one of the >>>> cacheactions >>>> >>> >>> Donncha is referring to wp_cache_served_cache_file. He is right. >>> Instead of my previous code suggestion, I would have suggested this: >>> >>> function cookie-setting-code() { >>> // do stuff >>> } >>> add_cacheaction('wp_cache_served_cache_file', 'cookie-setting-code'); >>> >>> The thing is, I don't know whether to put the code inline in the >>> plugin, in init, in wp_head or in functions.php. I haven't gotten >>> around to trying this and, well, there's no documentation. >>> >>> >>> >>> 2009/11/2 Konrad Karpieszuk <kkarpieszuk@...>: >>> >>>> >>>>> Instead of modifying wp-cache-phase1.php you can use one of the >>>>> cacheactions. You'll be able to add a supercache plugin in the >>>>> wp-super-cache/plugins folder that uses that hook. You should probably >>>>> move >>>>> the plugins folder out of that directory as the next time you update >>>>> it'll >>>>> delete your plugin. >>>>> >>>>> Doing this will make it easier to upgrade the plugin. >>>>> >>>> >>>> Donncha, could you describe it (maybe create some small tutorial) >>>> somewhere >>>> how to do this? I think this will help for numerous wordpress plugins >>>> develeopers :) Your plugin (wp super cache) is really popular and in >>>> internet many times i saw questions from plugins developers that their >>>> plugins doesn't work if wp super cache is installed. Most of them >>>> finally >>>> decide to write in FAQ to disable wp super cache (truelly i did it >>>> also). >>>> But this is not good solutions, especially if your plugin is ready to >>>> handle >>>> this problem. Not everybody read source code of your plugin to find >>>> solution >>>> and today i first time see that it is possible to set and read cookie >>>> with >>>> wp super cache enabled :) >>>> >>>> If you will decide to write this (even shortly) i promise to help you in >>>> translating it into polish language. >>>> >>>> >>>> -- >>>> (en) regards / (pl) pozdrawiam >>>> Konrad Karpieszuk >>>> http://konradjestwrwandzie.wordpress.com/ >>>> _______________________________________________ >>>> wp-hackers mailing list >>>> wp-hackers@... >>>> http://lists.automattic.com/mailman/listinfo/wp-hackers >>>> >>>> _______________________________________________ >>> wp-hackers mailing list >>> wp-hackers@... >>> http://lists.automattic.com/mailman/listinfo/wp-hackers >>> >>> >>> _______________________________________________ >> wp-hackers mailing list >> wp-hackers@... >> http://lists.automattic.com/mailman/listinfo/wp-hackers >> >> >> _______________________________________________ > wp-hackers mailing list > wp-hackers@... > http://lists.automattic.com/mailman/listinfo/wp-hackers > -- (en) regards / (pl) pozdrawiam Konrad Karpieszuk http://konradjestwrwandzie.wordpress.com/ _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
| Free embeddable forum powered by Nabble | Forum Help |