7.0+ User Points in Forums

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   7.0+ User Points in Forums
Hitman_2oo4
CZ Active Member
uk.gif
Occupation: Student
Age: 38
Gender: Male
Fav. Sports Team: Manchester United
Website:
Status: Offline
Joined: Sep 05, 2003
0.03 posts per day
Posts: 230
Points: 15,485
   
i usin php nuke 7.3 which has the user points installed .. can someone explain how i actually get points to show up in my forums like they do in this site

cheers



Back to top Reply with quote
#2   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
Try These:

Source:http://www.ayhsel.de/ftopict-103.html
1. Backup the files that will be edited:
- modules/Members_List/index.php
- Just in case you haven't applied the forum points hack already, modules/Forums/language/lang-(your lang)/lang_main.php

depending on your sort of theme either
-- themes/(your theme)/forums/memberlist_body.tpl
or
-- modules/Forums/templates/(your template)/memberlist_body.tpl

You can verify which template to edit by looking at the directory of your current nuke theme. If it contains a /forums folder, edit the template inside that (it overrides the forum modules' template). If it doesn't contain a forums folder, modules/Forums/templates is the right place.

On request I added a group-column, too. If you want to add it to your existing memberlist points hack look for the red lines, if you only want to add the points column ignore the red lines
You won't be able to sort by group, as the group is calculated for each user and not the result of a db query.

2. Changes to index.php:

Search:

$mode_types_text = array($lang['Sort_Joined'], $lang['Sort_Username'], $lang['Sort_Location'], $lang['Sort_Posts'], $lang['Sort_Email'],  $lang['Sort_Website'], $lang['Sort_Top_Ten']);
$mode_types = array('joindate', 'username', 'location', 'posts', 'email', 'website', 'topten');



Change to/replace by:

$mode_types_text = array($lang['Sort_Joined'], $lang['Sort_Username'], $lang['Sort_Location'], $lang['Sort_Posts'], $lang['Points'], $lang['Sort_Email'],  $lang['Sort_Website'], $lang['Sort_Top_Ten']);
$mode_types = array('joindate', 'username', 'location', 'posts', 'points', 'email', 'website', 'topten');



Search:

        'L_POSTS' => $lang['Posts'],


Below, in a new line, add:

        'L_POINTS' => $lang['Points'],


For group, in a new line add:

        'L_GROUP' => $lang['Pgroup'],



Search:

        case 'posts':
                $order_by = "user_posts $sort_order LIMIT $start, " . $board_config['topics_per_page'];
                break;


Below, in a new line, add:

        case 'points':
                $order_by = "points $sort_order LIMIT $start, " . $board_config['topics_per_page'];
                break;


Search:

$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar



Change to/replace by:

$sql = "SELECT username, user_id, user_viewemail, user_posts, points, user_regdate, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar



For group, Search:

{
        message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
}



After that, in a new line, add:

// get groupsrow
$sql = "SELECT name, points
        FROM nuke_groups
        ORDER BY points ASC";
if ( !($result2 = $db->sql_query($sql)) )
{
        message_die(GENERAL_ERROR, "Could not obtain groups information.", '', __LINE__, __FILE__, $sql);
}

$groupsrow = array();
while ( $row2 = $db->sql_fetchrow($result2) )
{
        $groupsrow[] = $row2;
}
$db->sql_freeresult($result2);
// end get groupsrow


Search:

                $posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0;


Below, in a new line, add:

            $points = $row['points'];


For group, in a new line, add:

// usergroup hack
        $poster_group = '';
        if ( $username == ANONYMOUS ) {
        }
        else if ( $points )
        {
                for($j = 0; $j < count($groupsrow); $j++)
                {
                        if ( $points >= $groupsrow[$j]['points'] )
                        {
                                $poster_group = ( $groupsrow[$j]['name'] != '' ) ? $groupsrow[$j]['name'] : '';
                        }
                }
        }
// usergroup hack end


Search:

                        'POSTS' => $posts,


Below, in a new line, add:

                        'POINTS' => $points,


For group, in a new line, add:

// usergroup hack
                        'GROUP' => $poster_group,
// usergroup hack end


Save the file.


3. Add output to memberlist_body.tpl:
Edit: Note that the class parameters in the example below are characteristic for my template and will differ from yours. When searching, try to exclude the class parameter.

Search:

     <th class="thTop" nowrap="nowrap">{L_POSTS}</th>


Below, in a new line, add:

     <th class="thTop" nowrap="nowrap">{L_POINTS}</th>


For group, in a new line, add:

     <th class="thTop" nowrap="nowrap">{L_GROUP}</th>


Search:

     <td class="{memberrow.ROW_CLASS}" align="center" valign="middle"><span class="gen">{memberrow.POSTS}</span></td>


Below, in a new line, add:

     <td class="{memberrow.ROW_CLASS}" align="center" valign="middle"><span class="gen">{memberrow.POINTS}</span></td>


For group, in a new line, add:

     <td class="{memberrow.ROW_CLASS}" align="center" valign="middle"><span class="gen">{memberrow.GROUP}</span></td>


Look some lines below and find the ...colspan="X"... line, add the number of columns you just created (+1 or +2), to avoid that the footer row gets too short.

Save the file.

The next step is only necessary, if you didn't apply my forum points hack already.
4. Add language variable to lang_main.php:

Search:

$lang['Posts'] = 'Beiträge';


Below, in a new line, add (translate 'Punkte' to Points in your language):

$lang['Points'] = 'Punkte';


For group, in a new line, add (translate 'Gruppe' to Group in your language):

$lang['Pgroup'] = 'Gruppe';



Save the file, upload all three hacked files to your server and check your members list.
Sorting by points is also included.



==================================================



Source:http://www.ayhsel.de/ftopict-99.html

1. Backup the files that will be edited:
- modules/Forums/viewtopic.php
- modules/Forums/language/lang-(your lang)/lang_main.php

depending on your sort of theme either
-- themes/(your theme)/forums/viewtopic_body.tpl
or
-- modules/Forums/templates/(your template)/viewtopic_body.tpl

You can verify which template to edit by looking at the directory of your current nuke theme. If it contains a /forums folder, edit the template inside that (it overrides the forum modules' template). If it doesn't contain a forums folder, modules/Forums/templates is the right place.

2. Add the points to the query in viewtopic.php:

Find:

//
// Go ahead and pull all data for this topic
//


Near the end of the 'sql =' line below, add 'u.points', afterwards it should look like this:

...u.user_allowsmile, u.points, p.*,...


Find:

$ranksrow = array();
while ( $row = $db->sql_fetchrow($result) )
{
        $ranksrow[] = $row;
}
$db->sql_freeresult($result);


After that, in a new line add:

// get groupsrow
$sql = "SELECT name, points
        FROM nuke_groups
        ORDER BY points ASC";
if ( !($result2 = $db->sql_query($sql)) )
{
        message_die(GENERAL_ERROR, "Could not obtain groups information.", '', __LINE__, __FILE__, $sql);
}

$groupsrow = array();
while ( $row2 = $db->sql_fetchrow($result2) )
{
        $groupsrow[] = $row2;
}
$db->sql_freeresult($result2);
// end groupsrow


Find:

        $poster_posts = ( $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Posts'] . ': ' . $postrow[$i]['user_posts'] : '';


After that, in a new line add:

        $poster_points = ( $postrow[$i]['points'] != '0' ) ? $lang['Points'] . ': ' . $postrow[$i]['points'] : '';


Find:

        //
        // Handle anon users posting with usernames
        //


Before add:

        //
        // Generate groups, set them to empty string initially.
        //
        $poster_group = '';
        if ( $postrow[$i]['user_id'] == ANONYMOUS )
        {
        }
        else if ( $postrow[$i]['points'] )
        {
                for($j = 0; $j < count($groupsrow); $j++)
                {
                        if ( $postrow[$i]['points'] >= $groupsrow[$j]['points'] )
                        {
                                $poster_group = ( $groupsrow[$j]['name'] != '' ) ? $lang['Pgroup'] . ': ' . $groupsrow[$j]['name'] : '';
                        }
                }
        }


Find:

                'POSTER_POSTS' => $poster_posts,


After that, in a new line add:

                'POSTER_POINTS' => $poster_points,


After that, in a new line add:

                'POSTER_GROUP' => $poster_group,


Save the file.

3. Add output to viewtopic_body.tpl:

Find (i shortened the really long line |...|):

   <!-- BEGIN postrow -->
   <tr>
      <td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}">|...|{postrow.POSTER_POSTS}<br />{postrow.POSTER_POINTS}<br />{postrow.POSTER_FROM}</span><br /></td>


After '{postrow.POSTER_POSTS}<br />', insert '{postrow.POSTER_POINTS}<br />', so that looks like this:

{postrow.POSTER_POSTS}<br />{postrow.POSTER_POINTS}<br />{postrow.POSTER_FROM}</span>


For the group display, add '{postrow.POSTER_GROUP}<br />'


Save the file.

4. Add the Points language variable to lang_main.php:

Find:

$lang['Posts'] = 'Posts';


After that, in a new line add (to the right it's 'Points' in your language):

$lang['Points'] = 'Points';


After that, in a new line add:

$lang['Pgroup'] = 'Group';


Save the file, upload all three to their respective server folders and check your forums.



_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   re: 7.0+ User Points in Forums
Johnsen
CZ Super Newbie
Johnsen has been a member for over 20 year's 20 Year Member
usa.gif florida.gif
Occupation: Student
Age: 33
Gender: Male
Website:
Status: Offline
Joined: Sep 08, 2004
0.01 posts per day
Posts: 56
Points: 2,172
AIM Address Yahoo Messenger  
those download links didnt work..icon_sad.gif



Back to top Reply with quote
#4   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
WHen you click the link it opens a text page with the instructions on how to add them in it. Do you see that page?




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#5   re: 7.0+ User Points in Forums
wolf
CZ Active Member
usa.gif indiana.gif
Occupation: Student; Flash, HTML, PHP developer
Age: 34
Gender: Male
Status: Offline
Joined: Jul 25, 2003
0.02 posts per day
Posts: 168
Points: 10,417
AIM Address Yahoo Messenger MSN Messenger 
No, it really says, Page Cannot Be Displayed...

I'm looking for the same thing.




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#6   re: 7.0+ User Points in Forums
lostboyca
CZ Active Member
lostboyca has been a member for over 20 year's 20 Year Member
usa.gif california.gif
Website:
Status: Offline
Joined: Aug 12, 2004
0.02 posts per day
Posts: 114
Points: 5,334
   
I've followed the instructions on the forum.txt to add points to the forum but no luck. I have a question on the section where it states to find // Handle anon users posting with usernames and add before (!) the line

//
// Generate groups, set them to empty string initially.
//
$poster_group = '';
if ( $postrow[$i]['user_id'] == ANONYMOUS )
{
}
else if ( $postrow[$i]['points'] )
{
for($j = 0; $j < count($groupsrow); $j++)
{
if ( $postrow[$i]['points'] >= $groupsrow[$j]['points'] )
{
$poster_group = ( $groupsrow[$j]['name'] != '' ) ? $lang['Pgroup'] . ': ' . $groupsrow[$j]['name'] : '';
}
}
}

Which I did and I get an error. which states "Parse error: parse error, unexpected T_VARIABLE in /home2/lostboy/public_html/main/modules/Forums/viewtopic.php on line 996" Please see my attach file and see what I'm doing wrong.



Attached Files
memberlist_forum_points.zip (30.42 KB, Downloaded: 5247 Time(s))


Back to top Reply with quote
#7   
trusted-host
CZ Super Newbie
trusted-host has been a member for over 20 year's 20 Year Member
canada.gif
Occupation: Self Employeed
Age: 37
Gender: Male
Fav. Sports Team: Toronto Maple Leafs
Website:
Status: Offline
Joined: Sep 06, 2004
0.01 posts per day
Posts: 49
Points: 2,410
   
Hello

Have you installed the install file that comes with the point system? and Make sure you installed everything correctly into the files it say to edit.

Trusted-Host



Back to top Reply with quote
#8   re: 7.0+ User Points in Forums
lostboyca
CZ Active Member
lostboyca has been a member for over 20 year's 20 Year Member
usa.gif california.gif
Website:
Status: Offline
Joined: Aug 12, 2004
0.02 posts per day
Posts: 114
Points: 5,334
   
it didn't haveany install file it was basically a text file with instructions to edit some files.



Back to top Reply with quote
#9   re: 7.0+ User Points in Forums
MrFluffy
CZ Newbie
germany.gif
Age: 57
Gender: Male
Website:
Status: Offline
Joined: Oct 21, 2003
0.00 posts per day
Posts: 4
Points: 402
   ICQ Number
Hello,

my mods for Nuke 7 are no longer available under their old links.
Please use those instead:

[ Register or login to view links on this board.]

[ Register or login to view links on this board.]

And new:
[ Register or login to view links on this board.]




_________________
cu,
MrFluffy icon_wink.gif
Back to top Reply with quote
#10   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
Thank you MrFluffy.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum