Is it possible to redirect a certain user type to the entry front-end page once they click on Save from the CP?
1 Answer
You'd have to write a custom plugin, that adds an event listener for the entries.saveEntry
event.
The event listener should go into your plugin's primary class' init
method. You'll need to make sure the event listener only fires for Control Panel requests, and that the currently logged in user is assigned to the user group you want to apply this to.
You should also make sure the entry being saved has a URL (not all entry types do) before attempting to redirect.
Here's a working example:
public function init()
{
parent::init();
// Get the currently logged in user
$user = craft()->userSession->getUser();
// Only add the event listener for Control Panel requests, and if the user is in a certain group
if (craft()->request->isCpRequest() && $user && $user->isInGroup('userGroupHandle')) {
craft()->on('entries.saveEntry', function (Event $event) {
// Redirect to the entry
$entry = $event->params['entry'];
if ($entry->url) {
craft()->request->redirect($entry->url);
}
});
}
}
Obviously, you'll need to change the userGroupHandle
string to the handle for your particular user group.
If you're unfamiliar with plugin development for Craft, I'd recommend taking a look at the Business Logic template plugin or the pluginfactory.io generator app – as well as the official docs on the subject, of course.