PDA

View Full Version : Forum Home Enhancements - Random Thread


GWLiaR
10-07-2008, 10:00 PM
English:
What Does it?:This hack will add to Navbar Random Thread :).

Install:
+Go to admin Cp
+Plugin System -> Manage Products -> [Add/Import Product] -> Select
+'product-random_thread.xml' then İmport.

Find Navbar:
<if condition="$show['pmwarning']"><div><strong><phrase 1="$vbphrase[pmpercent_nav_compiled]">$vbphrase[your_pm_box_is_x_full]</phrase></strong></div></if>Add Below:
$rthreadMark As Installed (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=193061)

GWLiaR
10-08-2008, 11:41 AM
*Reserved

TilkiBey
10-08-2008, 11:50 AM
pls renew ur ss with supporting file types (jpg,jpeg etc.)

bmp desteklenmiyor inferno,direkt g?z?kmesi daha hoş olur demo g?r?nt?n?n;)

GWLiaR
10-08-2008, 11:53 AM
pls renew ur ss with supporting file types (jpg,jpeg etc.)

bmp desteklenmiyor inferno,direkt g?z?kmesi daha hoş olur demo g?r?nt?n?n;)

D?zelttim..
Added JPEG Demo :)

NAZIA
10-08-2008, 02:14 PM
reserved...

noppid
10-08-2008, 02:36 PM
That query will/could bring a forum to it's knees running every page view.


mysql> explain Select * From thread order by rand() DESC LIMIT 1
-> ;
+----+-------------+--------+------+---------------+------+---------+------+------+---------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------+------+---------------+------+---------+------+------+---------------------------------+
| 1 | SIMPLE | thread | ALL | NULL | NULL | NULL | NULL | 6026 | Using temporary; Using filesort |
+----+-------------+--------+------+---------------+------+---------+------+------+---------------------------------+
1 row in set (0.03 sec)



As you can see, a full table walk.

Here's a better way.


60*60 == 3600
3600*24 == 14400
14400*30 == 432000
1223479602 - 432000 == 1223047602

mysql> explain Select * From thread where dateline >= 1223047602 order by dateline DESC limit 1;
+----+-------------+--------+-------+---------------+----------+---------+------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------+-------+---------------+----------+---------+------+------+-------------+
| 1 | SIMPLE | thread | range | dateline | dateline | 4 | NULL | 104 | Using where |
+----+-------------+--------+-------+---------------+----------+---------+------+------+-------------+
1 row in set (0.00 sec)



See the difference? Gotta use those indexes. Rand() is bad.

ahtapod
10-08-2008, 05:44 PM
It runs wrong.

When used, it transfers users to wrong thread. :(

MrZeropage
10-08-2008, 06:51 PM
Attention - this does not take care of hidden forums or forumpermissions, means it could also bring up a thread from your internal hidden administrator-forum...

noppid
10-08-2008, 06:55 PM
Add "AND forumid not in(1,2,3)" to the query.

This hack needs a lot of work.

yousellstuff
10-12-2008, 11:05 PM
whats the point of this

tirol07
10-17-2008, 09:40 PM
D?zelttim..
Added JPEG Demo :)

bi sorum olacaktı arkadaşım bunu vb sayfası hari? g?sterme imanımız varmi?

Mesela vbulletin haric bir sayfada 5 rastgele konu g?stermek istiyorum! m?mk?nm? bu?

GWLiaR
10-18-2008, 03:54 AM
bi sorum olacaktı arkadaşım bunu vb sayfası hari? g?sterme imanımız varmi?

Mesela vbulletin haric bir sayfada 5 rastgele konu g?stermek istiyorum! m?mk?nm? bu?
Evet M?mk?n...Mysal ile Yapabilirsin:)

tirol07
10-19-2008, 08:09 PM
Evet M?mk?n...Mysal ile Yapabilirsin:)

Peki nasıl yaplıyor bu mysal dediğin?

Detaylı anlatabilirmisin sana zahmet, ?ok uğraştım yapamadım?

KrisP
11-14-2009, 12:31 PM
It runs wrong.

When used, it transfers users to wrong thread. :(

In plugin change

$ryaz.="<a href=showthread.php?p=$veri[threadid]>$baslik</a>";

to

$ryaz.="<a href=showthread.php?t=$veri[threadid]>$baslik</a>";

Brandon Sheley
06-06-2010, 04:19 AM
It would be handy if this worked properly, I could use it.
Does anyone know of a 3.8 version?

PS... I think the rules say you have to speak in english, or at least have an english version.

valdet
08-12-2011, 11:21 AM
Sorry to bump this thread.

That query will/could bring a forum to it's knees running every page view.


mysql> explain Select * From thread order by rand() DESC LIMIT 1
-> ;
+----+-------------+--------+------+---------------+------+---------+------+------+---------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------+------+---------------+------+---------+------+------+---------------------------------+
| 1 | SIMPLE | thread | ALL | NULL | NULL | NULL | NULL | 6026 | Using temporary; Using filesort |
+----+-------------+--------+------+---------------+------+---------+------+------+---------------------------------+
1 row in set (0.03 sec)

As you can see, a full table walk.

Here's a better way.


60*60 == 3600
3600*24 == 14400
14400*30 == 432000
1223479602 - 432000 == 1223047602

mysql> explain Select * From thread where dateline >= 1223047602 order by dateline DESC limit 1;
+----+-------------+--------+-------+---------------+----------+---------+------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------+-------+---------------+----------+---------+------+------+-------------+
| 1 | SIMPLE | thread | range | dateline | dateline | 4 | NULL | 104 | Using where |
+----+-------------+--------+-------+---------------+----------+---------+------+------+-------------+
1 row in set (0.00 sec)


See the difference? Gotta use those indexes. Rand() is bad.

Can you please let me know how would I optimize this query so it doesn't overload the database as much as with rand() function.

Also how to add the limitations so it does not opens threads from private forums?

Thanks