CoolCMS API

InitialApprovalTrait

Approves a new record according to the single module setting "automatic approval" (key {@see InitialApprovalSetting::key()}: `advert.approval.auto` / `message.approval.auto`).

Shared by adverts (Bazaar, module 5), company profiles (Comcat, module 6) and discussion posts (Discussion, module 8):

  • enabled: approvedAt is set to now, so the record is published without an admin unless something else hides it (the generated active column for adverts, the approvedAt IS NOT NULL front filters for posts),
  • disabled or missing key: approvedAt is null and the record waits for admin approval.

deactivated is not derived from the setting: it is a separate state toggled by the owner or an admin, so a new record always starts active. This applies to every insert through the Api (front, external client and admin); the "approved" and "deactivated" switches an admin sets while creating a record are overwritten.

Advert managers use it through AdvertInitialApprovalTrait.

Tags
requires

Api manager providing getSettingContext() (SettingsTrait)

Table of Contents

Methods

applyInitialApproval()  : void

Methods

On this page

Search results