vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Hide threads by usergroup (https://vborg.vbsupport.ru/showthread.php?t=47150)

Martin64 12-30-2002 08:37 PM

Hide threads by usergroup
 
I've been working on making the secretely banned users hack even more secret :laugh: but I'm stuck at the moment so I thought I'd ask for help. :)

What I'm wanting to do is to prevent all threads started by users from my secretely banned users group to show up in forumdisplay (visible to the banned users, admins and mods though). I figured out a way of doing this based on userids, but not usergroups. Here's what I did in forumdisplay.php:

Code:

if (($bbuserinfo['usergroupid']!=16 && $bbuserinfo['usergroupid']!=6 && $bbuserinfo['usergroupid']!=5 &&
$bbuserinfo['usergroupid']!=7) && ($thread[postuserid]==X or $thread[postuserid]==XX or
$thread[postuserid]==XXX)) { continue; }

Also, I did this in showthread.php, which gives an error message if members try to view a thread started by those members:

Code:

if (($bbuserinfo['usergroupid']!=16 && $bbuserinfo['usergroupid']!=6 && $bbuserinfo['usergroupid']!=5 &&
$bbuserinfo['usergroupid']!=7) && ($thread[postuserid]==X or
$thread[postuserid]==XX or $thread[postuserid]==XXX)) {
      $idname="thread";
      eval("standarderror(\"".gettemplate("error_invalidid")."\");");
    }

Once again, giving this error message based on usergroup rather than having to edit the files whenever a new member is put in the secretely banned users group would be splendid.

I hope someone can help with some tips. :classic:

Xenon 12-31-2002 01:14 PM

well, the usergroupid isn't saved within the threadtable, so you have to include the usertable to the query:

in forumdisplay find this:
PHP Code:

$getthreadids=$DB_site->query("
    SELECT
    "
.iif($sortfield=="voteavg",$votequery,"")."
        thread.threadid
    FROM thread
    WHERE thread.forumid = 
$foruminfo[forumid]
        AND thread.sticky=0
        AND thread.visible=1
    
$datecut
    
$limitothers
      ORDER BY sticky DESC, 
$sortfield $sqlsortorder
      LIMIT "
.($sel_limitlower-1).",$perpage"); 

and change it to:
PHP Code:

$getthreadids=$DB_site->query("
    SELECT
    "
.iif($sortfield=="voteavg",$votequery,"")."
        thread.threadid    FROM thread
              LEFT JOIN user ON (thread.postuserid = user.userid)
    WHERE thread.forumid = 
$foruminfo[forumid]
        AND thread.sticky=0
 "
.iif(in_array($bbuserinfo[usergroupid], array(5,6,7,16)), """AND user.usergroupid != 16 ") . "
        AND thread.visible=1
    
$datecut
    
$limitothers
      ORDER BY sticky DESC, 
$sortfield $sqlsortorder
      LIMIT "
.($sel_limitlower-1).",$perpage"); 


Chris M 12-31-2002 03:05 PM

Couldn't you just make it so that his threads get automatically moved to another forum?

Satan

Xenon 12-31-2002 03:09 PM

then he'd see that something isn't normal for him :)

Martin64 12-31-2002 03:30 PM

Yeah, I figured it would need something like that. It gives me an error though:

"There seems to have been a slight problem with the EmuTalk.net database.
Please try again by pressing the refresh button in your browser.
An E-Mail has been dispatched to our Technical Staff, who you can also contact if the problem persists.

We apologise for any inconvenience."

Martin64 12-31-2002 03:39 PM

Here's the error report the board sent me:

"Database error in vBulletin 2.2.8:

Invalid SQL:
SELECT

thread.threadid FROM thread
LEFT JOIN user ON (thread.postuserid = user.userid)
WHERE thread.forumid = 19
AND thread.sticky=0
AND user.usergroupid != 16
AND thread.visible=1
AND lastpost >= 1038763258 AND sticky=0

ORDER BY sticky DESC, lastpost DESC
LIMIT 0,20
mysql error: Column: 'lastpost' in where clause is ambiguous

mysql error number: 1052"

Xenon 01-01-2003 06:42 PM

ahh, yes i see

find this code:
PHP Code:

if ($daysprune != 1000) {
  
$checkdate time() - ($daysprune 86400);
  
$datecut 'AND lastpost >= ' $checkdate;


and change it to:
PHP Code:

if ($daysprune != 1000) {
  
$checkdate time() - ($daysprune 86400);
  
$datecut 'AND thread.lastpost >= ' $checkdate;



Martin64 01-01-2003 07:19 PM

Yeah, I figured it out earlier today with the help of a friend. Thanks a lot. :D

Now, how would I go about doing the same for showthread.php (cause the error based on usegroup rather than userid)? Any help would be appreciated. :D

EDIT: Nevermind, problem solved. :)

hamed 01-01-2003 07:54 PM

The same here. When I use :
PHP Code:

".iif(in_array($bbuserinfo[usergroupid], array(6,12)), "", "AND user.usergroupid != 12 ") . " 

it works perfect for the groups that have the permission to see the threads but the "There seems to have been a slight problem with Database" for the rest.
Any help please?

Martin64 01-01-2003 08:10 PM

Make sure you apply Xenon's latest code change. :)


All times are GMT. The time now is 05:03 AM.

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.01070 seconds
  • Memory Usage 1,753KB
  • 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_code_printable
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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