pbOnBeforePublished
Triggers before publishing a block or table
Parameters
| Parameter | Description |
|---|---|
| type | Type: pbBlock|pbTable |
| id | Object id |
| object | Object |
| published | Permission to published |
| message | Custom message |
Examples
Allow publishing only for moderators.
php
if ($modx->event->name === 'pbOnBeforePublished') {
if ($modx->user->id !== 2) {
$modx->event->params['published'] = false;
$modx->event->params['message'] = "You're not yet qualified to be a moderator.";
}
}