El Porcharo

Active member
I'm managing the community with quite noob admins, and I see they don't always realize there are messages waiting for approval before replying to threads, specially when they navigate the board from their mobile phone.

And honestly at the beginning of my XenForo experience, I used not to notice it neither.

Therefore I would like to simplify the approval process, to make sure they notice right away when a user reply needs to be approved.

And to make this possible, I think the better way is adding an "Approve" button in the action bar, maybe next to "Warn" button, or even better instead of the "Like" button which is hidden for unapproved posts. Just like the "Approve" button we have for threads, near the "Follow" above the first post.


So I managed to search within the templates and see what bunch of code I needed to place a button in the action bar, as I'm not a coder but not even a total noob with it...

And then I've added a new template modification for post_macros for adding two pieces of code that I found, respectively in thread_view and profile_post_macros, to see which one would have worked (after placing "posts" instead of "threads" and "comments", of course)

But this doesn't seem to work, as I get an error saying Code: invalid_action, controller: XF:Post, action: Approve after clicking the button. I assume it is maybe searching for a missing function which is not in the page code, but I definitely don't actually know how to fix this.

For the moment, the template modification finds:

PHP:
            <xf:if is="$post.canWarn()">

                <a href="{{ link('posts/warn', $post) }}"
                    class="actionBar-action actionBar-action--warn actionBar-action--menuItem">{{ phrase('warn') }}</a>

                <xf:set var="$hasActionBarMenu" value="{{ true }}" />
            <xf:elseif is="$post.warning_id && $xf.visitor.canViewWarnings()" />
                <a href="{{ link('warnings', {'warning_id': $post.warning_id}) }}"
                    class="actionBar-action actionBar-action--warn actionBar-action--menuItem"
                    data-xf-click="overlay">{{ phrase('view_warning') }}</a>
                <xf:set var="$hasActionBarMenu" value="{{ true }}" />
            </xf:if>

and replaces it with:

PHP:
            <xf:if is="$post.canWarn()">

                <a href="{{ link('posts/warn', $post) }}"
                    class="actionBar-action actionBar-action--warn actionBar-action--menuItem">{{ phrase('warn') }}</a>

                <xf:set var="$hasActionBarMenu" value="{{ true }}" />
            <xf:elseif is="$post.warning_id && $xf.visitor.canViewWarnings()" />
                <a href="{{ link('warnings', {'warning_id': $post.warning_id}) }}"
                    class="actionBar-action actionBar-action--warn actionBar-action--menuItem"
                    data-xf-click="overlay">{{ phrase('view_warning') }}</a>
                <xf:set var="$hasActionBarMenu" value="{{ true }}" />
            </xf:if>
           
            <xf:if is="$post.canApproveUnapprove()">
                <xf:button href="{{ link('posts/approve', $post) }}" class="button--link" overlay="true">{{ phrase('approve') }} 1</xf:button>
            </xf:if>

            <xf:if is="$post.canApproveUnapprove()">
                <xf:if is="$post.message_state == 'moderated'">
                    <a href="{{ link('posts/approve', $post, {'t': csrf_token()}) }}"
                       class="actionBar-action actionBar-action--approve actionBar-action--menuItem">{{ phrase('approve') }} 2</a>
                    <xf:set var="$hasActionBarMenu" value="{{ true }}" />
                    <xf:elseif is="$post.message_state == 'visible'" />
                    <a href="{{ link('posts/unapprove', $post, {'t': csrf_token()}) }}"
                       class="actionBar-action actionBar-action--unapprove actionBar-action--menuItem">{{ phrase('unapprove') }} 2</a>
                    <xf:set var="$hasActionBarMenu" value="{{ true }}" />
                </xf:if>
            </xf:if>

The numbers after the button phrase are there to allow me to understand which buttons are what.

I would appreciate if anyone could help me fixing this, and the reason why I posted in the suggestion forum, is because it would be nice to see this implemented in a future XF release.

Wouldn't it be useful?
 
Last edited:
Upvote 2

djbaxter

Well-known member
If I am not mistaken, by default more recent versions of Xenforo (e.g., 2.2.x) display a notice at the top of the thread to admins and moderators, or at least those who have permissions to approve threads:

awaiting approval.png
 

El Porcharo

Active member
Yes it does, but my "colleagues" are particularly noob :LOL: and most of the time they don't even notice it 🤷‍♂️

1618676600835.png


But a button like that would be a much quicker way to approve posts, for me as well 😇
 

djbaxter

Well-known member
Educate them.

After you install a few addons with extra buttons at the bottom of posts, it gets seriously cluttered down there and then starts to word wrap. I try to avoid adding any new ones if I can.
 
Last edited:

beerForo

Well-known member
A fool-proof way would be to not them then reply until it is approved. Perhaps you can request this modification or hide the button and box?
 
Last edited:

El Porcharo

Active member
:unsure: That would be a good alternative, but I think managing CSS with "if/else" would be a bit more complicated than adding a button, isn't it?
 
Top