EmailConfirmationSetting
in package
Interprets the setting "content confirmed by the author via an e-mail link" in one place for adverts (Bazaar, module 5), company profiles (Comcat, module 6) and discussion posts (Discussion, module 8).
Each module has two separate switches with the positive meaning "confirmation is required":
<entity>.confirmation.required.logged: the author is signed in (the record has an owner: advertinsertUserId, postuserId; on the external path the server sets it from the JWT, never the client),<entity>.confirmation.required.guest: the author is not signed in (record without owner), where<entity>isadvert(Bazaar, Comcat) ormessage(Discussion). The dotted convention: the module is carried by themodulecolumn, the entity is the first segment, the variant (logged / guest) comes last.
Values: '1' means required (the author gets an e-mail with the link ?do=confirm&key=… and
the record stays hidden from the public until clicked); '0' and a missing row mean not
required (the record is confirmed on insert and the author gets only a notice).
IMPORTANT: the setting decides only at insert time. Public visibility depends solely on
confirmedAt IS NOT NULL (a record that needed no confirmation has confirmedAt filled from
the insert). Switching the setting therefore neither hides nor publishes existing records.
IMPORTANT: this is not the admin approval (automaticApproval, column approved_at). Both
conditions apply independently of each other.
Table of Contents
Constants
- ADVERT_GUEST_KEY : string = 'advert.confirmation.required.guest'
- ADVERT_LOGGED_KEY : string = 'advert.confirmation.required.logged'
- BAZAAR_MODULE : int = 5
- Modules in the settings table.
- COMCAT_MODULE : int = 6
- DISCUSSION_MODULE : int = 8
- MESSAGE_GUEST_KEY : string = 'message.confirmation.required.guest'
- MESSAGE_LOGGED_KEY : string = 'message.confirmation.required.logged'
Methods
- isRequired() : bool
- Raw setting value (`SettingContext::get()`) to required flag; a missing value (`null`) means not required.
- isRequiredFor() : bool
- Returns whether the module requires confirmation from an author of the given kind. `$loggedIn` means the record has an owner (signed-in author), not a value taken from the request data.
- isRequiredForAnyone() : bool
- Returns whether the module requires confirmation from at least one author kind (signed in or guest).
- key() : string
- Returns the setting key for the module and author kind.
Constants
ADVERT_GUEST_KEY
public
string
ADVERT_GUEST_KEY
= 'advert.confirmation.required.guest'
ADVERT_LOGGED_KEY
public
string
ADVERT_LOGGED_KEY
= 'advert.confirmation.required.logged'
BAZAAR_MODULE
Modules in the settings table.
public
int
BAZAAR_MODULE
= 5
COMCAT_MODULE
public
int
COMCAT_MODULE
= 6
DISCUSSION_MODULE
public
int
DISCUSSION_MODULE
= 8
MESSAGE_GUEST_KEY
public
string
MESSAGE_GUEST_KEY
= 'message.confirmation.required.guest'
MESSAGE_LOGGED_KEY
public
string
MESSAGE_LOGGED_KEY
= 'message.confirmation.required.logged'
Methods
isRequired()
Raw setting value (`SettingContext::get()`) to required flag; a missing value (`null`) means not required.
public
static isRequired(mixed $value) : bool
Parameters
- $value : mixed
Return values
boolisRequiredFor()
Returns whether the module requires confirmation from an author of the given kind. `$loggedIn` means the record has an owner (signed-in author), not a value taken from the request data.
public
static isRequiredFor(SettingContext $settings, int $module, bool $loggedIn) : bool
Parameters
- $settings : SettingContext
- $module : int
- $loggedIn : bool
Return values
boolisRequiredForAnyone()
Returns whether the module requires confirmation from at least one author kind (signed in or guest).
public
static isRequiredForAnyone(SettingContext $settings, int $module) : bool
Parameters
- $settings : SettingContext
- $module : int
Return values
boolkey()
Returns the setting key for the module and author kind.
public
static key(int $module, bool $loggedIn) : string
Parameters
- $module : int
- $loggedIn : bool