eZ Community » Forums » eZ Publish 5 Platform » Paywall
expandshrink

Paywall

Paywall

Friday 28 June 2013 7:35:39 am - 5 replies

Hi all,

We've built a paywall in eZ Publish 4.x that use the "pre read" trigger to figure out if the current user can view an article or not.

While this approach works fine it has a major drawback. It causes eZ Publish to write to the ezoperation_memento table as part of the workflow. This is obviously not ideal as it can cause performance issues on high-traffic sites.

We would like to re-develop this functionality as part of a new site we're building to avoid these database writes.

Is there any better way of doing this without resorting to ugly hacks? Is there a better hook in eZ Publish 5 than there is in 4?

The only things we really need are:

  1. Some hook that runs before rendering content (or potentially before rendering an article)
  2. Ability to either render a custom paywall template if certain conditions aren't met or continue with rendering as normal
  3. No database writes! 

The articles will contain custom ez publish 4 attributes. Not sure if that goes down well with eZ Publish 5 or not? Read something about eZP 5 not being able to deal with custom ezp4 attributes…
Cheers,

Ole

Friday 28 June 2013 10:16:17 am

To fully use custom datatypes in ez5 you need to reimplement them for the new storage engine. otherwise you can just use them via legacy stack.

One thing you could possibly use to hook up into content display is the content/view event (not trigger) existing in ezp since a few reelases - it receives node id, and if it does not give it back, content view is aborted. Not sure about how skinnable it is though

Monday 01 July 2013 5:28:11 am

The Content/view event is interesting. I guess I could return a different node that would represent the paywall, but I would need access to the original node id somehow... Even if I did a quick hack to stick the original node id in a global there would be issues around the view cache which i don't seem to be able to influence via the event :/eZ Publish 4 really do lack a proper hook that runs before /content/view/ sad.gif EmoticonCheers,Ole

Monday 01 July 2013 6:26:10 am

Gatano: what would be the best hooks for doing this in eZ Publish 5?

Sunday 21 July 2013 3:50:06 pm

I'm also considering to use the pre_read hook in ezp4. Honestly, it's the first time I hear about the "ezoperation_memento" table and I got a bit scared that the pre_read hook would fill this table. But actually, I doesn't seem to be the case:

I developed a simple "workflowevent" and it returns "eZWorkflowType::STATUS_ACCEPTED;". I don't recognize any entries in the "ezoperation_memento" table.

Does anybody know when exactly ezp decides to add a new row to this table?

Wednesday 04 September 2013 1:47:00 pm

Ahhh, in my case I don't see a problem with the "ezoperation_memento" table (only doing reads/selects on it). But ezworkflow_process is getting one INSERT, one UPDATE and one DELETE. That's a major performance hit in my case and I cannot use the "pre read" trigger.

I'll check if I can avoid those SQL queries (unlikely) or if I can use the new ezpEvent system instead.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from