CoolCMS API

EmailConfirmationSetting
in package

FinalYes

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: advert insertUserId, post userId; 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> is advert (Bazaar, Comcat) or message (Discussion). The dotted convention: the module is carried by the module column, 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

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
bool

isRequiredFor()

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
bool

isRequiredForAnyone()

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
bool

key()

Returns the setting key for the module and author kind.

public static key(int $module, bool $loggedIn) : string
Parameters
$module : int
$loggedIn : bool
Tags
throws
InvalidArgumentException

when the module has no e-mail confirmation

Return values
string
On this page

Search results