I want redirect user(logged in) to the custom page if he/she not allowed to see profiles for example. So instead of displaying "You are not allowed to view profiles" i want redirect him to http://www.mydomain.com/upgrade-membership
Alex, if you want to change this functionality behavior on the whole site, you should make changes for every plugin installed. For instance, you can change the redirect (on the view action) for the Blogs plugin in this file:
/ow_plugins/blogs/controllers/view.php
Search for the index function and change the$this->setTemplate method to $this->redirect.
For example:
$this->redirect(OW::getRouter()->urlForRoute('ROUTE'));