[tl] Anonymous Posting

xF2 Add-on [tl] Anonymous Posting 2.1.3

No permission to download

Lordnikon22

Member
Registered
Joined
Jul 12, 2022
Messages
23
Points
13

Reputation:

I have in my forum the Dragon Byte Credit system, awards, trophy points, etc...

What happens with anonymous users, they would still be getting these?
 

Lordnikon22

Member
Registered
Joined
Jul 12, 2022
Messages
23
Points
13

Reputation:

I have a problem, only the first post created can public as anonymous, all the replies don't have the Cehck Box option to be anonymous, bot even the OP of the thread.

Screenshot_16.png


Could someone help please?
 
Last edited:

Lordnikon22

Member
Registered
Joined
Jul 12, 2022
Messages
23
Points
13

Reputation:

I just installed the plugin (from here last version) installed without problem, but i only see the option to Check the Box on the First thread.
In the rest of the post/replies, i don't see the CheckBox.

Anony problem.png


Screenshot_20.png

Permissions are all set up correctly to every user group.

Screenshot_18.png

I already searched everywhere about this problem and can't find a solution, if someone knows really well XENFORO & PHP, we could connect trough AnyDesk to see if someone of you could help with this annoying problem.

PD: I'ts not a theme problem since i tried with the default one, and the same happens.
PD2: Not a conflict addon neither, i disabled all addons and let only this one active, same problem.
 
Last edited:

sucre13

Moderator
Staff member
Moderator
Collaborate
Registered
Joined
Jan 19, 2019
Messages
836
Points
153

Reputation:

What version of PHP are you using?
 

sucre13

Moderator
Staff member
Moderator
Collaborate
Registered
Joined
Jan 19, 2019
Messages
836
Points
153

Reputation:

use php 7.4 to see if the problem is solved
 

Lordnikon22

Member
Registered
Joined
Jul 12, 2022
Messages
23
Points
13

Reputation:

The tap_anonymous_macros template looks like this:

PHP:
<xf:macro name="post_note" arg-post="!" arg-thread="!">
    <xf:if is="$post.tap_has_anonymous AND $xf.visitor.hasNodePermission($thread.node_id, 'tap_canView')">
        <div class="blockMessage blockMessage--important blockMessage--isAnonymous"><strong>{{ phrase('note:') }}</strong> {{ phrase('tap_this_is_anonymous_post') }}</div>
    </xf:if>
</xf:macro>

<xf:macro name="checkbox" arg-selected="{{ false }}" arg-context="{{ null }}">
    <xf:if is="$context == 'quick_reply'">
        <div style="padding:6px">
            <xf:checkbox>
                <xf:option name="tap_is_anonymous_posting" value="1"
                           hint="{{ phrase('tap_posting_as_anonymous_field_explain') }}"
                           selected="{$selected}"
                           label="{{ phrase('tap_posting_as_anonymous') }}" />
            </xf:checkbox>
        </div>
    <xf:else />
        <xf:checkboxrow label="">
            <xf:option name="tap_is_anonymous_posting" value="1"
                       hint="{{ phrase('tap_posting_as_anonymous_field_explain') }}"
                       selected="{$selected}"
                       label="{{ phrase('tap_posting_as_anonymous') }}" />
        </xf:checkboxrow>
    </xf:if>
</xf:macro>

Should i change something here?
 

Lordnikon22

Member
Registered
Joined
Jul 12, 2022
Messages
23
Points
13

Reputation:

💡UPDATE:

Hey!

I found the fucking problem (fresh local install):


When the Attachment permissions is disabled, the user in that group will not see the Checkbox to post as anon on replies, this don't affect the first post. (this bug happens on a fresh installation of XF too)

This must be a bug on the addon itself, attachment permission shouldn't affect this like it does.

If someone have any idea how i can fix it? (keeping the attachment permission disabled)

PD: I know i can disable the attachment buton with something like display: none on the CSS, but the attachment function will still there and if someone drag & drop and image it will be uploaded.
 

Lordnikon22

Member
Registered
Joined
Jul 12, 2022
Messages
23
Points
13

Reputation:

To "partialy" solve it, you can add this lines on EXTRA.LESS:

HTML:
/* Disable upload option in the toolbar, keep the upload via link option */
#imageUpload-1 {
  display: none !important;
}
.fr-popup .fr-image-upload-layer {
  display: none !important;
}
/* Disable the attachment upload button */
.js-attachButton {
  display: none;
}

NOTE: This will not prevent ppl from still uploading images via "Drag & Drop", so we still need a real solution at code lvl.
 

BattleKing

Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
Joined
May 24, 2020
Messages
3,519
Points
523

Reputation:

To "partialy" solve it, you can add this lines on EXTRA.LESS:

HTML:
/* Disable upload option in the toolbar, keep the upload via link option */
#imageUpload-1 {
  display: none !important;
}
.fr-popup .fr-image-upload-layer {
  display: none !important;
}
/* Disable the attachment upload button */
.js-attachButton {
  display: none;
}

NOTE: This will not prevent ppl from still uploading images via "Drag & Drop", so we still need a real solution at code lvl.
Lordnikon22
(i can pay if the problem is solved sucesfully)
The problem
can be solved easily by changing the template modification.
The application use the variable AttachmentData.context to get the thread and thread_id, this is bad behavior.

Here the instruction to solve it:

Edit template modification: quick_reply_macros​

Template: quick_reply_macros
Modification key: tap_quick_reply_macros

from:
PHP:
<xf:callback class="Truonglv\AnonymousPosting\Callback"
             method="renderAnonymousPostingCheckbox"
             params="{'context': $attachmentData.context}"/>
$0
to:
PHP:
<xf:callback class="Truonglv\AnonymousPosting\Callback"
             method="renderAnonymousPostingCheckbox"
             params="{'context': $thread}"/>
$0

thats it.
or possibly if $thread do not work this one:
PHP:
<xf:callback class="Truonglv\AnonymousPosting\Callback"
             method="renderAnonymousPostingCheckbox"
             params="{'context': $__globals.thread}"/>
$0
 
Last edited:

BattleKing

Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
Joined
May 24, 2020
Messages
3,519
Points
523

Reputation:

Issue found and solved, will move now first all posts into the discussion thread
 

Lordnikon22

Member
Registered
Joined
Jul 12, 2022
Messages
23
Points
13

Reputation:

This is my quick_reply_macros tempate:


PHP:
<xf:macro name="body"
    arg-message=""
    arg-attachmentData="{{ null }}"
    arg-forceHash=""
    arg-messageSelector=""
    arg-multiQuoteHref=""
    arg-multiQuoteStorageKey=""
    arg-simple="{{ false }}"
    arg-submitText=""
    arg-lastDate="0"
    arg-lastKnownDate="0"
    arg-loadExtra="{{ true }}"
    arg-simpleSubmit="{{ false }}"
    arg-minHeight="100"
    arg-placeholder="{{ phrase('reply_placeholder') }}"
    arg-deferred="{{ false }}"
    arg-showGuestControls="{{ true }}"
    arg-previewUrl="">

    <xf:css src="message.less" />
    <xf:set var="$sticky" value="{{ property('messageSticky') }}" />

    <div class="message message--quickReply block-topRadiusContent block-bottomRadiusContent{{ $simple ? ' message--simple' : '' }}">
        <div class="message-inner">
            <div class="message-cell message-cell--user">
                <div class="message-user {{ $sticky.user_info ? 'is-sticky' : '' }}">
                    <div class="message-avatar">
                        <div class="message-avatar-wrapper">
                            <xf:set var="$user" value="{{ $xf.visitor.user_id ? $xf.visitor : null }}" />
                            <xf:avatar user="$user" size="{{ $simple ? 's' : 'm' }}" defaultname="" />
                        </div>
                    </div>
                    <span class="message-userArrow"></span>
                </div>
            </div>
            <div class="message-cell message-cell--main">
                <div class="message-editorWrapper">
                    <xf:set var="$editorHtml">
                        <xf:macro name="editor"
                            arg-message="{$message}"
                            arg-attachmentData="{$attachmentData}"
                            arg-forceHash="{$forceHash}"
                            arg-messageSelector="{$messageSelector}"
                            arg-multiQuoteHref="{$multiQuoteHref}"
                            arg-multiQuoteStorageKey="{$multiQuoteStorageKey}"
                            arg-minHeight="{$minHeight}"
                            arg-placeholder="{$placeholder}"
                            arg-submitText="{$submitText}"
                            arg-deferred="{$deferred}"
                            arg-lastDate="{$lastDate}"
                            arg-lastKnownDate="{$lastKnownDate}"
                            arg-loadExtra="{$loadExtra}"
                            arg-simpleSubmit="{$simpleSubmit}"
                            arg-showGuestControls="{$showGuestControls}"
                            arg-previewUrl="{$previewUrl}"
                        />
                    </xf:set>

                    <xf:if is="$deferred">
                        <div class="editorPlaceholder" data-xf-click="editor-placeholder">
                            <div class="editorPlaceholder-editor is-hidden">{$editorHtml|raw}</div>
                            <div class="editorPlaceholder-placeholder">
                                <div class="input"><span class="u-muted"> {$placeholder}</span></div>
                            </div>
                        </div>
                    <xf:else />
                        {$editorHtml|raw}
                    </xf:if>
                </div>
            </div>
        </div>
    </div>
</xf:macro>

<xf:macro name="editor"
    arg-message=""
    arg-attachmentData="{{ null }}"
    arg-forceHash=""
    arg-messageSelector=""
    arg-multiQuoteHref=""
    arg-multiQuoteStorageKey=""
    arg-minHeight="100"
    arg-placeholder=""
    arg-submitText=""
    arg-deferred="{{ false }}"
    arg-lastDate="0"
    arg-lastKnownDate="0"
    arg-loadExtra="{{ true }}"
    arg-simpleSubmit="{{ false }}"
    arg-showGuestControls="{{ true }}"
    arg-previewUrl=""
>
    <xf:editor name="message"
        value="{$message}"
        attachments="{{ $attachmentData ? $attachmentData.attachments : [] }}"
        data-min-height="{$minHeight}"
        placeholder="{$placeholder}"
        data-deferred="{{ $deferred ? 'on' : 'off' }}"
        data-xf-key="{{ phrase('shortcut.quick_reply') }}"
        data-preview-url="{$previewUrl}" />

    <xf:if is="!$xf.visitor.user_id && $showGuestControls">
        <xf:textboxrow name="_xfUsername" rowtype="fullWidth noGutter" data-xf-init="guest-username"
            maxlength="{{ max_length($xf.visitor, 'username') }}"
            label="{{ phrase('name') }}" />
    </xf:if>
    <xf:if is="$xf.visitor.isShownCaptcha()">
        <div class="js-captchaContainer" data-row-type="fullWidth noGutter"></div>
        <noscript><xf:hiddenval name="no_captcha" value="1" /></noscript>
    </xf:if>

    <xf:if is="$attachmentData">
        <xf:macro template="helper_attach_upload" name="uploaded_files_list"
            arg-attachments="{$attachmentData.attachments}"
            arg-class="attachmentUploads--spaced" />
    </xf:if>

    <div class="formButtonGroup {{ $simpleSubmit ? 'formButtonGroup--simple' : '' }}">
        <div class="formButtonGroup-primary">
            <xf:button type="submit" class="button--primary" icon="reply">
                {{ $submitText ?: phrase('post_reply') }}
            </xf:button>
        </div>
        <xf:if contentcheck="true">
            <div class="formButtonGroup-extra">
                <xf:contentcheck>
                    <xf:if is="$attachmentData">
                        <xf:macro template="helper_attach_upload" name="upload_link_from_data"
                            arg-attachmentData="{$attachmentData}"
                            arg-forceHash="{$forceHash}" />
                    </xf:if>
                    <xf:if is="$xf.options.multiQuote && $multiQuoteHref">
                        <xf:macro template="multi_quote_macros" name="button"
                            arg-href="{$multiQuoteHref}"
                            arg-messageSelector="{$messageSelector}"
                            arg-storageKey="{$multiQuoteStorageKey}" />
                    </xf:if>
                </xf:contentcheck>
            </div>
        </xf:if>
        <xf:hiddenval name="last_date" autocomplete="off">{$lastDate}</xf:hiddenval>
        <xf:hiddenval name="last_known_date" autocomplete="off">{$lastKnownDate}</xf:hiddenval>
        <xf:hiddenval name="load_extra">{{ $loadExtra ? 1 : 0 }}</xf:hiddenval>
    </div>
</xf:macro>

Can't find that line.
 
Last edited:

BattleKing

Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
Joined
May 24, 2020
Messages
3,519
Points
523

Reputation:

This is my quick_reply_macros tempate:


PHP:
<xf:macro name="body"
    arg-message=""
    arg-attachmentData="{{ null }}"
    arg-forceHash=""
    arg-messageSelector=""
    arg-multiQuoteHref=""
    arg-multiQuoteStorageKey=""
    arg-simple="{{ false }}"
    arg-submitText=""
    arg-lastDate="0"
    arg-lastKnownDate="0"
    arg-loadExtra="{{ true }}"
    arg-simpleSubmit="{{ false }}"
    arg-minHeight="100"
    arg-placeholder="{{ phrase('reply_placeholder') }}"
    arg-deferred="{{ false }}"
    arg-showGuestControls="{{ true }}"
    arg-previewUrl="">

    <xf:css src="message.less" />
    <xf:set var="$sticky" value="{{ property('messageSticky') }}" />

    <div class="message message--quickReply block-topRadiusContent block-bottomRadiusContent{{ $simple ? ' message--simple' : '' }}">
        <div class="message-inner">
            <div class="message-cell message-cell--user">
                <div class="message-user {{ $sticky.user_info ? 'is-sticky' : '' }}">
                    <div class="message-avatar">
                        <div class="message-avatar-wrapper">
                            <xf:set var="$user" value="{{ $xf.visitor.user_id ? $xf.visitor : null }}" />
                            <xf:avatar user="$user" size="{{ $simple ? 's' : 'm' }}" defaultname="" />
                        </div>
                    </div>
                    <span class="message-userArrow"></span>
                </div>
            </div>
            <div class="message-cell message-cell--main">
                <div class="message-editorWrapper">
                    <xf:set var="$editorHtml">
                        <xf:macro name="editor"
                            arg-message="{$message}"
                            arg-attachmentData="{$attachmentData}"
                            arg-forceHash="{$forceHash}"
                            arg-messageSelector="{$messageSelector}"
                            arg-multiQuoteHref="{$multiQuoteHref}"
                            arg-multiQuoteStorageKey="{$multiQuoteStorageKey}"
                            arg-minHeight="{$minHeight}"
                            arg-placeholder="{$placeholder}"
                            arg-submitText="{$submitText}"
                            arg-deferred="{$deferred}"
                            arg-lastDate="{$lastDate}"
                            arg-lastKnownDate="{$lastKnownDate}"
                            arg-loadExtra="{$loadExtra}"
                            arg-simpleSubmit="{$simpleSubmit}"
                            arg-showGuestControls="{$showGuestControls}"
                            arg-previewUrl="{$previewUrl}"
                        />
                    </xf:set>

                    <xf:if is="$deferred">
                        <div class="editorPlaceholder" data-xf-click="editor-placeholder">
                            <div class="editorPlaceholder-editor is-hidden">{$editorHtml|raw}</div>
                            <div class="editorPlaceholder-placeholder">
                                <div class="input"><span class="u-muted"> {$placeholder}</span></div>
                            </div>
                        </div>
                    <xf:else />
                        {$editorHtml|raw}
                    </xf:if>
                </div>
            </div>
        </div>
    </div>
</xf:macro>

<xf:macro name="editor"
    arg-message=""
    arg-attachmentData="{{ null }}"
    arg-forceHash=""
    arg-messageSelector=""
    arg-multiQuoteHref=""
    arg-multiQuoteStorageKey=""
    arg-minHeight="100"
    arg-placeholder=""
    arg-submitText=""
    arg-deferred="{{ false }}"
    arg-lastDate="0"
    arg-lastKnownDate="0"
    arg-loadExtra="{{ true }}"
    arg-simpleSubmit="{{ false }}"
    arg-showGuestControls="{{ true }}"
    arg-previewUrl=""
>
    <xf:editor name="message"
        value="{$message}"
        attachments="{{ $attachmentData ? $attachmentData.attachments : [] }}"
        data-min-height="{$minHeight}"
        placeholder="{$placeholder}"
        data-deferred="{{ $deferred ? 'on' : 'off' }}"
        data-xf-key="{{ phrase('shortcut.quick_reply') }}"
        data-preview-url="{$previewUrl}" />

    <xf:if is="!$xf.visitor.user_id && $showGuestControls">
        <xf:textboxrow name="_xfUsername" rowtype="fullWidth noGutter" data-xf-init="guest-username"
            maxlength="{{ max_length($xf.visitor, 'username') }}"
            label="{{ phrase('name') }}" />
    </xf:if>
    <xf:if is="$xf.visitor.isShownCaptcha()">
        <div class="js-captchaContainer" data-row-type="fullWidth noGutter"></div>
        <noscript><xf:hiddenval name="no_captcha" value="1" /></noscript>
    </xf:if>

    <xf:if is="$attachmentData">
        <xf:macro template="helper_attach_upload" name="uploaded_files_list"
            arg-attachments="{$attachmentData.attachments}"
            arg-class="attachmentUploads--spaced" />
    </xf:if>

    <div class="formButtonGroup {{ $simpleSubmit ? 'formButtonGroup--simple' : '' }}">
        <div class="formButtonGroup-primary">
            <xf:button type="submit" class="button--primary" icon="reply">
                {{ $submitText ?: phrase('post_reply') }}
            </xf:button>
        </div>
        <xf:if contentcheck="true">
            <div class="formButtonGroup-extra">
                <xf:contentcheck>
                    <xf:if is="$attachmentData">
                        <xf:macro template="helper_attach_upload" name="upload_link_from_data"
                            arg-attachmentData="{$attachmentData}"
                            arg-forceHash="{$forceHash}" />
                    </xf:if>
                    <xf:if is="$xf.options.multiQuote && $multiQuoteHref">
                        <xf:macro template="multi_quote_macros" name="button"
                            arg-href="{$multiQuoteHref}"
                            arg-messageSelector="{$messageSelector}"
                            arg-storageKey="{$multiQuoteStorageKey}" />
                    </xf:if>
                </xf:contentcheck>
            </div>
        </xf:if>
        <xf:hiddenval name="last_date" autocomplete="off">{$lastDate}</xf:hiddenval>
        <xf:hiddenval name="last_known_date" autocomplete="off">{$lastKnownDate}</xf:hiddenval>
        <xf:hiddenval name="load_extra">{{ $loadExtra ? 1 : 0 }}</xf:hiddenval>
    </div>
</xf:macro>

Can't find that line.
Lordnikon22sorry my mistake and not clear enough, it is the template modification which you need to change, the one from the addon

1699369605195.png
 
Top