1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-22 06:13:57 +02:00

Enhancement for issue processwire/processwire-issues#539 show "Edit Profile" button after login when user has profile-edit permission but not page-edit permission

This commit is contained in:
Ryan Cramer
2018-03-15 11:02:37 -04:00
parent ba21b28b4e
commit 19a55c6d37

View File

@@ -149,8 +149,15 @@ class ProcessLogin extends Process {
$this->message($this->_("You are logged in.")); $this->message($this->_("You are logged in."));
if($this->isAdmin && $this->user->hasPermission('page-edit')) $this->afterLoginRedirect(); if($this->isAdmin && $this->user->hasPermission('page-edit')) $this->afterLoginRedirect();
// fallback if nothing set // fallback if nothing set
$url = $this->config->urls->root; $btn = $this->wire('modules')->get('InputfieldButton');
return "<p><a href='$url'>" . $this->_('Continue') . "</a></p>"; if($this->user->hasPermission('profile-edit')) {
$btn->value = $this->_('Edit Profile');
$btn->href = $this->wire('config')->urls->admin . 'profile/';
} else {
$btn->value = $this->_('Continue');
$btn->href = $this->wire('config')->urls->root;
}
return "<p>" . $btn->render() . "</p>";
} }
if($this->input->get('forgot') && $this->allowForgot) { if($this->input->get('forgot') && $this->allowForgot) {