I've found a way to do this, so I may as well post it in case anyone else wants to know
I did end up creating another plugin, taking the auth and viewRenderer instances as arguments.
Here's the plugin code:
Code:
class adam_Plugin_RolePath extends Zend_Controller_Plugin_Abstract {
private $_auth;
private $_viewRenderer;
public function __construct($auth, $viewRenderer){
$this->_auth = $auth;
$this->_viewRenderer = $viewRenderer;
}
public function preDispatch(Zend_Controller_Request_Abstract $request){
if ($this->_auth->hasIdentity()) {
$role = $this->_auth->getIdentity()->role;
}
else {
$role = 'guest';
}
$this->_viewRenderer->setViewScriptPathSpec(':controller/'.$role.'-:action.:suffix');
}
}
And this now renders ../application/module/views/scripts/role-action.phtml.
I'm not sure how this will work in practice, but at least I have the option now!