The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Detailed Latest Discussions in What's Going On Details »» | |||||||||||||||||||||||||||
Detailed Latest Discussions in What's Going On
Developer Last Online: Mar 2007
Below is my first attempt at creating a hack. It works perfectly on my board but as no others have tested it, I am putting it here for now. I know there are other latest x posts type hacks around, however, in my day long search of this forum, I have yet to find one that suited my needs. Therefore, I wrote my own. I offer it here. It only uses one query to return information on the last x posts including the fields (forum id, forum title, thread id, thread title, initial poster id, initial poster name, last poster id, last poster name, reply count and views). It takes into account permissions using the CANVIEW and CANVIEWOTHERS constants and properly flags the show variable if no rows are deemed showable. Have fun and please do not hesitate to comment on this. This code is entirely of my own writing although it was visually inspired by the hack in place on http://cosforums.com. Thanks.
Show Your Support
|
Comments |
#22
|
|||
|
|||
You know what. I answered this earlier, but something in the back of my mind just told me to look at the code again. I made a stupid boo-boo. There's a } in the wrong place, so no, the current hack will not work correctly. However, if you download it, and make the following change to the while loop, it should. Don't forget to make the & changes I listed above either. I'll post an updated version tomorrow.
Code:
while($post = $DB_site->fetch_array($posts)) { $perms = fetch_permissions($post['forumid']); // if no rows set this then the section will be skipped on display if($perms & CANVIEW || $perms & CANVIEWOTHERS){ $latestpostcount++; $post['threadtitle'] = fetch_censored_text(fetch_trimmed_title(unhtmlspecialchars($post['threadtitle']), 22)); $post['forumtitle'] = fetch_censored_text(fetch_trimmed_title(unhtmlspecialchars($post['forumtitle']), 22)); $post['replycount'] = vb_number_format($post['replycount']); $post['views'] = vb_number_format($post['views']); // keep this in case you want to use alternating colors exec_switch_bg(); eval("\$latestpostbits .= \"".fetch_template('forumhome_latestpostbits')."\";"); } } |
#23
|
|||
|
|||
ok nochmal in Deutsch, mein englisch ist so schlecht, werden private Foren aufgelistet, Beispiele Thread Titel aus dem Moderatoren Forum oder ?hnliche
|
#24
|
|||
|
|||
Here's the updated version. In it are the following fixes:
1) Added the following variable to the top of the hack code for easier editing: $query = 50; // Set the number of row to return $limit = 8; // Sets the number of rows to display $chars = 22; // Sets the number of chars to truncate to This is to ensure that the query is kept light enough to run on a large board and still return enough records so that the average user will have rights to at least your desired minimum display count. If we used only an SQL limit, and the user didn't have rights to see all of them, different users would see varying numbers of rows being displayed. That defeats the purpose for a display count. 2) The parenthetical expressioning in the 'while' has been fixed to properly catch all rows the user does not have rights to view. 3) The testing of the display limit has been adjusted within the 'while' loop to account for the display limit. 4) All '&' characters in hrefs have properly been changed to '&' for XHTML compliancy. Let me know if anything needs to be changed. |
#25
|
|||
|
|||
yeah, click install
|
#26
|
||||
|
||||
Serenarules,
Nice! Thanks! Click. BTW - Very nice skin on your site. Did you do the artwork? |
#27
|
||||
|
||||
I'm pretty stupid at this stuff... What's the reason for the
PHP Code:
I assume it's a permissions conditional but where would you set it? Right now on my forum I removed the statement and the closing /if because if I didn't nothing would show up. What am I missing here? |
#28
|
|||
|
|||
In's a conditional that tell the templating mechanism whether or not to display the contained code. If you look at the php code sections you'll see that if there were no results to display, the $show[latestposts'] aray variable is left in it's default setting of false. In such a case, the html contained in that template is not shown. Otherwise, you'd end up with a table with only the header and no data. Basic templating procedures.
As far as nothing showing up, make sure that the conditions in the SQL meet your needs. By default it's set to return a certain set of stuff, excluding closed threads, and what not. So if you have the $query variable set too close to the $limit variable (for example, $query = 15 and $limit = 10) and 12 of them were closed threads, or threads the user doesn't have permission to see, the chances of a valid return is slim. Especially on boards with highly protected forums. The solution is to adjust the SQL and the variables, not the template. If you post more info on how your forum is set up and what you are 'expecting' to see, I might could help more. And yes, the site design is all mine, including the artwork. |
#29
|
||||
|
||||
Thanks! My forums are relatively 'open'. I want anyone to be able to see the posts listing. Of course, permissions - such as access to my 'moderator forum' posts - must apply. Which I see they do - people without permissions do not see those posts in the list.
I got it installed and it appears to be doing everything I want. The forum is: http://Elsmar.com/Forums/ I'm assuming that leaving out the conditional isn't an issue for me because there will always be results to display because a.) It's not time delimited (such as Posts in the last 24 Hours - Get Daily), and b.) In my forum there is no user group that I do not want to see threads in 95% of the forums. I appreciate the detail in your response. Obviously I'm not a programmer... Your reply was a big help in understanding what a lot of the conditionals are about - why they're there. I learn a bit at a time... Your artwork is outstanding! |
#30
|
||||
|
||||
BTW...
I understand this: PHP Code:
PHP Code:
|
#31
|
|||
|
|||
The value of $query is used in the actual call to the database and says return that many rows. Permissons are not checked at this point, as it is easier to call the VB function fetch_permissions during the loop. The $limit value acts like a valve so that when the loop has added that many records to the display after passing the perms check, the loop will exit. The reason we have two vars here is that if we simply got the last ten records from he database, and all ten happened to be in a protected forum of sorts, no records would be displayed. There are other scenarios that can occur as well. For you application, your changes are fine, as long as you are aware that if you change your boards perms and no results are found it will still display the header with no rows.
Thanks for the compliment. |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|