Keyword

Avoid K2 custom plugin from caching

  • MGS Creativa
  • MGS Creativa's Avatar Topic Author
  • Offline
  • Senior Member
More
9 years 2 months ago - 9 years 2 months ago #145932 by MGS Creativa
Avoid K2 custom plugin from caching was created by MGS Creativa
Hi, I have developed a small K2 plugin to display a contact form on every K2 article as requested by my client, the plugin uses the onK2BeforeDisplayContent and onK2AfterDisplayContent K2 plugin events.

I have an issue with cache, if I enable cache, the form gets cached an the plugin code of the onK2BeforeDisplayContent and onK2AfterDisplayContent K2 events gets bypassed!

Is there a workaround for this? I need to get the contact form plugin code executed and have the rest of my K2 articles cached.

Thanks in advise!

PS: Using J! 2.5.28 and K2 2.6.9
Last edit: 9 years 2 months ago by MGS Creativa.

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago #145959 by Lefteris
Replied by Lefteris on topic Avoid K2 custom plugin from caching
Hi,

All the content and K2 plugins are cached since they are part of the output of the component. This is the intended behavior. The cache is bypassed only when the user is logged in.

There is no way to bypass this. And i don't see a reason why a form should not be cached.

If you give some details about what your plugin is supposed to do, i can give you some suggestions regarding the implementation.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • MGS Creativa
  • MGS Creativa's Avatar Topic Author
  • Offline
  • Senior Member
More
9 years 2 months ago #145981 by MGS Creativa
Replied by MGS Creativa on topic Avoid K2 custom plugin from caching
Great!

If you get the captcha wrong, as the form gets cached, the code for captcha checking is bypassed, also the code to send the form data to a desired email gets bypassed too, because that code doesn't get executed (I mean the part that checks if the "send" button got clicked)

here is the custom K2 plugin for you to check it out it.mgscreativa.com.ar/formcontacto.zip

I really want cache and my lovely plugin working together. Please have in mind, that the plugin, depending on the current article ID will add two extra fields to the form (of course that also gets cached, displaying only one kind of form).

Thanks!

Please Log in or Create an account to join the conversation.

  • MGS Creativa
  • MGS Creativa's Avatar Topic Author
  • Offline
  • Senior Member
More
9 years 2 months ago #146109 by MGS Creativa
Replied by MGS Creativa on topic Avoid K2 custom plugin from caching
Hi, I need some advise on this if it's possible to achieve this with a plugin.

Thanks!

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago #146113 by Lefteris
Replied by Lefteris on topic Avoid K2 custom plugin from caching
I really don't have time to check your plugin's code.

What do you mean when you say that the form gets cached? How do you use a plugin to check the captcha? Such code should be definitely placed in a component controller.

If you don't want to create a component you can take a look at the AJAX interface that Joomla! provides. You can learn more regarding this at docs.joomla.org/Using_Joomla_Ajax_Interface .

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • MGS Creativa
  • MGS Creativa's Avatar Topic Author
  • Offline
  • Senior Member
More
9 years 2 months ago #146115 by MGS Creativa
Replied by MGS Creativa on topic Avoid K2 custom plugin from caching
Great, will look into com_ajax.

Thanks a lot!

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago #146183 by Lefteris
Replied by Lefteris on topic Avoid K2 custom plugin from caching
You are welcome.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum