vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Show Thread Enhancements - Private Debates (https://vborg.vbsupport.ru/showthread.php?t=122897)

jailer 12-11-2006 08:01 AM

*subscribes to thread*

Hopefully the developer will think about upgrading this.
I'd love to install this, but it's missing that vital username entry instead of user ID.


*edit*
Tried it anyway.
Didn't work for me?
:surprised:
Not showing up in AdminCP.

http://img242.imageshack.us/img242/6...ed2copyyw0.jpg

apokphp 12-21-2006 03:44 PM

Seems to be working fine. However, how can I make it a PUBLIC thread, open to all members, once X # of posts have been made in the private debate thread?

Is there an easy conditional for that? Say to just make the thread public after 12 or so posts?

bairy 12-26-2006 01:11 PM

A request was made in Service Requests to do this via username instead of userid.
It's not a big change and I was bored so ... happy holidays...


Empty the plugin named "Save private debate data", location: "newthread_post_complete", and put the following in it:
Code:

$vbulletin->input->clean_gpc('p', 'tdebates', TYPE_STR);
if($vbulletin->GPC['tdebates'] = trim($vbulletin->GPC['tdebates']))
{
        $tdebatesnames = explode(",", $vbulletin->GPC['tdebates']);
        foreach ($tdebatesnames AS $name)
        {
                $name = $db->escape_string(htmlspecialchars_uni(trim($name)));
                $querywhere .= ",'$name'";
        }
        $querywhere = substr($querywhere, 1);
       
        $tquery = $db->query_read("SELECT userid FROM " . TABLE_PREFIX ."user AS user WHERE username IN ($querywhere)");
       
        while ($row = $db->fetch_array($tquery))
        {
                $tuserids .= "," . $row['userid'];
        }
        $tuserids = substr($tuserids, 1);
       
        $db->query_write("UPDATE " . TABLE_PREFIX . "thread SET debates = '" . $tuserids . "' WHERE threadid = " . $newpost['threadid'] . "");
       
        $db->free_result($tquery);
        unset ($censorwords, $a, $tquery, $querywhere, $tdebatesnames);
}


Empty the plugin named: "thread to debate", location: "threadmanage_action_switch" and put the following in it:
Code:

if ($_REQUEST['do'] == 'tdebates')
{
        // only mods with the correct permissions should be able to access this
        if (!can_moderate($threadinfo['forumid'], 'candeleteposts'))
        {
                print_no_permission();
        }
       
        // check if there is a forum password and if so, ensure the user has it set
        verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
       
        // draw navbar
        eval('$navbar = "' . fetch_template('navbar') . '";');
       
        if (trim($threadinfo['debates'] != ''))
        {
                $threadinfo['debates'] = ',' . $threadinfo['debates'];
        }
        $query = $db->query_read("SELECT username FROM " . TABLE_PREFIX . "user AS user WHERE userid IN (0$threadinfo[debates])");
        $threadinfo['debates'] = '';
        while ($row = $db->fetch_array($query))
        {
                $threadinfo['debates'] .= ", " . $row['username'];
        }
        $threadinfo['debates'] = substr($threadinfo['debates'], 2);
       
        // spit out the final HTML if we have got this far
        eval('$HTML = "' . fetch_template('threadadmin_tdebates') . '";');
        eval('print_output("' . fetch_template('THREADADMIN') . '");');
        exit;
}

elseif ($_POST['do'] == 'dotdebates')
{
        $vbulletin->input->clean_gpc('r', 'tdebates', TYPE_STR);
       
        // only mods with the correct permissions should be able to access this
        if (!can_moderate($threadinfo['forumid'], 'candeleteposts'))
        {
                print_no_permission();
        }
       
        // check if there is a forum password and if so, ensure the user has it set
        verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
       
        $vbulletin->GPC['tdebates'] = trim($vbulletin->GPC['tdebates']);
        $tdebatesnames = explode(",", $vbulletin->GPC['tdebates']);
        foreach ($tdebatesnames AS $name)
        {
                $name = $db->escape_string(htmlspecialchars_uni(trim($name)));
                $querywhere .= ",'$name'";
        }
        $querywhere = substr($querywhere, 1);
       
        $tquery = $db->query_read("SELECT userid FROM " . TABLE_PREFIX ."user AS user WHERE username IN ($querywhere)");
       
        while ($row = $db->fetch_array($tquery))
        {
                $tuserids .= "," . $row['userid'];
        }
        $tuserids = substr($tuserids, 1);
       
        $db->free_result($tquery);
        unset ($censorwords, $a, $tquery, $querywhere, $tdebatesnames);
       
        $db->query_write("UPDATE " . TABLE_PREFIX . "thread SET debates = '" . $tuserids . "' WHERE threadid = '" . $threadid . "'");
        $tdebates_phrase = 'Private debate';
        $redirect='redirect_done_dotdebates';
       
        log_moderator_action($threadinfo,'tdebates',$tdebates_phrase);
        $vbulletin->url = 'showthread.php?' . "t=" . $threadid . "";
        eval(print_standard_redirect($redirect, true, true));
        exit;
}

Important: chosen usernames must be seperated by a comma (because some usernames have spaces), so you'll want to change the word "space" to "comma" in the templates:
Debates Templates > tdebates_newthread.
Thread Administration Templates > threadadmin_tdebates

Notes:
= If a non existant username is inputted, it will be ignored. If no valid usernames are inputted, it will not be a private-debate thread.
= I've copied the PM system's way of parsing usernames, therefore special characters and stuff should be accounted for. Or in other words: any valid username should work. However, it's still dependant on how the browser transmits special characters, so it's not 100% guaranteed.
= Any existing private-debate threads that anyone currently has won't be affected by this. Only the input method has been changed, everything else is the same.

MrPHD 12-26-2006 04:09 PM

Nice Work very good in did. Regards and installed

Krumbz 12-26-2006 09:11 PM

salaam aalaykum khayye, I installed it but I don't see where i can edit the settings from the vbulletin options...i have 3.6.2 vbulletin

can u tell me where i can enable it and adjust settings ??

shokran

apokphp 12-27-2006 03:54 PM

That's great Bairy! :) Thanks for the edit there.

If you have the time, can you look into the feature requested in post #42 above? Here it is for convenience:

Quote:

How can I make it a PUBLIC thread, open to all members, once X # of posts have been made in the private debate thread?
For instance, a private debate goes on between 2 members, each provide 6 posts in the thread, bringing the total to 12 posts (12 is just an an arbitrary #) in the thread. By this time, the debate is slowing down, one side is emerging more victorious than the other.

As such, the public can then start weighing in on the matter, either by posting themselves or by initiating a vote on who they think won the debate.

Any way to do this?

Brew 12-31-2006 01:18 AM

Quote:

Originally Posted by bairy (Post 1145295)
A request was made in Service Requests to do this via username instead of userid.
It's not a big change and I was bored so ... happy holidays...


Empty the plugin named "Save private debate data", location: "newthread_post_complete", and put the following in it:
Code:

$vbulletin->input->clean_gpc('p', 'tdebates', TYPE_STR);
if($vbulletin->GPC['tdebates'] = trim($vbulletin->GPC['tdebates']))
{
        $tdebatesnames = explode(",", $vbulletin->GPC['tdebates']);
        foreach ($tdebatesnames AS $name)
        {
                $name = $db->escape_string(htmlspecialchars_uni(trim($name)));
                $querywhere .= ",'$name'";
        }
        $querywhere = substr($querywhere, 1);
       
        $tquery = $db->query_read("SELECT userid FROM " . TABLE_PREFIX ."user AS user WHERE username IN ($querywhere)");
       
        while ($row = $db->fetch_array($tquery))
        {
                $tuserids .= "," . $row['userid'];
        }
        $tuserids = substr($tuserids, 1);
       
        $db->query_write("UPDATE " . TABLE_PREFIX . "thread SET debates = '" . $tuserids . "' WHERE threadid = " . $newpost['threadid'] . "");
       
        $db->free_result($tquery);
        unset ($censorwords, $a, $tquery, $querywhere, $tdebatesnames);
}


Empty the plugin named: "thread to debate", location: "threadmanage_action_switch" and put the following in it:
Code:

if ($_REQUEST['do'] == 'tdebates')
{
        // only mods with the correct permissions should be able to access this
        if (!can_moderate($threadinfo['forumid'], 'candeleteposts'))
        {
                print_no_permission();
        }
       
        // check if there is a forum password and if so, ensure the user has it set
        verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
       
        // draw navbar
        eval('$navbar = "' . fetch_template('navbar') . '";');
       
        if (trim($threadinfo['debates'] != ''))
        {
                $threadinfo['debates'] = ',' . $threadinfo['debates'];
        }
        $query = $db->query_read("SELECT username FROM " . TABLE_PREFIX . "user AS user WHERE userid IN (0$threadinfo[debates])");
        $threadinfo['debates'] = '';
        while ($row = $db->fetch_array($query))
        {
                $threadinfo['debates'] .= ", " . $row['username'];
        }
        $threadinfo['debates'] = substr($threadinfo['debates'], 2);
       
        // spit out the final HTML if we have got this far
        eval('$HTML = "' . fetch_template('threadadmin_tdebates') . '";');
        eval('print_output("' . fetch_template('THREADADMIN') . '");');
        exit;
}

elseif ($_POST['do'] == 'dotdebates')
{
        $vbulletin->input->clean_gpc('r', 'tdebates', TYPE_STR);
       
        // only mods with the correct permissions should be able to access this
        if (!can_moderate($threadinfo['forumid'], 'candeleteposts'))
        {
                print_no_permission();
        }
       
        // check if there is a forum password and if so, ensure the user has it set
        verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
       
        $vbulletin->GPC['tdebates'] = trim($vbulletin->GPC['tdebates']);
        $tdebatesnames = explode(",", $vbulletin->GPC['tdebates']);
        foreach ($tdebatesnames AS $name)
        {
                $name = $db->escape_string(htmlspecialchars_uni(trim($name)));
                $querywhere .= ",'$name'";
        }
        $querywhere = substr($querywhere, 1);
       
        $tquery = $db->query_read("SELECT userid FROM " . TABLE_PREFIX ."user AS user WHERE username IN ($querywhere)");
       
        while ($row = $db->fetch_array($tquery))
        {
                $tuserids .= "," . $row['userid'];
        }
        $tuserids = substr($tuserids, 1);
       
        $db->free_result($tquery);
        unset ($censorwords, $a, $tquery, $querywhere, $tdebatesnames);
       
        $db->query_write("UPDATE " . TABLE_PREFIX . "thread SET debates = '" . $tuserids . "' WHERE threadid = '" . $threadid . "'");
        $tdebates_phrase = 'Private debate';
        $redirect='redirect_done_dotdebates';
       
        log_moderator_action($threadinfo,'tdebates',$tdebates_phrase);
        $vbulletin->url = 'showthread.php?' . "t=" . $threadid . "";
        eval(print_standard_redirect($redirect, true, true));
        exit;
}

Important: chosen usernames must be seperated by a comma (because some usernames have spaces), so you'll want to change the word "space" to "comma" in the templates:
Debates Templates > tdebates_newthread.
Thread Administration Templates > threadadmin_tdebates

Notes:
= If a non existant username is inputted, it will be ignored. If no valid usernames are inputted, it will not be a private-debate thread.
= I've copied the PM system's way of parsing usernames, therefore special characters and stuff should be accounted for. Or in other words: any valid username should work. However, it's still dependant on how the browser transmits special characters, so it's not 100% guaranteed.
= Any existing private-debate threads that anyone currently has won't be affected by this. Only the input method has been changed, everything else is the same.

Sorry...can you be more specific?

I can't locate these templates :knockedout:

bairy 12-31-2006 07:59 AM

Style Manager > Edit Templates.
The Debates Templates is alphabetically in the P area (for private debates), double click that to expand it and the tdebates_newthread will be revealed.
Same with Thread Administration, double click to expand it.

Rayanet 12-31-2006 12:20 PM

Installed.
excellent:)

Krumbz 01-04-2007 09:29 PM

I can't see the options of it, I imported the XML product, what now ?


All times are GMT. The time now is 02:33 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.01093 seconds
  • Memory Usage 1,798KB
  • 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
  • (4)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete