Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
latest threads in forumdisplay.php? Details »»
latest threads in forumdisplay.php?
Version: , by TECK TECK is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 05-07-2002 Last Update: Never Installs: 0
 
No support by the author.

i want to show the latest 10 threads, pulled from all forums in forumdisplay.php. i have this code:
Code:
// get latest threads
$forums=$DB_site->query("SELECT * FROM forum WHERE active=1");
$forumids='forumid IN (0';
while ($forum=$DB_site->fetch_array($forums)) {
  $getperms=getpermissions($forum['forumid']);
  if ($getperms[canview]) {
    $forumids .= "," . $forum['forumid'];
  }
}
$forumids.=')';

unset($forum);

$getthreads=$DB_site->query("SELECT * FROM thread WHERE $forumids AND visible=1 ORDER BY lastpost DESC LIMIT 10");
while ($lastthread=$DB_site->fetch_array($getthreads)) {
  $threadid=$lastthread[threadid];
  $titleextra='';
  if (strlen($lastthread[title])>32) {
    $titleextra="...";
  }
  $threadtitle=substr($lastthread[title], 0, 29);
}

eval("\$lastthreadbits .= \"".gettemplate('home_threadbits')."\";");
everything is working fine... hmm the problem is that it's making me jump from 21 to 40!!!! queries. is there a way to cache somehow those pesky queries? thanks for your help.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 05-08-2002, 05:17 AM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i was wondering if any of the big guns can look at the file ensemble and let me know if there is some wierd code i have in there?
i have a modified forumdisplay.php file that does what it shows in this pic:
News Page

for some reason, even with the right perms set for a usergroup, it will still show the last threads in the hidden forums.
also, i added comments in that file so you can easy follow the changes i did and evaluate better the code.
firefly or PPN, i would apreciate your help on this. if interested, let me know and i will PM the modified file.

thanks.
Reply With Quote
  #13  
Old 05-08-2002, 06:06 AM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

email me then
scott.macvicar@vbulletin.org

Just leaving for school I will check in once i get there.

try setting $bbuserinfo[usergroupid] to 1 in the query
Reply With Quote
  #14  
Old 05-08-2002, 06:17 AM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks PPN. i emailed you the file.
Reply With Quote
  #15  
Old 05-08-2002, 06:35 AM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
$doperms=$DB_site->query("SELECT canview,forumid FROM forumpermission WHERE usergroupid='$bbuserinfo[usergroupid]'");
while (
$doperm $DB_site->fetch_array($doperms)) {
  
$perms["$doperm[forumid]"] = $doperm;
}
$DB_site->free_result($doperms);
unset(
$doperm);

$forum=$DB_site->query("SELECT forumid FROM forum");
while (
$forums=$DB_site->fetch_array($forum)) {
  if(
$perms["$forums[forumid]"]["canview"] == || !isset($perms["$forums[forumid]"]["canview"])) {
    
$forumperms[]=$forums["forumid"];
  }
}
$DB_site->free_result($forum);
unset(
$forums);
if(!empty(
$forumperms)) {
  
$forumperms='AND forumid='.implode(' OR forumid=',$forumperms);

i had a variable name wrong
Reply With Quote
  #16  
Old 05-08-2002, 06:38 AM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks alot scott. when you have a chance, can you look at the file and let me know if there is any unbalanced code? i shrinked alot the forumdisplay.php file. just making sure someone with php experince can give me the ok on that.

i'm concerned about some unset queries and also about some errors that might be in there without knowing (for example the access array)...
Reply With Quote
  #17  
Old 05-08-2002, 08:43 AM
KuraFire's Avatar
KuraFire KuraFire is offline
 
Join Date: Oct 2001
Location: inside vB3's .php
Posts: 1,245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Scott, your new code works just fine, I've included it in my newsportal hack and will give you credit.
Reply With Quote
  #18  
Old 05-08-2002, 10:38 AM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

sure no problem, just glad to help.
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 04:57 PM.


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.07391 seconds
  • Memory Usage 2,283KB
  • Queries Executed 22 (?)
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)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (7)postbit
  • (8)postbit_onlinestatus
  • (8)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