|
|
Subject: Re: [wp-hackers] Handling cookies with wp-plugin and wp-supercache - msg#00011
> 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@xxxxxxxxx>:
> 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@xxxxxxxxxxxxxxxxxxxx
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
wp-hackers mailing list
wp-hackers@xxxxxxxxxxxxxxxxxxxx
http://lists.automattic.com/mailman/listinfo/wp-hackers
Thread at a glance:
Previous Message by Date:
Re: [wp-hackers] dynamic post passwords
I have a plugin that automatically assigns passwords to children pages
if the password is set for the parent page.
I encountered several obstacles because of the way the output is
returned. It's been a while so I honestly can't remember what the
specific problems I had were and how I got around it... but here's the
source code in the event it helps you out or gives you a better idea.
I do remember that my plugin doesn't apply the password to
grandchildren pages, just children pages, just fyi.
Hope it helps.
http://fullthrottledevelopment.com/password-protect-children-pages
Source Code:
http://svn.wp-plugins.org/ft-password-protect-children-pages/trunk/ft-password-protect-children-pages.php
Glenn Ansley
http://fullthrottledevelopment.com
http://twitter.com/glennansley
http://twitter.com/full_throttle
On Sun, Nov 1, 2009 at 3:28 PM, <netkickstart@xxxxxxxxx> wrote:
> I just had another idea on this (sorry if anyone responded already;
> I'm on the digest version). How about checking $_POST['post_password']
> in the init hook and, if it passes the dynamic password test, assuming
> we know the $post in that context, the wp-postpass_ cookie could then
> be set to match the post's password as stored in the db. In this way,
> post_password_required would return false and the post would be shown.
>
> -Erin
> _______________________________________________
> wp-hackers mailing list
> wp-hackers@xxxxxxxxxxxxxxxxxxxx
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
wp-hackers mailing list
wp-hackers@xxxxxxxxxxxxxxxxxxxx
http://lists.automattic.com/mailman/listinfo/wp-hackers
Next Message by Date:
Re: [wp-hackers] Handling cookies with wp-plugin and wp-supercache
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@xxxxxxxxxxxxxx> 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@xxxxxxxxx>:
> > 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@xxxxxxxxxxxxxxxxxxxx
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers@xxxxxxxxxxxxxxxxxxxx
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
wp-hackers mailing list
wp-hackers@xxxxxxxxxxxxxxxxxxxx
http://lists.automattic.com/mailman/listinfo/wp-hackers
Previous Message by Thread:
[wp-hackers] Handling cookies with wp-plugin and wp-supercache
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@xxxxxxxxxxxxxxxxxxxx
http://lists.automattic.com/mailman/listinfo/wp-hackers
Next Message by Thread:
Re: [wp-hackers] Handling cookies with wp-plugin and wp-supercache
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@xxxxxxxxxxxxxx> 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@xxxxxxxxx>:
> > 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@xxxxxxxxxxxxxxxxxxxx
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers@xxxxxxxxxxxxxxxxxxxx
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
wp-hackers mailing list
wp-hackers@xxxxxxxxxxxxxxxxxxxx
http://lists.automattic.com/mailman/listinfo/wp-hackers
|
|