XF 1.4 Can I generate links on the user's requiring approval page based on registration fields?

cheracc

Member
I don't know if this is possible without an addon, but this is what I would like to do.

My website is a Minecraft community forum, and I don't want players getting on the server before they register on the website. We check usernames against a ban database before approving them, and the approval is done through PHP. So really, all I need is to generate some links on the "Users awaiting approval" page that my moderators can click on to approve/deny the user.

If I didn't explain myself well enough or you have questions, let me know.
 
You could possibly do it with a custom user field which is moderator editable only.

upload_2015-9-4_19-6-21.webp

That could be linked to a user group promotion which provides the relevant permissions/access.
 
Yes, that could possibly work. However, it seems like the custom field's variable substitutions can only access the value of the field itself? What if I wanted to get the user's username from the registration? Could I use a field ID for that? Such as {$username}?
 
Last edited:
If you want to pass the user name through to your custom PHP code when checking the field, then that is going to require custom development.
 
Let me attempt this a different way.

I see that XenForo has an option to create Admin Template overrides by defining a new template with the name of the template you want to override. In the template XML, there is a section called users_awaiting_approval which I created with the following XML:

Code:
<xen:title>{xen:phrase users_awaiting_approval}</xen:title>

<xen:form action="{xen:adminlink 'users/moderated/update'}">
        <xen:foreach loop="$users" value="$user">
                <fieldset>
                        <xen:controlunit label="{xen:phrase user}:"><a href="{xen:adminlink users/edit, $user}" target="_blank">{$user.username}</a> ({$user.email})</xen:controlunit>
                        <xen:controlunit label="{xen:phrase joined}:"><xen:datetime time="{$user.register_date}" /></xen:controlunit>
                        <xen:if is="{$user.ip}">
                                <xen:controlunit label="{xen:phrase ip}:"><a href="{xen:link misc/ip-info, '', 'ip={$user.ip}'}" target="_blank">{$user.ip}</a> <xen:if is="{$user.ipHost}">({$user.ipHost})</xen:if></xen:controlunit>
                        </xen:if>
                        <xen:if is="{$user.spamDetails}">
                                <xen:controlunit label="{xen:phrase spam_log}:"><ul>
                                        <xen:foreach loop="{$user.spamDetails}" value="{$detail}">
                                                <li>{xen:escape $detail, false}</li>
                                        </xen:foreach>
                                </ul></xen:controlunit>
                        </xen:if>
                        <xen:controlunit label="foo">
                                this is a test link: <a href="http://example.com/whitelist?username=[{$user.username}]>check</a>
                        </xen:controlunit>
                        <xen:radiounit label="{xen:phrase action}:" name="users[{$user.user_id}][action]">
                                <xen:option value="none" selected="true">{xen:phrase do_nothing}</xen:option>
                                <xen:option value="approve">{xen:phrase approve}</xen:option>
                                <xen:option value="reject">
                                        <xen:label>{xen:phrase reject_and_delete_with_rejection_reason}:</xen:label>
                                        <xen:textbox placeholder="{xen:phrase optional}" name="users[{$user.user_id}][reject_reason]" size="45" />
                                </xen:option>
                        </xen:radiounit>
                        <xen:checkboxunit label="">
                                <xen:option name="users[{$user.user_id}][notify]" selected="!{$user.spamDetails}">{xen:phrase notify_user_if_action_was_taken}</xen:option>
                        </xen:checkboxunit>
                </fieldset>
        </xen:foreach>

        <xen:submitunit save="{xen:phrase process_users}" />
</xen:form>

Everything in there is default except for the controlunit with label="foo" that I added.

The problem is, I'm not seeing this show up when I refresh the page. Is there a way to manually rebuild the template cache without going to /install and hitting the "Rebuild Master Data" button?
 
Nevermind, I had the template name wrong. It's "user_moderated" not "users_awaiting_approval". I can edit the template under Admin Templates and the changes show up immediately. This should let me put whatever HTML I want in the Users Awaiting Approval page.
 
Top Bottom