1 (edited by elbekko 2006-10-27 15:31)

Topic: Topic Rating 1.2

##
##
##            Mod title:     Topic Rating
##
##      Mod version:     1.2
##   Works on PunBB:     1.2.*
##     Release date:     2006-10-27
##           Author:     El Bekko (elbekko@gmail.com)
##
##      Description:     This adds the ability to give a topic a rating
##
##  Difference with
## previous version:     Fixed a language error, moved the language defs to a
##                        separate file, shows rating in viewforum.php
##
##   Affected files:     viewtopic.php
##                        viewforum.php
##
##       Affects DB:     Yes
##
##            Notes:    I took the pictures from the reputation mod as they're perfect
##
##       DISCLAIMER:      Please note that "mods" are not officially supported by
##                        PunBB. Installation of this modification is done at your
##                        own risk. Backup your forum database and any and all
##                        applicable files before proceeding.
##
##
##

Download here
Discuss here

Re: Topic Rating 1.2

1.0.1 now includes the images tongue

Re: Topic Rating 1.2

demo?

Re: Topic Rating 1.2

I'll poke steven to put up a demo of it at PunDemo.org when I release 1.1 (later on smile)

Re: Topic Rating 1.2

heres a demo this site is only up for like a week longer or something so look at it while it lasts

http://eliteupload.com/forums/viewtopic.php?id=6

personally its a great mod but can be abused if wrong people are on your forums.

Re: Topic Rating 1.2

Updated to 1.1, this version allows you to add a set timeout between ratings (so they can't just spam it tongue).

7

Re: Topic Rating 1.2

Good idea, but I think the Rating should be displayed in Viewforum, so that people can view the rating without opening the thread.

8 (edited by elbekko 2006-10-25 18:24)

Re: Topic Rating 1.2

Can be arranged in a next release smile

Any more suggestions? As I feel kinda bad with making a new release for just that tongue

Re: Topic Rating 1.2

1.2 released, moves the language to a separate file, fixes a language error and adds the functionality to view the topic's rating in viewforum.php.

10

Re: Topic Rating 1.2

Fantastic smile
I'm definitely gonna include this when I upgrade my forums shortly.

*bookmarked*

Re: Topic Rating 1.2

my idea
can make page for show top 20 rating topic

ex.

topic1  ( Topic rating: 98 )
topic2  ( Topic rating: 2 )
topic3  ( Topic rating: 78 )
asdasd ( Topic rating: 0 )
blablabla ( Topic rating: 35 )
.....
.....

and come to top rating page show top rating

topic1  ( Topic rating: 98 )
topic3  ( Topic rating: 78 )
blablabla ( Topic rating: 35 )
topic2  ( Topic rating: 2 )
....
....
.... 20 topic


can make ?

very thank you for nice mod


sorry my bad english sorry sorry

Re: Topic Rating 1.2

Yeah, that would be very easy FruitCake wink

$result = $db->query("SELECT id, subject, rating FROM ".$db->prefix."topics ORDER BY rating DESC LIMIT 0,20");
while($row = $db->fetch_assoc($result))
{
echo '<a href="viewtopic.php?id='.$row['id'].'">'.$row['subject']." ( ".$row['rating']." )</a><br />\n";
}

Put that little PHP code in a new page or so, and it'll output the top 20 rated threads smile

I might make a full page of it and upload it smile

Re: Topic Rating 1.2

thank you for reply

I make new page

<?php
 
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';

//query info out of the DB
$result = $db->query("SELECT id, title, content FROM ".$db_prefix."pages WHERE id='".intval($_GET['id'])."'") or error('Unable to fetch page information', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
    message($lang_common['Bad request']);
    
$data = $db->fetch_assoc($result);

//Set the page title here
$page_title = pun_htmlspecialchars($pun_config['o_board_title']) . ' / '. $data['title'];
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';

//replace custom bbcode
$pattern = array('#\n\[page_title=([^\[]*?)\]#s',
                 '#\n\[page_break\]#s');
$replace = array("\n\t\t".'</div>'."\n\t".'</div>'."\n".'</div>'."\n".'<div class="block">'."\n\t".'<h2><span>$1</span></h2>'."\n\t".'<div class="box">'."\n\t\t".'<div class="inbox">',
                 "\n\t\t".'</div>'."\n\t".'</div>'."\n".'</div>'."\n".'<div class="block">'."\n\t".'<div class="box">'."\n\t\t".'<div class="inbox">');
                 
$content = preg_replace($pattern, $replace, $data['content']);

?>
<div class="block">
    <h2><span>Top 20 Rated Topic</span></h2>
    <div class="box">
        <div class="inbox">
<!--==================-->
<!--Start Page Content-->
<?php
$result = $db->query("SELECT id, subject, rating FROM ".$db->prefix."topics ORDER BY rating DESC LIMIT 0,20");
while($row = $db->fetch_assoc($result))
{
echo '<a href="viewtopic.php?id='.$row['id'].'">'.$row['subject']." ( ".$row['rating']." )</a><br />\n";
}
?>
<!-- End Page Content -->
<!--==================-->
        </div>
    </div>
</div>
<?php
require PUN_ROOT.'footer.php';

name : top20.php

and I come in that page it show


Info

Bad request. The link you followed is incorrect or outdated.

Go back

how to make page

sorry my bad english sorry sorry

Re: Topic Rating 1.2

http://www.punres.org/download.php?id=1116

That's the code for the page.

Re: Topic Rating 1.2

very nice


thank thank you

Re: Topic Rating 1.2

could you add support so you can only vote on a topic once
so someone doesnt keep voting on the same topic

Re: Topic Rating 1.2

No.

Re: Topic Rating 1.2

why not?

Re: Topic Rating 1.2

The way this mod is set up doesn't support it.

Re: Topic Rating 1.2

Has somebody got a site with a demo of this (Topic Rating) mod that I can look at please?

Thanks

--Alan

21 (edited by FruitCake 2007-04-21 10:11)

Re: Topic Rating 1.2

can change this

now in viewforum.php

it show like this (ex)

------------------------------------------------------------------------------------------------------------------
|                            Topic                                   |  Replies  | Views |           Last post                  |
------------------------------------------------------------------------------------------------------------------
| Pligg CMS Integration? by GT ( Topic rating: 7 ) |      1       |   36   | Today 07:11:06 by Smartys |


how to change like this


------------------------------------------------------------------------------------------------------------------
|                   Topic                    |  Replies  | Views |  Topic rating  |              Last post                 |
------------------------------------------------------------------------------------------------------------------
| Pligg CMS Integration? by GT   |      1       |   36   |          7          | Today 07:11:06 by Smartys  |


can do that ?

Re: Topic Rating 1.2

Modify the HTML in viewforum.php wink