Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-30-2002, 08:37 PM
Martin64's Avatar
Martin64 Martin64 is offline
 
Join Date: Nov 2001
Posts: 390
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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:
Reply With Quote
  #2  
Old 12-31-2002, 01:14 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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"); 
Reply With Quote
  #3  
Old 12-31-2002, 03:05 PM
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Location: Northampton, England
Posts: 6,186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Satan
Reply With Quote
  #4  
Old 12-31-2002, 03:09 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

then he'd see that something isn't normal for him
Reply With Quote
  #5  
Old 12-31-2002, 03:30 PM
Martin64's Avatar
Martin64 Martin64 is offline
 
Join Date: Nov 2001
Posts: 390
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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."
Reply With Quote
  #6  
Old 12-31-2002, 03:39 PM
Martin64's Avatar
Martin64 Martin64 is offline
 
Join Date: Nov 2001
Posts: 390
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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"
Reply With Quote
  #7  
Old 01-01-2003, 06:42 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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;

Reply With Quote
  #8  
Old 01-01-2003, 07:19 PM
Martin64's Avatar
Martin64 Martin64 is offline
 
Join Date: Nov 2001
Posts: 390
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

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.

EDIT: Nevermind, problem solved.
Reply With Quote
  #9  
Old 01-01-2003, 07:54 PM
hamed's Avatar
hamed hamed is offline
 
Join Date: May 2002
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #10  
Old 01-01-2003, 08:10 PM
Martin64's Avatar
Martin64 Martin64 is offline
 
Join Date: Nov 2001
Posts: 390
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Make sure you apply Xenon's latest code change.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05593 seconds
  • Memory Usage 2,276KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (5)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete