bestbuildpc: Forums
 

 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

2ns Rank In View Topic And Member List
 
 
Post new topic   Reply to topic    bestbuildpc Forum Index -> RavenNuke -> Mods and Hacks
View previous topic :: View next topic  
Author Message
bestbuildpc
Site Admin
Site Admin


Joined: Jun 30, 2012
Posts: 213
Location: NL

PostPosted: Tue May 28, 2013 23:48    Post subject: 2ns Rank In View Topic And Member List Reply with quote

Code:
############################################################## 

## MOD Title: 2ns Rank In View Topic And Member List
## MOD Description: This mod add a new user rank , the new rank will be showed in each topic and in the memberlist.
## NUKE MOD Version: 1.0
## Installation Level: Easy
## Installation Time: 10 minutes
## Files to Edit: viewtopic.php,
##                template/subSilver/viewtopic_body.tpl,
##                memberlist.php,
##                template/subSilver/memberlist_body.tpl,
##                admin/admin_user.php,
##                template/subSilver/admin/user_edit_body.tpl,
##                includes/usercp_viewprofile.php,
##                templates/subSilver/profile_view_body.tpl,
##                language/lang_english/lang_admin.php
##
## IF YOU ARE USING A CUSTOM THEME THAN CHANGE "template/SubSilver/" to "themes/YOURTHEME/"
##
## Included Files: A set of rank images.
########################################################
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
##############################################################
## THIS IS A PORTED MOD FROM PHPBB2 FORUMS
## ***USE @ YOUR OWN RISK***
## BACK UP ALL FILES BEING MODIFIED!!!
##############################################################
## Author Notes:
## Revision History:
##
## Version 1.0:
## Added rank images in view profile.
##
## Version 1.00:
## First stable release.
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ SQL ]------------------------------------------
#
ALTER TABLE nuke_users ADD user_rank2 INT(11) AFTER user_rank;
UPDATE phpbb_users SET user_rank2 = "0";
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
//
// Go ahead and pull all data for this topic
//
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_from_flag, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, u.user_allow_viewonline, u.user_session_time, p.*,  pt.post_text, pt.post_subject, pt.bbcode_uid, t.style_name
#
#-----[ IN-LINE FIND ]------------------------------------------
#
, u.user_rank
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, u.user_rank2
#
#-----[ FIND ]------------------------------------------
#
            $poster_rank = $ranksrow[$j]['rank_title'];
            $rank_image = ( $ranksrow[$j]['rank_image'] ) ? '<img src="' . $ranksrow[$j]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
         }
      }
   }
#
#-----[ AFTER, ADD ]------------------------------------------
#
   //
   // Rank 2 Begin
   //
   $poster_rank2 = '';
   $rank2_image = '';
   if ( $postrow[$i]['user_id'] == ANONYMOUS )
   {
   }
   else if ( $postrow[$i]['user_rank2'] )
   {
      for($j = 0; $j < count($ranksrow); $j++)
      {
         if ( $postrow[$i]['user_rank2'] == $ranksrow[$j]['rank_id'] && $ranksrow[$j]['rank_special'] )
         {
            $poster_rank2 = $ranksrow[$j]['rank_title'];
            $rank2_image = ( $ranksrow[$j]['rank_image'] ) ? '<img src="' . $ranksrow[$j]['rank_image'] . '" alt="' . $poster_rank2 . '" title="' . $poster_rank2 . '" border="0" /><br />' : '';
         }
      }
   }
   //
   // Rank 2 End
   //
#
#-----[ FIND ]------------------------------------------
#
   'POSTER_RANK' => $poster_rank,
   'RANK_IMAGE' => $rank_image,
#
#-----[ AFTER, ADD ]------------------------------------------
#
   'POSTER_RANK2' => $poster_rank2,
   'RANK2_IMAGE' => $rank2_image,
#
#-----[ OPEN ]------------------------------------------
#
template/subSilver/viewtopic_body.tpl
#
#-----[ FIND ]------------------------------------------
#
   {postrow.RANK_IMAGE}<br /><br />
#
#-----[ AFTER, ADD ]------------------------------------------
#
   {postrow.POSTER_RANK2}<br />
   {postrow.RANK2_IMAGE}<br />
#
#-----[ OPEN ]------------------------------------------
#
memberlist.php
#
#-----[ FIND ]------------------------------------------
#
'L_ICQ' => $lang['ICQ'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_USER_RANK' => $lang['Poster_rank'],
#
#-----[ FIND ]------------------------------------------
#
$order_by = "user_join $sort_order LIMIT $start, " . $board_config['topics_per_page'];
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
//
// Rank Begin
//
$sql = "SELECT *
   FROM " . RANKS_TABLE . "
   ORDER BY rank_special, rank_min";
if ( !($result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, "Could not obtain ranks information.", '', __LINE__, __FILE__, $sql);
}
$ranksrow = array();
while ( $row = $db->sql_fetchrow($result) )
{
   $ranksrow[] = $row;
}
$db->sql_freeresult($result);
//
// Rank End
//
#
#-----[ FIND ]------------------------------------------
#
, user_allowavatar
#
#-----[ AFTER, ADD ]------------------------------------------
#
, user_rank , user_rank2
#
#-----[ FIND ]------------------------------------------
#
$posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0;
#
#-----[ AFTER, ADD ]------------------------------------------
#
      //
      // Rank Begin
      // Generate ranks, set them to empty string initially.
      //
      $user_rank = '';
      $rank_image = '';
      if ( $row['user_rank'] )
      {
         for($j = 0; $j < count($ranksrow); $j++)
         {
            if ( $row['user_rank'] == $ranksrow[$j]['rank_id'] && $ranksrow[$j]['rank_special'] )
            {
               $user_rank = $ranksrow[$j]['rank_title'];
               $rank_image = ( $ranksrow[$j]['rank_image'] ) ? '<img src="' . $ranksrow[$j]['rank_image'] . '" alt="' . $user_rank . '" title="' . $user_rank . '" border="0" /><br />' : '';
            }
         }
      }
      else
      {
         for($j = 0; $j < count($ranksrow); $j++)
         {
            if ( $row['user_posts'] >= $ranksrow[$j]['rank_min'] && !$ranksrow[$j]['rank_special'] )
            {
               $user_rank = $ranksrow[$j]['rank_title'];
               $rank_image = ( $ranksrow[$j]['rank_image'] ) ? '<img src="' . $ranksrow[$j]['rank_image'] . '" alt="' . $user_rank . '" title="' . $user_rank . '" border="0" /><br />' : '';
            }
         }
      }
      //
      // Rank End
      //

      //
      // Rank 2 Begin
      // Generate ranks, set them to empty string initially.
      //
      $user_rank2 = '';
      $rank2_image = '';
      if ( $row['user_rank2'] )
      {
         for($j = 0; $j < count($ranksrow); $j++)
         {
            if ( $row['user_rank2'] == $ranksrow[$j]['rank_id'] && $ranksrow[$j]['rank_special'] )
            {
               $user_rank2 = $ranksrow[$j]['rank_title'];
               $rank2_image = ( $ranksrow[$j]['rank_image'] ) ? '<img src="' . $ranksrow[$j]['rank_image'] . '" alt="' . $user_rank2 . '" title="' . $user_rank2 . '" border="0" /><br />' : '';
            }
         }
      }
      //
      // Rank 2 End
      //
#
#-----[ FIND ]------------------------------------------
#
'JOINED' => $joined,
#
#-----[ AFTER, ADD ]------------------------------------------
#
   'USER_RANK' => $user_rank,
   'USER_RANK_IMG' => $rank_image,
   'USER_RANK2' => $user_rank2,
   'USER_RANK2_IMG' => $rank2_image,
#
#-----[ OPEN ]------------------------------------------
#
template/subSilver/memberlist_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<th class="thTop" nowrap="nowrap">{L_USERNAME}</th>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<th class="thTop" nowrap="nowrap">{L_USER_RANK}</th>
#
#-----[ FIND ]------------------------------------------
#
<td class="{memberrow.ROW_CLASS}" align="center"><span class="gen"><a href="{memberrow.U_VIEWPROFILE}" class="gen">{memberrow.USERNAME}</a></span></td>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<td class="{memberrow.ROW_CLASS}" align="center" valign="middle">
         <span class="gensmall">
            {memberrow.USER_RANK}<br />
            {memberrow.USER_RANK_IMG}
            {memberrow.USER_RANK2}<br />
            {memberrow.USER_RANK2_IMG}
         </span>
      </td>
#
#-----[ FIND ]------------------------------------------
#
<td class="catbottom" colspan="8" height="28">&nbsp;</td>
#
#-----[ REPLACE WITH ]------------------------------------------
#
// Just add one to colspan value [USE YOUR BEST JUDGEMENT! If its 8 make it 9,etc...]
<td class="catbottom" colspan="9" height="28">&nbsp;</td>
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_user.php
#
#-----[ FIND ]------------------------------------------
#
$user_rank = ( !empty($HTTP_POST_VARS['user_rank']) ) ? intval( $HTTP_POST_VARS['user_rank'] ) : 0;
#
#-----[ AFTER, ADD ]------------------------------------------
#
$user_rank2 = ( !empty($HTTP_POST_VARS['user_rank2']) ) ? intval( $HTTP_POST_VARS['user_rank2'] ) : 0;
#
#-----[ FIND ]------------------------------------------
#
user_active = $user_status
#
#-----[ AFTER, ADD ]------------------------------------------
#
, user_rank2 = $user_rank2
#
#-----[ FIND ]------------------------------------------
#
$s_hidden_fields .= '<input type="hidden" name="user_allowavatar" value="' . $user_allowavatar . '" />';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$s_hidden_fields .= '<input type="hidden" name="user_rank2" value="' . $user_rank2 . '" />';
#
#-----[ FIND ]------------------------------------------
#
         $selected = ( $this_userdata['user_rank'] == $rank_id ) ? ' selected="selected"' : '';
         $rank_select_box .= '<option value="' . $rank_id . '"' . $selected . '>' . $rank . '</option>';
      }
#
#-----[ AFTER, ADD ]------------------------------------------
#
      //
      // Rank 2 Begin
      //
      $sql = "SELECT * FROM " . RANKS_TABLE . "
         WHERE rank_special = 1
         ORDER BY rank_title";
      if ( !($result = $db->sql_query($sql)) )
      {
         message_die(GENERAL_ERROR, 'Could not obtain ranks data', '', __LINE__, __FILE__, $sql);
      }
      $rank2_select_box = '<option value="0">' . $lang['No_assigned_rank'] . '</option>';
      while( $row = $db->sql_fetchrow($result) )
      {
         $rank = $row['rank_title'];
         $rank_id = $row['rank_id'];
         
         $selected = ( $this_userdata['user_rank2'] == $rank_id ) ? ' selected="selected"' : '';
         $rank2_select_box .= '<option value="' . $rank_id . '"' . $selected . '>' . $rank . '</option>';
      }
      //
      // Rank 2 End
      //
#
#-----[ FIND ]------------------------------------------
#
'RANK_SELECT_BOX' => $rank_select_box,
#
#-----[ AFTER, ADD ]------------------------------------------
#
'RANK2_SELECT_BOX' => $rank2_select_box,
#
#-----[ FIND ]------------------------------------------
#
'L_SELECT_RANK' => $lang['Rank_title'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_SELECT_RANK2' => $lang['Rank2_title'],
#
#-----[ OPEN ]------------------------------------------
#
template/subSilver/admin/user_edit_body.tpl
#
#-----[ FIND ]------------------------------------------
#
   <tr>
      <td class="row1"><span class="gen">{L_SELECT_RANK}</span></td>
      <td class="row2"><select name="user_rank">{RANK_SELECT_BOX}</select></td>
   </tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
   <tr>
      <td class="row1"><span class="gen">{L_SELECT_RANK2}</span></td>
      <td class="row2"><select name="user_rank2">{RANK2_SELECT_BOX}</select></td>
   </tr>
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]------------------------------------------
#
         $rank_image = ( $ranksrow[$i]['rank_image'] ) ? '<img src="' . $ranksrow[$i]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
      }
   }
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
   //
   // Rank 2 Begin
   //
   $poster_rank2 = '';
   $rank2_image = '';
   if ( $profiledata['user_rank2'] )
   {
      for($i = 0; $i < count($ranksrow); $i++)
      {
         if ( $profiledata['user_rank2'] == $ranksrow[$i]['rank_id'] && $ranksrow[$i]['rank_special'] )
         {
            $poster_rank2 = $ranksrow[$i]['rank_title'];
            $rank2_image = ( $ranksrow[$i]['rank_image'] ) ? '<img src="' . $ranksrow[$i]['rank_image'] . '" alt="' . $poster_rank2 . '" title="' . $poster_rank2 . '" border="0" /><br />' : '';
         }
      }
   }
   //
   // Rank 2 End
   //
#
#-----[ FIND ]------------------------------------------
#
   'POSTER_RANK' => $poster_rank,
   'RANK_IMAGE' => $rank_image,

#
#-----[ AFTER, ADD ]------------------------------------------
#
   'POSTER_RANK2' => $poster_rank2,
   'RANK2_IMAGE' => $rank2_image,
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_view_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<span class="postdetails">{POSTER_RANK}
#
#-----[ AFTER, ADD ]------------------------------------------
#
{RANK_IMAGE}<br />{POSTER_RANK2}<br />{RANK2_IMAGE}
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_admin.php
#
#-----[ FIND ]------------------------------------------
#
$lang['Rank_title'] = "Rank Title";
#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['Rank2_title'] = "Rank 2 Title";
#
#-----[ SAVE/CLOSE ALL FILES ]----------------------------------------
#
# GO TO PHPNUKE > FORUM ADMINISTRATION > USERS > MANAGMENT
# THIS IS WHERE THE NEW RANK CAN BE ADDED OR REMOVED FOR EACH USER!
# EoM
  
Back to top
View user's profile Send private message Visit poster's website
bestbuildpc
Site Admin
Site Admin


Joined: Jun 30, 2012
Posts: 213
Location: NL

PostPosted: Tue May 28, 2013 23:52    Post subject: Reply with quote

Getting both rank images to show in the Who is where v2.0 block.


Search for

Code:
if ($usebbranks == 1) { 

   //Ranks...
   $result_rank = $db->sql_query("SELECT * FROM ".$prefix."_bbranks ORDER BY rank_special, rank_min");
   $ranksrow = array();
   while ( $row = $db->sql_fetchrow($result_rank) ) {
           $ranksrow[] = $row;
   }
   $db->sql_freeresult($result_rank);

        if ($userinfo['user_rank']) {
            for($j = 0; $j < count($ranksrow); $j++) {
              if ($userinfo['user_rank'] == $ranksrow[$j]['rank_id'] && $ranksrow[$j]['rank_special']) {
                  $poster_rank = $ranksrow[$j]['rank_title'];
                  $rank_image = ($ranksrow[$j]['rank_image']) ? '<img src="'.$ranksrow[$j]['rank_image'].'" alt="'.$poster_rank.'" title="'.$poster_rank.'" border="0"><br />' : '';
              }
            }
        } else {
           for($j = 0; $j < count($ranksrow); $j++) {
             if ($userinfo['user_posts'] >= $ranksrow[$j]['rank_min'] && !$ranksrow[$j]['rank_special']) {
                  $poster_rank = $ranksrow[$j]['rank_title'];
                  $rank_image = ($ranksrow[$j]['rank_image']) ? '<img src="'.$ranksrow[$j]['rank_image'].'" alt="'.$poster_rank.'" title="'.$poster_rank.'" border="0"><br />' : '';
             }
           }
        }
   $content .= "<center>".$rank_image."".$poster_rank."</center>\n";
}


Replace with

Code:
if ($usebbranks == 1) { 

   //Ranks...
   $result_rank = $db->sql_query("SELECT * FROM ".$prefix."_bbranks ORDER BY rank_special, rank_min");
   $ranksrow = array();
   while ( $row = $db->sql_fetchrow($result_rank) ) {
           $ranksrow[] = $row;
   }
   $db->sql_freeresult($result_rank);

        if (($userinfo['user_rank']) OR ($userinfo['user_rank2'])) {
            for($j = 0; $j < count($ranksrow); $j++) {
              if ($userinfo['user_rank'] == $ranksrow[$j]['rank_id'] && $ranksrow[$j]['rank_special']) {
                  $poster_rank = $ranksrow[$j]['rank_title'];
                  $rank_image = ($ranksrow[$j]['rank_image']) ? '<img src="'.$ranksrow[$j]['rank_image'].'" alt="'.$poster_rank.'" title="'.$poster_rank.'" border="0"><br />' : '';
              }
            }

            for($j = 0; $j < count($ranksrow); $j++) {
              if ($userinfo['user_rank2'] == $ranksrow[$j]['rank_id'] && $ranksrow[$j]['rank_special']) {
                  $poster_rank2 = $ranksrow[$j]['rank_title'];
                  $rank_image2 = ($ranksrow[$j]['rank_image']) ? '<img src="'.$ranksrow[$j]['rank_image'].'" alt="'.$poster_rank2.'" title="'.$poster_rank2.'" border="0"><br />' : '';
              }
            }

      } else {
           for($j = 0; $j < count($ranksrow); $j++) {
             if ($userinfo['user_posts'] >= $ranksrow[$j]['rank_min'] && !$ranksrow[$j]['rank_special']) {
                  $poster_rank = $ranksrow[$j]['rank_title'];
                  $rank_image = ($ranksrow[$j]['rank_image']) ? '<img src="'.$ranksrow[$j]['rank_image'].'" alt="'.$poster_rank.'" title="'.$poster_rank.'" border="0"><br />' : '';
             }
           }
        }
   $content .= "<center>".$rank_image."".$poster_rank."</center>\n";
   $content .= "<center>".$rank_image2."".$poster_rank2."</center>\n";
}


In order to show only images. You need to do this change

Search for

Code:
$content .= "<center>".$rank_image."".$poster_rank."</center>\n"; 

$content .= "<center>".$rank_image2."".$poster_rank2."</center>\n";


Replace with

Code:
$content .= "<center>".$rank_image."</center>\n"; 

$content .= "<center>".$rank_image2."</center>\n";


now it shows only images. You can do this with all login blocks from Xtreme V5. Remember to activate blank space on your editor so you realize when you copy and paste from forums you get blank spaces at the end of the lines. U need to fix that.
  
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic    bestbuildpc Forum Index -> RavenNuke -> Mods and Hacks All times are GMT + 2 Hours
 
 Page 1 of 1

 

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

Powered by phpBB © 2001-2008 phpBB Group
 
Forums ©