How to redirect in function of criteria

Hello

When a user opens a link (page or album) I would like to check his rights and transparently redirect to a given page.

I idea is not to use nginx nor Apache redirect.

For instance
* anonymous requests "/pages/members" and is redirected to "/pages/join"
* logged in user requests "/pages/members" and is granted access

I would like to manage multiple rediect (not only "/pages/members").

Obviously the idea could be applied to any other criteria. For instance you logged 10 times today then are redirected to a given page.

I suspect I may use zp_register_filter/zp_apply_filter('getLink'...) for that and I also suspect the routing is done in zp-core/index.html
However I cannot figure out the details.

Thank you for your advice.

Comments

  • There is a filter named `load_theme_script` that is called during the page loading process. It returns the script to be loaded. You can create a plugin which registers that filter.

    Your handler for that filter would decide if a redirect should happen and return a different script and/or suitably modify global variables so that the loaded script does what you want.
  • acrylian Administrator, Developer
    @mric: Sorry, somehow missed your post… The answer given above is the way to go.
Sign In or Register to comment.