A lot of things
This commit is contained in:
41
XF/Entity/ApprovalQueue.php
Normal file
41
XF/Entity/ApprovalQueue.php
Normal 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,
|
||||
]);
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,4 +15,9 @@ class User extends XFCP_User
|
||||
|
||||
return $structure;
|
||||
}
|
||||
|
||||
public function canCreateEntry()
|
||||
{
|
||||
return \XF::visitor()->hasPermission('romhackplaza', 'canSubmitEntry');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user