Hello!
I run a small site, where only the registered users currently have access to articles. I'd like to allow anonymous visitors to see the first and the last paragraph of a page, instead of simply demanding, they log-in.
Extension-writing seems simple enough, but all of the hooks in the `*Page Rendering'* section of the list at:
http://www.mediawiki.org/wiki/Manual:Hooks
seem to apply to an article /regardless of the visitor/. The result of the rendering is then cached and sent to all subsequent visitors... This means, that if the first user to access a page is a guest, even the registered users will see the truncated page. And the other way around -- if the first user is registered, everyone will the full content of the page rendered just for him...
Short of disabling caching altogether, how can I send an abridged version to guests without affecting the logged-in users? Thank you!
-mi
Mikhail T. wrote:
Hello!
I run a small site, where only the registered users currently have access to articles. I'd like to allow anonymous visitors to see the first and the last paragraph of a page, instead of simply demanding, they log-in.
Extension-writing seems simple enough, but all of the hooks in the `*Page Rendering'* section of the list at:
http://www.mediawiki.org/wiki/Manual:Hooks
seem to apply to an article /regardless of the visitor/. The result of the rendering is then cached and sent to all subsequent visitors... This means, that if the first user to access a page is a guest, even the registered users will see the truncated page. And the other way around -- if the first user is registered, everyone will the full content of the page rendered just for him...
Short of disabling caching altogether, how can I send an abridged version to guests without affecting the logged-in users? Thank you!
-mi
The easy and dirty way would be to disable the caching by setting $wgParserCacheType to CACHE_NONE. The right solution would be to do $parser->disableCache(); when your extension kicks in to mark that page uncacheable. http://www.mediawiki.org/wiki/Extensions_FAQ#How_do_I_disable_caching_for_pa...
Yet the optimum one would be to add the user status to the cache, so pages are cached both for users and guests but each get their appropiate version.
mediawiki-api@lists.wikimedia.org