vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Zoins Anonymous Posting - Help with PHP Edit. [Completed] (https://vborg.vbsupport.ru/showthread.php?t=319702)

akz645 08-02-2015 12:28 AM

Zoins Anonymous Posting - Help with PHP Edit. [Completed]
 
Quote:

Originally Posted by KimK (Post 2515918)
Hello,

For anyone who wants to add/enable a check box for post anonymously at the Quick Reply box, Here's how:

Tested and working with vBulletin 4.2.2 Patch Level 1.

It just requires one template change and 1 plugin to be created. The plugin is what allows the if statement to work on the showthread page (where the quick reply is).

1. Go to your admincp
2. Navigate to Plugins & Products, and then into Add New Plugin
3. Enter the following:

Product: Zoints Anonymous Posting
Hook Location: showthread_start
Title: Enable Anonymous Posting (Quick Reply)
Execution Order: 5
Plugin PHP Code:

PHP Code:


$show
['anonymous'] = false;
if (
$vbulletin->options['zointsanony_enabled'] AND $vbulletin->options['zointsanony_userid'])
{
    
$anonyforums explode(',',$vbulletin->options['zointsanony_forums']);
    foreach (
$anonyforums AS $fid)
    {
        if (
$fid == $forumid)
        {
            
$show['anonymous'] = true;
        }
    }


4. Set plugin to Active.
5. Save
6. Go to your Style Manager and edit the following template SHOWTHREAD.

Find:

PHP Code:


<li><label for="cb_openclose">
                    <
input type="checkbox" name="openclose" id="cb_openclose" value="1" tabindex="1" />
                    <
vb:if condition="$show['closethread']">{vb:rawphrase close_this_thread}<vb:else />{vb:rawphrase reopen_this_thread}</vb:if>
                </
label></li


Below, Add:


PHP Code:


<vb:if condition="$show['anonymous']"><div><input type="checkbox" id="cb_anonymous" class="bginput" name="anonymous" value="1" checked="checked" /> {vb:rawphrase zointsanony_anonymous_post}</div></vb:if> 


7. Save

Now go to a thread in a forum where you have Anonymous posting enabled, and you should see the Quick Reply Anonymous option at Quick Reply box.

Thanks to vespillo and New Joe for the help. I collected the information above from their replies.

Basically. that solution still has the following issues:
- Users who can't open/close a thread, can't view the quick reply checkbox to post anonymously.
- The box is checked by default, I want it unchecked.

How do I do this?

MarkFL 08-02-2015 01:30 AM

What you want to do is create a new plugin as follows:

Product: Zoints Anonymous Posting

Hook Location: showthread_complete

Title: Enable Anonymous Posting on Quick Reply

Execution Order: 5

Plugin PHP Code:

PHP Code:

$show['anonymous'] = false;
if (
$vbulletin->options['zointsanony_enabled'] AND $vbulletin->options['zointsanony_userid'])
{
    
$anonyforums explode(',',$vbulletin->options['zointsanony_forums']);
    foreach (
$anonyforums AS $fid)
    {
        if (
$fid == $forumid)
        {
            
$show['anonymous'] = true;
        }
    }


Next, in your "SHOWTHREAD" template, locate the code:

HTML Code:

                <vb:if condition="$show['openclose']">
                <div class="openclose">
                        <ul class="checkradio">
                                <li><label for="cb_openclose">
                                        <input type="checkbox" name="openclose" id="cb_openclose" value="1" tabindex="1" />
                                        <vb:if condition="$show['closethread']">{vb:rawphrase close_this_thread}<vb:else />{vb:rawphrase reopen_this_thread}</vb:if>
                                </label></li>
                        </ul>
                </div>
                </vb:if>

And below this, add:

HTML Code:

                <vb:if condition="$show['anonymous']">
                        <div class="openclose">
                                <ul class="checkradio">
                                        <li>
                                                <input type="checkbox" id="cb_anonymous" class="bginput" name="anonymous" value="1" /> {vb:rawphrase zointsanony_anonymous_post}
                                        </li>
                                </ul>
                        </div>
                </vb:if>

--------------- Added [DATE]1438487758[/DATE] at [TIME]1438487758[/TIME] ---------------

Quote:

Originally Posted by akz645 (Post 2551916)
Nevermind I fixed the issue myself :D

@Mods
Delete this thread please.

Please, in the future if you post a question and then find a solution, rather than gutting your original post (devaluing the thread) and asking for the thread to be deleted, go ahead and post your solution for the benefit of the community. :)

akz645 08-02-2015 03:21 AM

Ah, thanks for posting that. I thought I edited it out before anybody got a chance to see it (hence avoid wasting their time).
I posted the solution onto the thread itself, as that's more relevant than posting it here.

Your solution is actually slightly different and better (edited into the solution post now). I learnt how to position the check box better (no idea what </ul> did) :)

Thanks anyway though :)
*Edited my original post back (more or less), since you took the time to post an answer*

MarkFL 08-02-2015 03:46 AM

If you wish for this to work for certain usergroups only, then change the template conditional to read:

PHP Code:

<vb:if condition="$show['anonymous'] and is_member_of($bbuserinfo, X,Y,...)"

where X,Y... is the comma-delimited list of usergroups you want to allow. :)

akz645 08-02-2015 04:04 AM

Quote:

Originally Posted by MarkFL (Post 2551927)
If you wish for this to work for certain usergroups only, then change the template conditional to read:

PHP Code:

<vb:if condition="$show['anonymous'] and is_member_of($bbuserinfo, X,Y,...)"

where X,Y... is the comma-delimited list of usergroups you want to allow. :)

https://vborg.vbsupport.ru/showpost....&postcount=196
Cheers. Added to my next post.

Elixar 08-02-2015 04:00 PM

What would be really awesome is to allow who can see the username of the actual poster in the postbit. :D

Elixar 12-27-2015 05:03 PM

Quote:

Originally Posted by Elixar (Post 2551961)
What would be really awesome is to allow who can see the username of the actual poster in the postbit. :D

Bump. :D

akz645 12-31-2015 08:27 PM

Quote:

Originally Posted by Elixar (Post 2551961)
What would be really awesome is to allow who can see the username of the actual poster in the postbit. :D

You should be posting that request on the actual modification thread.


All times are GMT. The time now is 07:08 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01110 seconds
  • Memory Usage 1,771KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_html_printable
  • (6)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete