feat: lit/tb-create-template – disabled templates, all or nothing
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -124,7 +124,10 @@ class ThemeBuilderAccess
|
||||
return $post;
|
||||
}
|
||||
|
||||
/** Template $templateId for the Theme Builder tools; any other ID, or a hidden Theme Builder, is not found. */
|
||||
/**
|
||||
* Template $templateId for the Theme Builder tools. Any other ID, a hidden Theme Builder and a template the
|
||||
* user may not edit (canEditTemplate) answer identically: not found (ruling Q18, P12 – like tb-list, Q8/B11).
|
||||
*/
|
||||
public function template(mixed $templateId, bool $forWrite): WP_Post|WP_Error
|
||||
{
|
||||
$id = PostGuard::id($templateId);
|
||||
@@ -140,7 +143,7 @@ class ThemeBuilderAccess
|
||||
! $post instanceof WP_Post
|
||||
|| $post->post_type !== DiviThemeBuilder::TEMPLATE
|
||||
|| (string) $post->post_status !== 'publish'
|
||||
|| ! $this->visible()
|
||||
|| ! $this->canEditTemplate($id)
|
||||
) {
|
||||
return Errors::notFound(
|
||||
sprintf('Theme-Builder-Vorlage %d gibt es nicht.', $id),
|
||||
@@ -148,10 +151,6 @@ class ThemeBuilderAccess
|
||||
);
|
||||
}
|
||||
|
||||
if (! current_user_can('edit_post', $id)) {
|
||||
return Errors::forbidden(sprintf('Keine Berechtigung, Theme-Builder-Vorlage %d zu bearbeiten.', $id));
|
||||
}
|
||||
|
||||
return $forWrite ? ($this->writableGate() ?? $post) : $post;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user