Dr.CustUmz |
11-24-2020 07:16 AM |
Usergroup permission in template
I am trying to figure out the template condition for:
Code:
$this->registry->bf_ugp_forumpermissions['candeletethread']
I want to use it in postbit, but cant figure out the right conditional.
I have registered users set to able to delete own posts (not threads)
I have tried the following conditions within the postbit template:
Code:
<if condition="$show['deletepostoption']">
You mAy
</if>
<if condition="$show['softdeleteoption']">
You might
</if>
<if condition="$show['physicaldeleteoption']">
YES HUH
</if>
the only one that returns anything is:
Code:
<if condition="$show['deletepostoption']">
You mAy
</if>
But not for registered users. I want registered users to be able to see something if they can delete their posts.
I found this bit of code, I will be playing with it but if someone can figure it out before me it would help. Postbit_display_complete
PHP Code:
if (($postinfo['firstpostid'] == $postinfo['postid']) AND can_moderate($this->thread['forumid'], 'canmanagethreads')) { $show['deletepostoption'] = true; } else if (!$post['isfirstshown'] AND can_moderate($this->thread['forumid'], 'candeleteposts')) { $show['deletepostoption'] = true; } else if (((($forumperms & $this->registry->bf_ugp_forumpermissions['candeletepost']) AND !$post['isfirstshown']) OR (($forumperms & $this->registry->bf_ugp_forumpermissions['candeletethread']) AND $post['isfirstshown'])) AND $this->registry->userinfo['userid'] == $this->post['userid']) { $show['deletepostoption'] = true; } else { $show['deletepostoption'] = false; }
if($show['deletepostoption']){ $show['softdelete'] = iif(can_moderate($this->thread['forumid'], 'candeleteposts'), true, false); $show['harddelete'] = iif(can_moderate($this->thread['forumid'], 'canremoveposts'), true, false); }
Remember the end goal is to allow usergroups with the permission to delete their post an option within postbit
|