Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
newbie LAC Posted May 6, 2020 Posted May 6, 2020 Hello, How to add new actions in the comment multimod actions menu? You have /** * Actions to show in comment multi-mod * * @param \IPS\Member $member Member (NULL for currently logged in member) * @return array */ public function commentMultimodActions( \IPS\Member $member = NULL ) { Looks like I can use this. \applications\forums\dev\html\front\topics\post.phtml {{if \count( $item->commentMultimodActions() ) and !$comment->mapped('first')}} <li class='cPost_moderator'><span class='ipsCustomInput'> <input type="checkbox" name="multimod[{$comment->$idField}]" value="1" data-role="moderation" data-actions="{{if $comment->canSplit()}}split merge{{endif}} {{if $comment->hidden() === -1 AND $comment->canUnhide()}}unhide{{elseif $comment->hidden() === 1 AND $comment->canUnhide()}}approve{{elseif $comment->canHide()}}hide{{endif}} {{if $comment->canDelete()}}delete{{endif}}" data-state='{{if $comment->tableStates()}}{$comment->tableStates()}{{endif}}'> <span></span> </span></li> {{endif}} All actions are hardcoded. \applications\core\dev\html\front\global\commentMultimod.phtml <input type="hidden" name="csrfKey" value="{expression="\IPS\Session::i()->csrfKey"}" /> {{$method = $type . 'MultimodActions';}} {{if $actions = $item->$method() and \count( $actions )}} <div class="ipsClearfix"> <div class="ipsAreaBackground ipsPad ipsClearfix ipsJS_hide" data-role="pageActionOptions"> <div class="ipsPos_right"> <select name="modaction" data-role="moderationAction"> {{if \in_array( 'approve', $actions )}} <option value='approve' data-icon='check-circle'>{lang="approve"}</option> {{endif}} {{if \in_array( 'split_merge', $actions )}} <option value='split' data-icon='expand'>{lang="split"}</option> <option value='merge' data-icon='level-up'>{lang="merge"}</option> {{endif}} {{if \in_array( 'hide', $actions ) or \in_array( 'unhide', $actions )}} <optgroup label="{lang="hide"}" data-icon='eye' data-action='hide'> {{if \in_array( 'hide', $actions )}} <option value='hide'>{lang="hide"}</option> {{endif}} {{if \in_array( 'unhide', $actions )}} <option value='unhide'>{lang="unhide"}</option> {{endif}} </optgroup> {{endif}} {{if \in_array( 'delete', $actions )}} <option value='delete' data-icon='trash'>{lang="delete"}</option> {{endif}} </select> <button type="submit" class="ipsButton ipsButton_alternate ipsButton_verySmall">{lang="submit"}</button> </div> </div> </div> {{endif}} Again you only check specific actions. In this case I should to create Template Hooks to add my actions.
bfarber Posted May 6, 2020 Posted May 6, 2020 Are you unable to use template hooks to add the new actions?
newbie LAC Posted May 6, 2020 Author Posted May 6, 2020 I want to only use $item->commentMultimodActions() which will add automatically new actions. 2 minutes ago, bfarber said: Are you unable to use template hooks to add the new actions? This is an additional work.
Adriano Faria Posted June 29, 2020 Posted June 29, 2020 On 5/6/2020 at 9:53 AM, bfarber said: Are you unable to use template hooks to add the new actions? Hello, is this fixed in 4.5?
bfarber Posted June 29, 2020 Posted June 29, 2020 I don't know that this specific request was directly addressed, however templates were pretty heavily overhauled so it's possible it was inadvertently changed.
Recommended Posts