Is it possible to have anonymous users (or more specifically, users without a ‘member’ role) be redirected from a specific menu item to an alternative node of my choosing, maybe using custom_url_rewrite_inbound?
This would then enable me to have two versions of certain pages for members and non-members (it’s a site specific thing!).
Cheers.
Using
custom_url_rewrite_inbound()for this would be somewhat similar to using a sledgehammer to adjust the angle of a crooked picture – can be done, but it is cumbersome and comes with the risk of causing some damage 😉A better solution depends on what you want to achieve exactly, and how often (i.e. for how many nodes) you need to do it, so you should explain your scenario a bit more detailed. Some possible approaches include:
hook_nodeapi()(operation ‘view’) from a custom module, removing entries from the content array depending on user role.hook_menu_alter()with a custom one. Within that, you check the role. If it is ok, you just call the standard callback, else you issue adrupal_goto()(based on some general logic, if possible).hook_nodeapi()as well, again reacting to operation ‘view’, but you’d need to make sure that you only do this for node page views, not if the node is just displayed as a teaser along with others.hook_init()in a custom module, check the path (arg()or$_GET['q']) and the role, issuedrupal_goto()as needed. (Beware of cached pages – if you need to cover those, usehook_boot()instead).Etc. … – I’m sure there are more options, so you might want to provide more details on your problem/goal/scenario to allow for a more precise suggestion.