A lot of things

This commit is contained in:
2026-06-16 16:21:43 +02:00
parent 4415a2e8c4
commit 73471162bf
37 changed files with 654 additions and 4 deletions

View File

@@ -0,0 +1,41 @@
<?php
namespace RomhackPlaza\Master\XF\Entity;
use RomhackPlaza\Master\Helper\Helpers;
class ApprovalQueue extends XFCP_ApprovalQueue
{
protected function _postSave()
{
parent::_postSave();
if( $this->isInsert() ){
$contentId = $this->content_id;
$contentType = $this->content_type;
\XF::runLater(function () use ($contentId, $contentType) {
$entity = \XF::app()->getContentTypeFieldValue($contentType, 'entity');
if( !$entity ){
return;
}
$content = \XF::em()->find($entity, $contentId);
$user = $contentType === 'user' ? $content : $content->User;
$service = \XF::service('RomhackPlaza\Master:Discord\BotService');
$service->createAction( 'approval_queue', [
'content_title' => Helpers::getContentTitle( $content, $contentType ),
'approval_item_url' => \XF::app()->router('public')->buildLink('canonical:approval-queue' ),
'approval_username' => $user?->username ?? '',
'approval_user_url' => $user?->user_id ? \XF::app()->router('public')->buildLink('canonical:members', $user ) : '',
'content_type' => $contentType,
]);
});
}
}
}

View File

@@ -15,4 +15,9 @@ class User extends XFCP_User
return $structure;
}
public function canCreateEntry()
{
return \XF::visitor()->hasPermission('romhackplaza', 'canSubmitEntry');
}
}