Group Rank Hack Install problem!
Forum rules
DO NOT give out any FTP passwords to anyone! There is no reason to do so! If you need help badly enough, create a temporary FTP account that is restricted to only the files that you need help with and give the information for that. Giving out FTP information can be very dangerous!
DO NOT give out any FTP passwords to anyone! There is no reason to do so! If you need help badly enough, create a temporary FTP account that is restricted to only the files that you need help with and give the information for that. Giving out FTP information can be very dangerous!
-
- Registered User
- Posts: 31
- Joined: Wed Jan 17, 2007 9:28 pm
- Location: Ontario, Canada
- Contact:
Re: Group Rank Hack Install problem!
Okay! Is there a EM Version of the Group Rank Hack?
-
- Registered User
- Posts: 7219
- Joined: Tue Nov 16, 2004 8:54 pm
- Location: Florida, US
- Contact:
Re: Group Rank Hack Install problem!
Ok, I created this EM Friendly version of the MOD. This is untested, so there are bound to be conflicts that still need to be resolved. Try it and see what happens...
![Image](https://camo.phpbb.com/6f61714d618bbe55dbabf75cc2c43d1714a5a383/687474703a2f2f696d6736362e696d616765736861636b2e75732f696d6736362f373332392f6865616462616e676873382e676966)
Code: Select all
#################################################################
## MOD Title: Group Rank Hack - EM Friendly
## MOD Author: Saerdnaer < saerdnaer@web.de >
## MOD Description: This Hack (MOD) allows you to give different ranks for groups
## Mod Version: 1.0.3
##
## phpBB Version: Tested on 2.0.3 and 2.0.4
## Download-Site: https://sourceforge.net/project/showfiles.php?group_id=65919
##
## Installation Level: easy
## Installation Time: 15 Minutes
##
## Files To Edit: 7
## viewtopic.php
## admin/admin_groups.php
## admin/admin_ranks.php
## includes/usercp_viewprofile.php
## language/lang_english/lang_admin.php
## templates/subSilver/admin/ranks_edit_body.tpl
##
## Included Files: 2
## admin/admin_group_rank.php
## templates/subSilver/admin/group_rank_order_body.tpl
##
#################################################################
## H I S T O R Y
##
## V 1.0.3:
## - Optimized query in usercp_viewproile.php
## - Optimized xxx_id_sql's in viewtopic.php
## - Added addon: Rank in memberlist.php
##
## V 1.0.2:
## - Fixed ddd bug in viewtopic
## - Fixed list errors with mysql4 db-layer
##
## V 1.0.1:
## - Fixed bug in install manual for viewtopic.php
## - Fixed bugs in language-files
##
## V 1.0.0:
## - First relase
##
#################################################################
## I N S T A L L A T I O N
##
## Installation Level: easy
## Installation Time: 15 Minutes
##
## Files To Edit: 6 + x
## /viewtopic.php
## /includes/usercp_viewprofile.php
## /admin/admin_groups.php
## /admin/admin_ranks.php
## /language/lang_xxx/lang_admin.php
## /templates/subSilver/admin/ranks_edit_body.tpl
##
## Included Files: 2 + x
## /admin/admin_group_rank.php
## /templates/subSilver/admin/group_rank_order_body.tpl
##
#################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files
#################################################################
#
#-----[ DIY INSTRUCTIONS ]------------------------------------------
#
Upload install_gr_hack.php to your phpBB forum folder and run from your browser
Delete install_gr_hack.php from your phpBB forum folder
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
$postrow = array();
#
#-----[ AFTER, ADD ]------------------------------------------
#
$poster_id_sql = ''; // ADDED BY Group Rank Hack
#
#-----[ FIND ]------------------------------------------
#
$postrow[] = $row;
#
#-----[ AFTER, ADD ]------------------------------------------
#
$poster_id_sql .= ( $row['user_rank'] ) ? '' : ( ( empty($poster_id_sql) ? '' : ',' ) . $row['user_id'] ); // ADDED BY Group Rank Hack
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT *
#
#-----[ BEFORE, ADD ]------------------------------------------
#
/* COMMENTED BY Group Rank Hack
#
#-----[ FIND ]------------------------------------------
#
$db->sql_freeresult($result);
#
#-----[ AFTER, ADD ]------------------------------------------
#
*/
$sql = "SELECT *
FROM " . RANKS_TABLE . "
ORDER BY rank_special, rank_min DESC"; // ADDED ' DESC' BY Group Rank Hack
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain ranks information.", '', __LINE__, __FILE__, $sql);
}
$ranksrow = array();
$rank_group_id_sql = ''; // ADDED BY Group Rank Hack
while ( $row = $db->sql_fetchrow($result) )
{
// BEGIN Group Rank Hack
if ( $row['rank_special'] )
{
$ranksrow[-1][$row['rank_id']] = $row;
}
else
{
$ranksrow[$row['rank_group']][] = $row;
$rank_group_id_sql .= $row['rank_group'] > 0 ? ( ( empty($rank_group_id_sql) ? '' : ',' ) . $row['rank_group'] ) : '';
$ranksrow[$row['rank_group']]['count']++;
}
// END Group Rank Hack
// $ranksrow[] = $row; // COMMENTED BY Group Rank Hack
}
$db->sql_freeresult($result);
// BEGIN Group Rank Hack
$poster_group = array();
if ( !empty($poster_id_sql) && !empty($rank_group_id_sql) )
{
$sql = "SELECT ug.user_id, ug.group_id
FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
WHERE ug.user_id IN ( $poster_id_sql )
AND ug.group_id IN ( $rank_group_id_sql )
AND g.group_id = ug.group_id
AND g.group_single_user = 0
ORDER BY g.group_order DESC";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain poster group information.", '', __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result) )
{
$poster_group[$row['user_id']] = $row['group_id'];
}
$db->sql_freeresult($result);
}
// END Group Rank Hack
#
#-----[ FIND ]------------------------------------------
#
else if ( $postrow[$i]['user_rank'] )
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// BEGIN Group Rank Hack
else if ( $postrow[$i]['user_rank'] )
{
$poster_rank = $ranksrow[-1][$postrow[$i]['user_rank']]['rank_title'];
$rank_image = ( $ranksrow[-1][$postrow[$i]['user_rank']]['rank_image'] ) ? '<img src="' . $ranksrow[-1][$postrow[$i]['user_rank']]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
}
else if ( isset($poster_group[$postrow[$i]['user_id']]) )
{
$g = $poster_group[$postrow[$i]['user_id']];
for($j = 0; $j < $ranksrow[$g]['count']; $j++)
{
if ( $postrow[$i]['user_posts'] >= $ranksrow[$g][$j]['rank_min'] )
{
$poster_rank = $ranksrow[$g][$j]['rank_title'];
$rank_image = ( $ranksrow[$g][$j]['rank_image'] ) ? '<img src="' . $ranksrow[$g][$j]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
break;
}
}
}
else
{
for($j = 0; $j < $ranksrow[0]['count']; $j++)
{
if ( $postrow[$i]['user_posts'] >= $ranksrow[0][$j]['rank_min'] )
{
$poster_rank = $ranksrow[0][$j]['rank_title'];
$rank_image = ( $ranksrow[0][$j]['rank_image'] ) ? '<img src="' . $ranksrow[0][$j]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
break;
}
}
}
// END Group Rank Hack
/* COMMENTED BY Group Rank Hack
#
#-----[ FIND ]------------------------------------------
#
//
// Handle anon users posting with usernames
#
#-----[ BEFORE, ADD ]------------------------------------------
#
*/
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT *
#
#-----[ BEFORE, ADD ]------------------------------------------
#
/* COMMENTED BY Group Rank Hack
#
#-----[ FIND ]------------------------------------------
#
$db->sql_freeresult($result);
#
#-----[ AFTER, ADD ]------------------------------------------
#
*/
#
#-----[ FIND ]------------------------------------------
#
if ( $profiledata['user_rank'] )
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// BEGIN Group Rank Hack
if ( $profiledata['user_rank'] )
{
$sql = "SELECT *
FROM " . RANKS_TABLE . "
WHERE rank_id = '" . $profiledata['user_rank'] . "'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain user speical rank ', '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
$poster_rank = $row['rank_title'];
$rank_image = ( $row['rank_image'] ) ? '<img src="' . $row['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
}
$db->sql_freeresult($result);
}
else
{
$sql = "SELECT *
FROM " . RANKS_TABLE . "
WHERE rank_special = 0
ORDER BY rank_min DESC";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain ranks information', '', __LINE__, __FILE__, $sql);
}
$ranksrow = array();
$rank_group_id_sql = '';
while ( $row = $db->sql_fetchrow($result) )
{
$ranksrow[$row['rank_group']][] = $row;
$rank_group_id_sql .= $row['rank_group'] > 0 ? ( ( empty($rank_group_id_sql) ? '' : ',' ) . $row['rank_group'] ) : '';
$ranksrow[$row['rank_group']]['count']++;
}
$db->sql_freeresult($result);
$rank_group_id = 0;
if ( !empty($rank_group_id_sql) )
{
$sql = "SELECT ug.group_id
FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
WHERE ug.user_id = " . $profiledata['user_id'] . "
AND g.group_id = ug.group_id
AND g.group_single_user = 0
AND g.group_id IN ( $rank_group_id_sql )
ORDER BY g.group_order ASC
LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain user group information.", '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
$rank_group_id = $row['group_id'];
}
$db->sql_freeresult($result);
}
for($i = 0; $i < $ranksrow[$rank_group_id]['count']; $i++)
{
if ( $profiledata['user_posts'] >= $ranksrow[$rank_group_id][$i]['rank_min'] )
{
$poster_rank = $ranksrow[$rank_group_id][$i]['rank_title'];
$rank_image = ( $ranksrow[$rank_group_id][$i]['rank_image'] ) ? '<img src="' . $ranksrow[$rank_group_id][$i]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
break;
}
}
}
// END Group Rank Hack
/* COMMENTED BY Group Rank Hack
#
#-----[ FIND ]------------------------------------------
#
$temp_url = append_sid
#
#-----[ BEFORE, ADD ]------------------------------------------
#
*/
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_groups.php
#
#-----[ FIND ]------------------------------------------
#
else if( $mode == 'newgroup' )
{
#
#-----[ AFTER, ADD ]------------------------------------------
#
// BEGIN Group Rank Hack
$sql = "SELECT MAX(group_order) AS max_order
FROM " . GROUPS_TABLE . "
WHERE group_single_user = 0";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not insert new group', '', __LINE__, __FILE__, $sql);
}
$group_order = $db->sql_fetchrow($result);
$group_order = $group_order['max_order'] + 1;
// END Group Rank Hack
#-----[ FIND ]------------------------------------------
#
$sql = "INSERT INTO " . GROUPS_TABLE
VALUES
#
#-----[ IN-LINE FIND ]------------------------------------------
#
group_single_user
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, group_order
#
#-----[ IN-LINE FIND ]------------------------------------------
#
'0'
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, $group_order
#
#-----[ AFTER, ADD ]------------------------------------------
#
// ADDED ', group_order' AND ', $group_order' BY Group Rank Hack
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_ranks.php
#
#-----[ FIND ]------------------------------------------
#
$rank_info['rank_special'] = 0;
#
#-----[ AFTER, ADD ]------------------------------------------
#
$rank_info['rank_group'] = 0; // ADDED BY Group Rank Hack
#
#-----[ FIND ]------------------------------------------
#
$rank_is_not_special = (
#
#-----[ AFTER, ADD ]------------------------------------------
#
// BEGIN Group Rank Hack
$sql = "SELECT group_id, group_name
FROM " . GROUPS_TABLE . "
WHERE group_single_user = 0
ORDER BY group_name";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain group list', '', __LINE__, __FILE__, $sql);
}
$group_select = '';
if ( $row = $db->sql_fetchrow($result) )
{
$group_select .= '<select name="group">';
$group_select .= '<option value="0">' . $lang['No'] . '</option>';
do
{
$selected = ( $rank_info['rank_group'] == $row['group_id'] ) ? ' selected="selected"' : '';
$group_select .= '<option value="' . $row['group_id'] . '"' . $selected . '>' . $row['group_name'] . '</option>';
}
while ( $row = $db->sql_fetchrow($result) );
$group_select .= '</select>';
}
if ( !empty($group_select) )
{
$template->assign_block_vars('switch_group_rank', array(
'L_GROUP_RANK' => $lang['Group_rank'],
'L_GROUP_RANK_EXPLAIN' => $lang['Group_rank_explain'],
'GROUP_RANK_SELECT' => $group_select)
);
}
// END Group Rank Hack
#
#-----[ FIND ]------------------------------------------
#
$special_rank = (
#
#-----[ AFTER, ADD ]------------------------------------------
#
$group = ( $HTTP_POST_VARS['group'] > 0 ) ? intval($HTTP_POST_VARS['group']) : 0; // ADDED BY Group Rank Hack
#
#-----[ FIND ]------------------------------------------
#
$min_posts = -1;
#
#-----[ AFTER, ADD ]------------------------------------------
#
$group = 0; // ADDED BY Group Rank Hack
#
#-----[ FIND ]------------------------------------------
#
$sql = "UPDATE " . RANKS_TABLE . "
SET
WHERE
#
#-----[ IN-LINE FIND ]------------------------------------------
#
str_replace("\'", "''", $rank_image) . "'
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, rank_group = $group
#
#-----[ AFTER, ADD ]------------------------------------------
#
// ADDED ', rank_group = $group' BY Group Rank Hack
#
#-----[ FIND ]------------------------------------------
#
$sql = "INSERT INTO " . RANKS_TABLE
VALUES
#
#-----[ IN-LINE FIND ]------------------------------------------
#
rank_image
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, rank_group
#
#-----[ IN-LINE FIND ]------------------------------------------
#
str_replace("\'", "''", $rank_image) . "'
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, $group
#
#-----[ AFTER, ADD ]------------------------------------------
#
// ADDED ', rank_group' ', $group' BY Group Rank Hack
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT * FROM " . RANKS_TABLE . "
ORDER
#
#-----[ REPLACE WITH ]------------------------------------------
#
$sql = "SELECT r.*, g.group_name
FROM " . RANKS_TABLE . " r
LEFT JOIN " . GROUPS_TABLE . " g ON g.group_id = r.rank_group
ORDER BY r.rank_special DESC, rank_group ASC, r.rank_min ASC"; // ADDED 'r.' AND ', g.group_name' AND 'r LEFT JOIN " . GROUPS_TABLE . " g ON g.group_id = r.rank_group' AND 'rank_group ASC, ' BY Group Rank Hack
#
#-----[ FIND ]------------------------------------------
#
"L_SPECIAL_RANK" =>
#
#-----[ REPLACE WITH ]------------------------------------------
#
"L_SPECIAL_RANK" => $lang['Group_Rank_special'], // ADDED 'Group_' BY Group Rank Hack
#
#-----[ FIND ]------------------------------------------
#
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
$rank_is_special = ( $special_rank ) ? $lang['Yes'] : ( $rank_rows[$i]['rank_group'] > 0 ? $rank_rows[$i]['group_name'] : $lang['No'] ); // ADDED BY Group Rank Hack
#
#-----[ FIND ]------------------------------------------
#
"SPECIAL_RANK" =>
#
#-----[ REPLACE WITH ]------------------------------------------
#
"SPECIAL_RANK" => $rank_is_special, // REPLACED '( $special_rank == 1 ) ? $lang['Yes'] : $lang['No']' WITH '$rank_is_special' BY Group Rank Hack
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_admin.php
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Group Rank Hack
$lang['Group_rank'] = "Grouprank";
$lang['Group_rank_explain'] = "Here you can say that this rank only can be used by the selected group. This rank is disabled, if this rank is a special rank.";
$lang['Group_Rank_special'] = "Special- / Grouprank";
$lang['Group_rank_order'] = "Grouprank order";
$lang['Group_rank_order_moved'] = "Group moved successfully.";
$lang['Group_rank_order_alreay_moved'] = "Group already moved.";
$lang['Group_rank_order_could_not_moved'] = "These Group couldn't moved because it is already at the top / bottom.";
$lang['Group_rank_resynced'] = "Grouporder was resynced succesfully.";
$lang['Group_rank_order_title'] = "Groupranks - Order";
$lang['Group_rank_order_explain'] = "If a user is a member of two or more groups with own groupranks, the grouprank of the group, witch is higher in this list, will be shown.";
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/ranks_edit_body.tpl
#
#-----[ FIND ]------------------------------------------
#
{SPECIAL_RANK}
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- BEGIN switch_group_rank -->
<tr>
<td class="row1"><span class="gen">{switch_group_rank.L_GROUP_RANK}:</span><br />
<span class="gensmall">{switch_group_rank.L_GROUP_RANK_EXPLAIN}</span></td>
<td class="row2">{switch_group_rank.GROUP_RANK_SELECT}</td>
</tr>
<!-- END switch_group_rank -->
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Last edited by Nightrider on Thu Jan 18, 2007 8:55 am, edited 2 times in total.
-
- Registered User
- Posts: 31
- Joined: Wed Jan 17, 2007 9:28 pm
- Location: Ontario, Canada
- Contact:
Re: Group Rank Hack Install problem!
Do I just save that info as a txt file and upload it to the mods folder or?
-
- Registered User
- Posts: 7219
- Joined: Tue Nov 16, 2004 8:54 pm
- Location: Florida, US
- Contact:
Re: Group Rank Hack Install problem!
You would copy and paste that code into a text file, then store it in the original MOD folder, replacing the one that came with the MOD. Then you would upload the MOD folder to admin/mods. The MOD should then be listed in EM's Unprocessed list...
![Image](https://camo.phpbb.com/6f61714d618bbe55dbabf75cc2c43d1714a5a383/687474703a2f2f696d6736362e696d616765736861636b2e75732f696d6736362f373332392f6865616462616e676873382e676966)
-
- Registered User
- Posts: 31
- Joined: Wed Jan 17, 2007 9:28 pm
- Location: Ontario, Canada
- Contact:
Re: Group Rank Hack Install problem!
This came up
Critical Error
FIND FAILED: In file [admin/admin_ranks.php] could not find:
$sql = "SELECT * FROM " . RANKS_TABLE . "
ORDER
MOD script line #510 :: FAQ :: Report
But there was no Unprocessed Commands & there was tons of Commands Processed so????
Critical Error
FIND FAILED: In file [admin/admin_ranks.php] could not find:
$sql = "SELECT * FROM " . RANKS_TABLE . "
ORDER
MOD script line #510 :: FAQ :: Report
But there was no Unprocessed Commands & there was tons of Commands Processed so????
-
- Registered User
- Posts: 7219
- Joined: Tue Nov 16, 2004 8:54 pm
- Location: Florida, US
- Contact:
Re: Group Rank Hack Install problem!
Ok, I had to rearrange some code and remove some others. I edited the MOD script that I posted above with the changes, so go ahead and copy and paste it into your MOD script and upload it to the MOD folder in admin/mods. Then try it again using EM...
![Image](https://camo.phpbb.com/6f61714d618bbe55dbabf75cc2c43d1714a5a383/687474703a2f2f696d6736362e696d616765736861636b2e75732f696d6736362f373332392f6865616462616e676873382e676966)
-
- Registered User
- Posts: 31
- Joined: Wed Jan 17, 2007 9:28 pm
- Location: Ontario, Canada
- Contact:
Re: Group Rank Hack Install problem!
Did it again and got this in EM
Error Detail
Critical Error
FIND FAILED: In file [admin/admin_ranks.php] could not find:
"L_SPECIAL_RANK" =>
MOD script line #502 :: FAQ :: Report
Error Detail
Critical Error
FIND FAILED: In file [admin/admin_ranks.php] could not find:
"L_SPECIAL_RANK" =>
MOD script line #502 :: FAQ :: Report
-
- Registered User
- Posts: 7219
- Joined: Tue Nov 16, 2004 8:54 pm
- Location: Florida, US
- Contact:
Re: Group Rank Hack Install problem!
Ok, that might have been my fault. I removed the extra code and copied it back into the MOD script above. So try it again...
![Image](https://camo.phpbb.com/6f61714d618bbe55dbabf75cc2c43d1714a5a383/687474703a2f2f696d6736362e696d616765736861636b2e75732f696d6736362f373332392f6865616462616e676873382e676966)
-
- Registered User
- Posts: 31
- Joined: Wed Jan 17, 2007 9:28 pm
- Location: Ontario, Canada
- Contact:
Re: Group Rank Hack Install problem!
Says
Install complete, and i click view the final install steps and i get this
Parse error: syntax error, unexpected T_VARIABLE in /home/virtuap0/public_html/forum/language/lang_english/lang_admin.php on line 1668
Install complete, and i click view the final install steps and i get this
Parse error: syntax error, unexpected T_VARIABLE in /home/virtuap0/public_html/forum/language/lang_english/lang_admin.php on line 1668
-
- Registered User
- Posts: 31
- Joined: Wed Jan 17, 2007 9:28 pm
- Location: Ontario, Canada
- Contact:
Re: Group Rank Hack Install problem!
Fixed that problem myself
moved the install code above another code and it worked.
Problem is now...you know how I installed the code manually before? I think this EM install doubled everything?
![Wink ;)](./images/smilies/icon_e_wink.gif)
Problem is now...you know how I installed the code manually before? I think this EM install doubled everything?