Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 01-12-2006, 09:10 PM
himerus himerus is offline
 
Join Date: Nov 2003
Location: Denver, CO
Posts: 75
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Forum Display and Thread Viewing Permissions..

I'm a little stuck here in implementing the appropriate viewing permissions for a custom forum...

in forumdisplay.php,

PHP Code:
$hook_query_fields $hook_query_joins $hook_query_where '';
    (
$hook vBulletinHook::fetch_hook('forumdisplay_query')) ? eval($hook) : false;

    
$threads $db->query_read("
        SELECT 
$votequery $previewfield
            thread.threadid, thread.title AS threadtitle, thread.forumid, pollid, open, replycount, postusername, postuserid, thread.iconid AS threadiconid,
            
$lastpost_info, thread.dateline, IF(views<=replycount, replycount+1, views) AS views, notes, thread.visible, sticky, votetotal, thread.attach,
            hiddencount
            " 
iif($vbulletin->options['threadsubscribed'] AND $vbulletin->userinfo['userid'], ", NOT ISNULL(subscribethread.subscribethreadid) AS issubscribed") . "
            " 
iif($deljoin", deletionlog.userid AS del_userid, deletionlog.username AS del_username, deletionlog.reason AS del_reason")
            . 
iif($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'], ', threadread.readtime AS threadread') . "
            
$hook_query_fields
        FROM " 
TABLE_PREFIX "thread AS thread
            
$deljoin
            " 
iif($vbulletin->options['threadsubscribed'] AND $vbulletin->userinfo['userid'], " LEFT JOIN " TABLE_PREFIX "subscribethread AS subscribethread ON(subscribethread.threadid = thread.threadid AND subscribethread.userid = " $vbulletin->userinfo['userid'] . ")") . "
            " 
iif($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'], " LEFT JOIN " TABLE_PREFIX "threadread AS threadread ON (threadread.threadid = thread.threadid AND threadread.userid = " $vbulletin->userinfo['userid'] . ")") . "
            
$previewjoin
            
$tachyjoin
            
$hook_query_joins
        WHERE thread.threadid IN (0
$ids$hook_query_where
        ORDER BY sticky DESC, 
$sqlsortfield $sqlsortorder
    "
);
    unset(
$limitothers$delthreadlimit$deljoin,$datecut$votequery$sqlsortfield$sqlsortorder$threadids); 
I need to be able to do the following.... with my plugin code...

PHP Code:
if ($thread['forumid'] == 31) {
$hook_query_fields .= "";
$hook_query_joins .= "";
$hook_query_where .= "";

I need to in this particular forum, be able to only list threads that a user has already posted in... This forum is mainly populated from external forms and automated processes. The forum admins, and certain usergroups will have full permissions, and the thread owners will have full permissions to posts, but the other users will only be able to see listed for this particular forum the threads they have already posted in....

I'm not sure how to quickly do this with the join and where statements, but I'm sure someone could start me in the right direction....

Thanks in advance!!!

Would this work???

I think it's kind of working proplery... I've added my custom admin and staff usergroups to this one... they can browse all posts for this forum, but users can only view ones they've posted in.... and the first post must be made through another source...

PHP Code:
if ($foruminfo[forumid] == 31 && $vbulletin->userinfo['usergroupid'] != "5" && $vbulletin->userinfo['usergroupid'] != "6" && $vbulletin->userinfo['usergroupid'] != "7" && $vbulletin->userinfo['usergroupid'] != "11"){
        
$hook_query_fields .= ", posted.parentid, posted.postid AS posted_verification";
        
$hook_query_joins .= " LEFT JOIN " TABLE_PREFIX "post AS posted ON(posted.threadid = thread.threadid AND posted.userid = " $vbulletin->userinfo['userid'] . ")";
        
/* ############*/
        
$hook_query_where .= " AND posted.postid != ''";

is this correct in saying that only to pull this thread for viewing if the user has posted in the thread?
Reply With Quote
  #2  
Old 01-13-2006, 10:03 PM
himerus himerus is offline
 
Join Date: Nov 2003
Location: Denver, CO
Posts: 75
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm still having problems on this, but I'm close to a solution if I just had the right help.

PHP Code:
if ($foruminfo[forumid] == 31 && $vbulletin->userinfo['usergroupid'] != "5" && $vbulletin->userinfo['usergroupid'] != "6" && $vbulletin->userinfo['usergroupid'] != "7" && $vbulletin->userinfo['usergroupid'] != "11"){
    
$hook_query_fields .= ", posted.parentid AS parent_verify, posted.postid AS posted_verification";
    
$hook_query_joins .= " INNER JOIN " TABLE_PREFIX "post AS posted ON(posted.threadid = thread.threadid AND posted.userid = " $vbulletin->userinfo['userid'] . ")";
    
/* ############*/
    
$hook_query_where .= " AND posted.postid != ''";

This is pulling the right information, but I have LEFT JOIN ed the post table, and now, the user is getting the thread listed 3 times if they have had 3 posts in the thread.... I just need to verify that they have at least 1 post....

Can someone help me with this? I know it's a simple fix with what I'm trying to accomplish....
Reply With Quote
Reply

Thread Tools
Display Modes

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 05:50 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.04051 seconds
  • Memory Usage 2,199KB
  • Queries Executed 13 (?)
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
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)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_postinfo_query
  • fetch_postinfo
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete