mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 00:06:55 +02:00
Add support for an experimental $config->userOutputFormatting setting and update ProcessProfile to support.
This commit is contained in:
@@ -523,6 +523,18 @@ $config->sessionHistory = 0;
|
|||||||
*/
|
*/
|
||||||
$config->userAuthHashType = 'sha1';
|
$config->userAuthHashType = 'sha1';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable output formatting for current $user API variable at boot?
|
||||||
|
*
|
||||||
|
* EXPERIMENTAL: May not be compatible with with all usages, so if setting to `true`
|
||||||
|
* then be sure to test thoroughly on anything that works with $user API variable.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
* @since 3.0.241
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$config->userOutputFormatting = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Names (string) or IDs (int) of roles that are not allowed to login
|
* Names (string) or IDs (int) of roles that are not allowed to login
|
||||||
*
|
*
|
||||||
|
@@ -156,6 +156,7 @@
|
|||||||
*
|
*
|
||||||
* @property string $userAuthSalt Salt generated at install time to be used as a secondary/non-database salt for the password system. #pw-group-session
|
* @property string $userAuthSalt Salt generated at install time to be used as a secondary/non-database salt for the password system. #pw-group-session
|
||||||
* @property string $userAuthHashType Default is 'sha1' - used only if Blowfish is not supported by the system. #pw-group-session
|
* @property string $userAuthHashType Default is 'sha1' - used only if Blowfish is not supported by the system. #pw-group-session
|
||||||
|
* @property bool $userOutputFormatting Enable output formatting for current $user API variable at boot? (default=false) #pw-group-session @since 3.0.241
|
||||||
* @property string $tableSalt Additional hash for other (non-authentication) purposes. #pw-group-system @since 3.0.164
|
* @property string $tableSalt Additional hash for other (non-authentication) purposes. #pw-group-system @since 3.0.164
|
||||||
*
|
*
|
||||||
* @property bool $internal This is automatically set to FALSE when PW is externally bootstrapped. #pw-group-runtime
|
* @property bool $internal This is automatically set to FALSE when PW is externally bootstrapped. #pw-group-runtime
|
||||||
|
@@ -601,7 +601,9 @@ class ProcessWire extends Wire {
|
|||||||
// the current user can only be determined after the session has been initiated
|
// the current user can only be determined after the session has been initiated
|
||||||
$session = $this->wire('session', new Session($this), true);
|
$session = $this->wire('session', new Session($this), true);
|
||||||
$this->initVar('session', $session);
|
$this->initVar('session', $session);
|
||||||
$this->wire('user', $users->getCurrentUser());
|
$user = $users->getCurrentUser();
|
||||||
|
if($config->userOutputFormatting) $user->of(true);
|
||||||
|
$this->wire('user', $user);
|
||||||
|
|
||||||
$input = $this->wire('input', new WireInput(), true);
|
$input = $this->wire('input', new WireInput(), true);
|
||||||
if($config->wireInputLazy) $input->setLazy(true);
|
if($config->wireInputLazy) $input->setLazy(true);
|
||||||
|
@@ -72,11 +72,15 @@ class ProcessProfile extends Process implements ConfigurableModule, WirePageEdit
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->user = $this->wire()->user;
|
$this->user = $this->wire()->user;
|
||||||
|
$of = $this->user->of();
|
||||||
|
if($of) $this->user->of(false);
|
||||||
|
|
||||||
$this->headline($this->_("Profile:") . ' ' . $this->user->name); // Primary Headline (precedes the username)
|
$this->headline($this->_("Profile:") . ' ' . $this->user->name); // Primary Headline (precedes the username)
|
||||||
$form = $this->buildForm($fieldName);
|
$form = $this->buildForm($fieldName);
|
||||||
|
|
||||||
if($input->post('submit_save_profile') || $fieldName) {
|
if($input->post('submit_save_profile') || $fieldName) {
|
||||||
$this->processInput($form, $fieldName);
|
$this->processInput($form, $fieldName);
|
||||||
|
if($of) $this->user->of(true);
|
||||||
if($fieldName) {
|
if($fieldName) {
|
||||||
// no need to redirect
|
// no need to redirect
|
||||||
} else {
|
} else {
|
||||||
@@ -84,7 +88,9 @@ class ProcessProfile extends Process implements ConfigurableModule, WirePageEdit
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return $form->render();
|
$out = $form->render();
|
||||||
|
if($of) $this->user->of(true);
|
||||||
|
return $out;
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user