[2.0.14] Add Multiple Ranks And Staff View

The cleanup is complete. This forum is now read only.

Rating:

Excellent!
27
53%
Very Good
10
20%
Good
10
20%
Fair
3
6%
Poor
1
2%
 
Total votes: 51

User avatar
Mighty Gorgon
Registered User
Posts: 616
Joined: Thu May 23, 2002 2:56 pm
Location: Italy
Name: Luca Libralato
Contact:

Re: [2.0.14] Add Multiple Ranks And Staff View

Post by Mighty Gorgon » Thu Nov 01, 2007 6:54 pm

TheInquistor wrote:im not sure if the author still checks in or not
shaykana wrote:MOD authors are busy people, and have lives of their own. Mighty Gorgon still checks in from time to time when able to.
Thank you very much shaykana for pointing this out. It is thanks to people like you (and I have encountered many others helping me in supporting this topic) that this community is growing stronger day by day. Without so many helping people I wouldn't be able to bring on some other projects I'm taking care.

I really appreciate your help. :)

User avatar
TheInquistor
Registered User
Posts: 304
Joined: Tue Jun 19, 2007 11:36 pm

Re: [2.0.14] Add Multiple Ranks And Staff View

Post by TheInquistor » Fri Nov 02, 2007 5:49 pm

Well the problem i have is that i cnat seem to get a handle on the phpbb scripting methods. I am unsure how to read the to templates when i look at them. I can do some basic scripting but phpbb is beyond me
[noob]ME[/noob]

User avatar
Mighty Gorgon
Registered User
Posts: 616
Joined: Thu May 23, 2002 2:56 pm
Location: Italy
Name: Luca Libralato
Contact:

Re: [2.0.14] Add Multiple Ranks And Staff View

Post by Mighty Gorgon » Sat Nov 03, 2007 11:48 am

I guess you should look into the Knowledge Base for documents explaining how to apply mods.

Or try to have a look around in this forums, there are many posts explaining it.

Learning how phpBB works isn't so easy if you are approaching it for the first time and you are not a PHP or HTML coder. It takes time and patience, I'm sure you will learn if you don't give up at the first difficult.

Good luck.

User avatar
TheInquistor
Registered User
Posts: 304
Joined: Tue Jun 19, 2007 11:36 pm

Re: [2.0.14] Add Multiple Ranks And Staff View

Post by TheInquistor » Sat Nov 03, 2007 5:07 pm

So you have not done any of the codes for the Acid Tech Templates?
[noob]ME[/noob]

User avatar
Mighty Gorgon
Registered User
Posts: 616
Joined: Thu May 23, 2002 2:56 pm
Location: Italy
Name: Luca Libralato
Contact:

Re: [2.0.14] Add Multiple Ranks And Staff View

Post by Mighty Gorgon » Sat Nov 03, 2007 10:33 pm

No, I don't have the Acid Tech template, but if you know a bit of HTML you should try to guess yourself how to modify it.

Try to look for something similar the part you have to find and try to apply the modification accordingly. Make a backup and make some tests... that's the way to learn.

If you need specific help, you can try to post here something and we may eventually try to help, but is important that you understand the logic behind the modifications you are applying... so you'll be able to apply other mods as well.

Atari@Hankoupocho
Registered User
Posts: 5
Joined: Sat Nov 03, 2007 10:43 am

Re: [2.0.14] Add Multiple Ranks And Staff View

Post by Atari@Hankoupocho » Wed Nov 07, 2007 10:55 pm

Ok I have a very general question for my situation here.
I downloaded your mod
I unzipped it
I uploaded it to ftp client.
I tried to install it on my easymod...and here is what I got..

the following below was posted in the previous topic here: ===> http://area51.phpbb.com/phpBB/viewtopic ... 21&t=29121
Atari@Hankoupocho wrote:Here's the problem I'm experiencing..
I'm trying to install the following: "Multiple Ranks with Staff and Online View in Memberlist"
that can be found on phpbb hacks. Here => http://www.phpbbhacks.com/download/991

here is what I got when I tried to process it. (look in quote)

now I'm not a phpBB expert but I suppose that means I have to edit one of the text files within it? Could I get a walkthrough on going about this? I would appreciate that...thanks

~ Unsure Admin.
Installation Failed
EasyMOD encountered the following error(s). A general error could be ABC. A critical error means D and you should do XYZ.


Error Detail

Critical Error

FIND FAILED: In file [admin/admin_ranks.php] could not find:

if($special_rank)

MOD script line #588 :: FAQ :: Report



MOD Data
MOD Title: Multiple Ranks And Staff View 2.0.1 multiple_ranks_2_0_1.txt
Author: Mighty Gorgon mightygorgon@mightygorgon.com Luca Libralato http://www.mightygorgon.com
Processed Themes: subSilver; Abandon; fisubgrey; fisubgreen; Clanzi2K
Processed Languages: english
Files Edited: 3
Commands Processed: 54
Unprocessed Commands: 0


The following commands were not recognized by EasyMOD and were ignored. The MOD script line number is displayed.
Unprocessed Commands


EasyMOD successfully processed the following commands:
Commands Processed
COPY #123
copy phpbb_root/*.php to *.php
copy phpbb_root/includes/*.php to includes/
copy phpbb_root/templates/subSilver/*.* to templates/subSilver/


SQL #141
ALTER TABLE phpbb_users ADD user_rank2 INT(11) DEFAULT '-1';
ALTER TABLE phpbb_users ADD user_rank3 INT(11) DEFAULT '-2';
ALTER TABLE phpbb_users ADD user_rank4 INT(11) DEFAULT '-2';
ALTER TABLE phpbb_users ADD user_rank5 INT(11) DEFAULT '-2';


OPEN #148
memberlist.php


FIND #152
$mode_types_text = array(


IN-LINE FIND #156
, $lang['Sort_Top_Ten']


IN-LINE AFTERADD #160
, $lang['Staff'], $lang['Who_is_Online']


FIND #164
$mode_types = array(


IN-LINE FIND #168
, 'topten'


IN-LINE AFTERADD #172
, 'staff', 'online'


FIND #176
$select_sort_mode = '<select name="mode">';


BEFOREADD #180
// Mighty Gorgon - Multiple Ranks - BEGIN
$lastfivemin = time() - 300;
// Mighty Gorgon - Multiple Ranks - END


FIND #186
'L_ICQ' => $lang['ICQ'],


AFTERADD #190
// Mighty Gorgon - Multiple Ranks - BEGIN
'L_USER_RANK' => $lang['Poster_rank'],
// Mighty Gorgon - Multiple Ranks - END


FIND #196
switch( $mode )


BEFOREADD #200
// Mighty Gorgon - Multiple Ranks - BEGIN
require_once($phpbb_root_path . 'includes/functions_mg_ranks.'.$phpEx);
$ranks_sql = query_ranks();
// Mighty Gorgon - Multiple Ranks - END


FIND #207
default:
$order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page'];
break;
}


BEFOREADD #214
// Mighty Gorgon - Multiple Ranks - BEGIN
case 'staff':
$where_sql = "AND user_level > 0";
$order_by = "user_level ASC LIMIT $start, " . $board_config['topics_per_page'];
break;
case 'online':
if ( $userdata['user_level'] == ADMIN )
{
$where_sql = "AND user_session_time >= $lastfivemin";
}
else
{
$where_sql = "AND user_session_time >= $lastfivemin AND user_allow_viewonline <> 0";
}
$order_by = "user_session_time DESC LIMIT $start, " . $board_config['topics_per_page'];
break;
// Mighty Gorgon - Multiple Ranks - END


FIND #234
$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


IN-LINE FIND #238
, user_allowavatar


IN-LINE AFTERADD #242
, user_rank , user_rank2, user_rank3, user_rank4, user_rank5, user_level, user_session_time, user_allow_viewonline


FIND #246
ORDER BY $order_by";


BEFOREADD #250
$where_sql


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


AFTERADD #258
// Mighty Gorgon - Multiple Ranks - BEGIN
$user_ranks = generate_ranks($row, $ranks_sql);

$user_rank_01 = ($user_ranks['rank_01'] == '') ? '' : ($user_ranks['rank_01'] . '<br />');
$user_rank_01_img = ($user_ranks['rank_01_img'] == '') ? '' : ($user_ranks['rank_01_img'] . '<br />');
$user_rank_02 = ($user_ranks['rank_02'] == '') ? '' : ($user_ranks['rank_02'] . '<br />');
$user_rank_02_img = ($user_ranks['rank_02_img'] == '') ? '' : ($user_ranks['rank_02_img'] . '<br />');
$user_rank_03 = ($user_ranks['rank_03'] == '') ? '' : ($user_ranks['rank_03'] . '<br />');
$user_rank_03_img = ($user_ranks['rank_03_img'] == '') ? '' : ($user_ranks['rank_03_img'] . '<br />');
$user_rank_04 = ($user_ranks['rank_04'] == '') ? '' : ($user_ranks['rank_04'] . '<br />');
$user_rank_04_img = ($user_ranks['rank_04_img'] == '') ? '' : ($user_ranks['rank_04_img'] . '<br />');
$user_rank_05 = ($user_ranks['rank_05'] == '') ? '' : ($user_ranks['rank_05'] . '<br />');
$user_rank_05_img = ($user_ranks['rank_05_img'] == '') ? '' : ($user_ranks['rank_05_img'] . '<br />');

if ( $row['user_level'] == ADMIN )
{
// You may prefer to show the level instead of coloring the username
// $level = '<b style="color:#' . $theme['fontcolor3'] . '">' . $lang['Memberlist_Administrator'] . '</b>';
$username = '<b style="color:#' . $theme['fontcolor3'] . '">' . $username . '</b>';
}
elseif( $row['user_level'] == MOD )
{
// You may prefer to show the level instead of coloring the username
// $level = '<b style="color:#' . $theme['fontcolor2'] . '">' . $lang['Memberlist_Moderator'] . '</b>';
$username = '<b style="color:#' . $theme['fontcolor2'] . '">' . $username . '</b>';
}
else
{
// You may prefer to show the level instead of coloring the username
// $level = '<b style="color:#' . $theme['fontcolor1'] . '">' . $lang['Memberlist_User'] . '</b>';
}
// Mighty Gorgon - Multiple Ranks - END



FIND #294
if ( $row['user_avatar_type'] && $user_id


IN-LINE FIND #298
&& $row['user_allowavatar']


IN-LINE AFTERADD #302
&& $mode == 'staff'


FIND #306
'YIM' => $yim,


AFTERADD #310
// Mighty Gorgon - Multiple Ranks - BEGIN
'USER_LEVEL' => $level,
'USER_RANK_01' => $user_rank_01,
'USER_RANK_01_IMG' => $user_rank_01_img,
'USER_RANK_02' => $user_rank_02,
'USER_RANK_02_IMG' => $user_rank_02_img,
'USER_RANK_03' => $user_rank_03,
'USER_RANK_03_IMG' => $user_rank_03_img,
'USER_RANK_04' => $user_rank_04,
'USER_RANK_04_IMG' => $user_rank_04_img,
'USER_RANK_05' => $user_rank_05,
'USER_RANK_05_IMG' => $user_rank_05_img,
// Mighty Gorgon - Multiple Ranks - END



FIND #327
$sql = "SELECT count(*) AS total
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS;


REPLACE #333
$sql = "SELECT count(*) AS total
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . "
$where_sql";


OPEN #340
viewtopic.php


FIND #344
$sql = "SELECT u.username,


IN-LINE FIND #348
, u.user_rank


IN-LINE AFTERADD #352
, u.user_rank2, u.user_rank3, u.user_rank4, u.user_rank5


FIND #356
$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);


REPLACE #374
// Mighty Gorgon - Multiple Ranks - BEGIN
require_once($phpbb_root_path . 'includes/functions_mg_ranks.'.$phpEx);
$ranks_sql = query_ranks();
// Mighty Gorgon - Multiple Ranks - END


FIND #381
//
// Generate ranks, set them to empty string initially.
//
$poster_rank = '';
$rank_image = '';
if ( $postrow[$i]['user_id'] == ANONYMOUS )
{
}
else if ( $postrow[$i]['user_rank'] )
{
for($j = 0; $j < count($ranksrow); $j++)
{
if ( $postrow[$i]['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 ( $postrow[$i]['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 />' : '';
}
}
}


REPLACE #414
// Mighty Gorgon - Multiple Ranks - BEGIN
$user_ranks = generate_ranks($postrow[$i], $ranks_sql);

$user_rank_01 = ($user_ranks['rank_01'] == '') ? '' : ($user_ranks['rank_01'] . '<br />');
$user_rank_01_img = ($user_ranks['rank_01_img'] == '') ? '' : ($user_ranks['rank_01_img'] . '<br />');
$user_rank_02 = ($user_ranks['rank_02'] == '') ? '' : ($user_ranks['rank_02'] . '<br />');
$user_rank_02_img = ($user_ranks['rank_02_img'] == '') ? '' : ($user_ranks['rank_02_img'] . '<br />');
$user_rank_03 = ($user_ranks['rank_03'] == '') ? '' : ($user_ranks['rank_03'] . '<br />');
$user_rank_03_img = ($user_ranks['rank_03_img'] == '') ? '' : ($user_ranks['rank_03_img'] . '<br />');
$user_rank_04 = ($user_ranks['rank_04'] == '') ? '' : ($user_ranks['rank_04'] . '<br />');
$user_rank_04_img = ($user_ranks['rank_04_img'] == '') ? '' : ($user_ranks['rank_04_img'] . '<br />');
$user_rank_05 = ($user_ranks['rank_05'] == '') ? '' : ($user_ranks['rank_05'] . '<br />');
$user_rank_05_img = ($user_ranks['rank_05_img'] == '') ? '' : ($user_ranks['rank_05_img'] . '<br />');
// Mighty Gorgon - Multiple Ranks - END


FIND #431
$poster_rank = $lang['Guest'];


REPLACE #435
$user_rank_01 = $lang['Guest'] . '<br />';


FIND #439
'POSTER_RANK' => $poster_rank,
'RANK_IMAGE' => $rank_image,


REPLACE #444
// Mighty Gorgon - Multiple Ranks - BEGIN
'USER_RANK_01' => $user_rank_01,
'USER_RANK_01_IMG' => $user_rank_01_img,
'USER_RANK_02' => $user_rank_02,
'USER_RANK_02_IMG' => $user_rank_02_img,
'USER_RANK_03' => $user_rank_03,
'USER_RANK_03_IMG' => $user_rank_03_img,
'USER_RANK_04' => $user_rank_04,
'USER_RANK_04_IMG' => $user_rank_04_img,
'USER_RANK_05' => $user_rank_05,
'USER_RANK_05_IMG' => $user_rank_05_img,
// Mighty Gorgon - Multiple Ranks - END


OPEN #459
admin/admin_ranks.php


FIND #463
$rank_is_special = ( $rank_info['rank_special'] ) ? "checked=\"checked\"" : "";
$rank_is_not_special = ( !$rank_info['rank_special'] ) ? "checked=\"checked\"" : "";


REPLACE #468
// Mighty Gorgon - Multiple Ranks - BEGIN
$rank_no_rank = ( $rank_info['rank_special'] == '-2' ) ? "checked=\"checked\"" : "";
$rank_day_counter = ( $rank_info['rank_special'] == '-1' ) ? "checked=\"checked\"" : "";
$rank_is_not_special = ( $rank_info['rank_special'] == '0' ) ? "checked=\"checked\"" : "";
$rank_is_special = ( $rank_info['rank_special'] == '1' ) ? "checked=\"checked\"" : "";
$rank_is_guest = ( $rank_info['rank_special'] == '2' ) ? "checked=\"checked\"" : "";
$rank_is_banned = ( $rank_info['rank_special'] == '3' ) ? "checked=\"checked\"" : "";

$rank_path = "../images/ranks/";
if ( is_dir($rank_path) )
{
$dir = opendir($rank_path);
$l = 0;
while($file = readdir($dir))
{
if (strpos($file, '.gif'))
{
$file1[$l] = $file;
$l++;
}
}
closedir($dir);
$ranks_list = '<select name="rank_image_sel" onchange="update_rank(this.options[selectedIndex].value);">';
if ($rank_info['rank_image'] == '')
{
$ranks_list .= "<option value=\"\" selected="selected">" . $lang['No_Rank_Image'] . "</option>";
}
else
{
$ranks_list .= "<option value=\"\">" . $lang['No_Rank_Image'] . "</option>";
$ranks_list .= "<option value=\"" . $rank_info['rank_image'] . "\" selected="selected">" . str_replace($rank_path, "", $rank_info['rank_image']) . "</option>";
}
for($k=0; $k<=$l;$k++)
{
if ($file1[$k] != "")
{
$ranks_list .= "<option value=\"images/ranks/" . $file1[$k] . "\">images/ranks/" . $file1[$k] . "</option>";
}
}
$rank_img_sp = ( ($rank_info['rank_image'] != '') ? ('../' . $rank_info['rank_image']) : $images['spacer'] );
$rank_img_path = ( $rank_info['rank_image'] != '' ) ? $rank_info['rank_image'] : '';
$ranks_list .= '</select>';
$ranks_list .= '&nbsp;&nbsp;<img name="rank_image" src="' . $rank_img_sp . '" border="0" alt="" align="absmiddle" />';
$ranks_list .= '<br /><br />';
$ranks_list .= '<input class="post" type="text" name="rank_image_path" size="40" maxlength="255" value="' . $rank_img_path . '" />';
$ranks_list .= '<br />';

}
else
{
$rank_img_path = ( $rank_info['rank_image'] != '' ) ? $rank_info['rank_image'] : '';
$ranks_list = '<input class="post" type="text" name="rank_image_path" size="40" maxlength="255" value="' . $rank_img_path . '" /><br />';
}
// Mighty Gorgon - Multiple Ranks - END


FIND #525
"SPECIAL_RANK" => $rank_is_special,
"NOT_SPECIAL_RANK" => $rank_is_not_special,
"MINIMUM" => ( $rank_is_special ) ? "" : $rank_info['rank_min'],


REPLACE #531
// Mighty Gorgon - Multiple Ranks - BEGIN
"NO_RANK" => $rank_no_rank,
"DAYS_RANK" => $rank_day_counter,
"NOT_SPECIAL_RANK" => $rank_is_not_special,
"MINIMUM" => ( ($rank_info['rank_special'] == '0') || ($rank_info['rank_special'] == '-1') ) ? $rank_info['rank_min'] : "",
"SPECIAL_RANK" => $rank_is_special,
"GUEST_RANK" => $rank_is_guest,
"BANNED_RANK" => $rank_is_banned,
"RANK_LIST" => $ranks_list,
"RANK_IMG" => ( $rank_info['rank_image'] != "") ? '../' . $rank_info['rank_image'] : $images['spacer'],

"L_NO_RANK" => $lang['No_Rank'],
"L_DAYS_RANK" => $lang['Rank_Days_Count'],
"L_POSTS_RANK" => $lang['Rank_Posts_Count'],
"L_MIN_M_D" => $lang['Rank_Min_Des'],
"L_SPECIAL_RANK" => $lang['Rank_Special'],
"L_GUEST" => $lang['Guest_User'],
"L_BANNED" => $lang['Banned_User'],
"L_CURRENT_RANK" => $lang['Current_Rank_Image'],
// Mighty Gorgon - Multiple Ranks - END


FIND #554
$special_rank = ( $HTTP_POST_VARS['special_rank'] == 1 ) ? TRUE : 0;
$min_posts = ( isset($HTTP_POST_VARS['min_posts']) ) ? intval($HTTP_POST_VARS['min_posts']) : -1;
$rank_image = ( (isset($HTTP_POST_VARS['rank_image'])) ) ? trim($HTTP_POST_VARS['rank_image']) : "";


REPLACE #560
// Mighty Gorgon - Multiple Ranks - BEGIN
$special_rank = $HTTP_POST_VARS['special_rank'];
$min_posts = ( isset($HTTP_POST_VARS['min_posts']) ) ? intval($HTTP_POST_VARS['min_posts']) : -1;
$rank_image = ( (isset($HTTP_POST_VARS['rank_image_path'])) ) ? trim($HTTP_POST_VARS['rank_image_path']) : "";
// Mighty Gorgon - Multiple Ranks - END


FIND #568
if( $special_rank == 1 )


REPLACE #572
// Mighty Gorgon - Multiple Ranks - BEGIN
if( $special_rank > 0 )
// Mighty Gorgon - Multiple Ranks - END


FIND #578
if (!$special_rank)


REPLACE #582
// Mighty Gorgon - Multiple Ranks - BEGIN
if ($special_rank == 1)
// Mighty Gorgon - Multiple Ranks - END

Atari@Hankoupocho
Registered User
Posts: 5
Joined: Sat Nov 03, 2007 10:43 am

Re: [2.0.14] Add Multiple Ranks And Staff View

Post by Atari@Hankoupocho » Wed Nov 07, 2007 10:56 pm

*note: not a bump I posted a few seconds ago *posting this for the sake of easy reading*

This is what Lumpy says about my situation...

Re: Error with Multiple Ranks mod
by Lumpy Burgertushie on Yesterday 4:33 pm

"I guess you will have to take this up with the MOD author. I just downloaded that MOD, I tried to do all the finds in a standard admin_ranks.php file and it will not work at all.

It does fine up to that line, but it is almost at the end of the file and there are many other finds in the MOD file to go.

I think the author needs to fix his MOD file.

luck,
robert
Lumpy Burgertushie
Registered User

Posts: 767
Joined: Tue Feb 28, 2006 9:26 am
Private messageE-mail

User avatar
Mighty Gorgon
Registered User
Posts: 616
Joined: Thu May 23, 2002 2:56 pm
Location: Italy
Name: Luca Libralato
Contact:

Re: [2.0.14] Add Multiple Ranks And Staff View

Post by Mighty Gorgon » Mon Nov 19, 2007 10:36 pm

I've installed it with EasyMOD several times without any issue on subSilver.

Anyway, it seems that the error is on editing admin_ranks.php, so I invite you to modify it by hand, or make sure you have that file from a clean phpBB 2.0.22 installation.

Grey Mouser
Registered User
Posts: 1
Joined: Mon Jan 21, 2008 8:24 am

Re: [2.0.14] Add Multiple Ranks And Staff View

Post by Grey Mouser » Mon Jan 21, 2008 8:28 am

I successfully added this mod tonight, and it's exactly what I wanted, but I have a couple of questions related to the behavior or the mod:

1) When I add a Rank Image, phpBB isn't displaying the image, but rather is re-displaying the rank title. So, in other words, instead of the graphic, I get a double rank-title.

2) After installing, the default rank is by number of days on the board. Is there any way to change this to number of posts (our ranking requirements.)

3) Is there any way to add a user-generated custom rank with this mod (So when a user exceeds a certain number of posts, they can set their own rank title?) Or do I need to find another one (that hopefully won't break this one!)

Thx,
-M

James N
Registered User
Posts: 1737
Joined: Sat May 20, 2006 12:57 pm
Contact:

Re: [2.0.14] Add Multiple Ranks And Staff View

Post by James N » Mon Jan 21, 2008 10:03 am

Grey Mouser wrote:I successfully added this mod tonight, and it's exactly what I wanted, but I have a couple of questions related to the behavior or the mod:

1) When I add a Rank Image, phpBB isn't displaying the image, but rather is re-displaying the rank title. So, in other words, instead of the graphic, I get a double rank-title.

2) After installing, the default rank is by number of days on the board. Is there any way to change this to number of posts (our ranking requirements.)

3) Is there any way to add a user-generated custom rank with this mod (So when a user exceeds a certain number of posts, they can set their own rank title?) Or do I need to find another one (that hopefully won't break this one!)

Thx,
-M
I see this is your first post here. Are you aware that the MODs author no longer supports it? Also if no one takes it over it will be deleted from the database here

User avatar
Mighty Gorgon
Registered User
Posts: 616
Joined: Thu May 23, 2002 2:56 pm
Location: Italy
Name: Luca Libralato
Contact:

Re: [2.0.14] Add Multiple Ranks And Staff View

Post by Mighty Gorgon » Thu Jan 31, 2008 8:02 pm

Grey Mouser wrote:I successfully added this mod tonight, and it's exactly what I wanted, but I have a couple of questions related to the behavior or the mod:

1) When I add a Rank Image, phpBB isn't displaying the image, but rather is re-displaying the rank title. So, in other words, instead of the graphic, I get a double rank-title.

2) After installing, the default rank is by number of days on the board. Is there any way to change this to number of posts (our ranking requirements.)

3) Is there any way to add a user-generated custom rank with this mod (So when a user exceeds a certain number of posts, they can set their own rank title?) Or do I need to find another one (that hopefully won't break this one!)

Thx,
-M
  1. Maybe the path is wrong, please try to check it.
  2. Default should be number of posts... are you sure that your default is number of days? Can you try to check again please?
  3. This mod doesn't allow users to insert their own rank title... but you may try to combine this mod with ahother one which allows it, and then we may try to help you in the integration process.
James N wrote:Are you aware that the MODs author no longer supports it? Also if no one takes it over it will be deleted from the database here
If someone is interested in taking this mod I can pass the latest code which I haven't released because of lack of time for testing it and write full instructions.

User avatar
Zaid
Registered User
Posts: 590
Joined: Thu Nov 08, 2007 2:06 pm
Location: South Pacific Ocean

Re: [2.0.14] Add Multiple Ranks And Staff View

Post by Zaid » Mon Apr 21, 2008 11:15 pm

Hope This thread is still active as I am going to install the mod.

Would be lovely if you could update the Mod with your last version..Dont want take it over thou..but it might be better then the ones we have now?..

Thanks ..

User avatar
Zaid
Registered User
Posts: 590
Joined: Thu Nov 08, 2007 2:06 pm
Location: South Pacific Ocean

Re: [2.0.14] Add Multiple Ranks And Staff View

Post by Zaid » Tue Apr 22, 2008 11:33 am

First of all its a lovely mod. But So i am getting some errors now..

problem is when ever i click the Staff or Memberlist I get this error message

Parse error: syntax error, unexpected '.' in /home/tmgngr/public_html/forums/memberlist.php on line 369


tried a lots of things but cant figure it out.. If you could please have a look at it and help me out... Thanks a lot for the great mod.

Here is the edited memberlist.php

Code: Select all

Parse error: syntax error, unexpected '.' in /home/tmgngr/public_html/forums/memberlist.php on line 369
    <?php
    /***************************************************************************
    *                              memberlist.php
    *                            -------------------
    *   begin                : Friday, May 11, 2001
    *   copyright            : (C) 2001 The phpBB Group
    *   email                : support@phpbb.com
    *
    *   $Id: memberlist.php,v 1.36.2.13 2006/12/16 13:11:24 acydburn Exp $
    *
    ***************************************************************************/

    /***************************************************************************
    *
    *   This program is free software; you can redistribute it and/or modify
    *   it under the terms of the GNU General Public License as published by
    *   the Free Software Foundation; either version 2 of the License, or
    *   (at your option) any later version.
    *
    ***************************************************************************/

    define('IN_PHPBB', true);
    $phpbb_root_path = './';
    include($phpbb_root_path . 'extension.inc');
    include($phpbb_root_path . 'common.'.$phpEx);

    //
    // Start session management
    //
    $userdata = session_pagestart($user_ip, PAGE_VIEWMEMBERS);
    init_userprefs($userdata);
    if ($userdata['user_id'] == ANONYMOUS)
    {
       redirect(append_sid("login.$phpEx?redirect=memberlist.$phpEx", true));
    }

    //
    // End session management
    //

    $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
    $start = ($start < 0) ? 0 : $start;

    if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
    {
       $mode = ( isset($HTTP_POST_VARS['mode']) ) ? htmlspecialchars($HTTP_POST_VARS['mode']) : htmlspecialchars($HTTP_GET_VARS['mode']);
    }
    else
    {
       $mode = 'joined';
    }

    if(isset($HTTP_POST_VARS['order']))
    {
       $sort_order = ($HTTP_POST_VARS['order'] == 'ASC') ? 'ASC' : 'DESC';
    }
    else if(isset($HTTP_GET_VARS['order']))
    {
       $sort_order = ($HTTP_GET_VARS['order'] == 'ASC') ? 'ASC' : 'DESC';
    }
    else
    {
       $sort_order = 'ASC';
    }

    //
    // Memberlist sorting
    //
    $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'], $lang['Staff'], $lang['Who_is_Online']);
    $mode_types = array('joined', 'username', 'location', 'posts', 'email', 'website', 'topten', 'staff', 'online');

    // Mighty Gorgon - Multiple Ranks - BEGIN
    $lastfivemin = time() - 300;
    // Mighty Gorgon - Multiple Ranks - END

    $select_sort_mode = '<select name="mode">';


    for($i = 0; $i < count($mode_types_text); $i++)
    {
       $selected = ( $mode == $mode_types[$i] ) ? ' selected="selected"' : '';
       $select_sort_mode .= '<option value="' . $mode_types[$i] . '"' . $selected . '>' . $mode_types_text[$i] . '</option>';
    }
    $select_sort_mode .= '</select>';

    $select_sort_order = '<select name="order">';
    if($sort_order == 'ASC')
    {
       $select_sort_order .= '<option value="ASC" selected="selected">' . $lang['Sort_Ascending'] . '</option><option value="DESC">' . $lang['Sort_Descending'] . '</option>';
    }
    else
    {
       $select_sort_order .= '<option value="ASC">' . $lang['Sort_Ascending'] . '</option><option value="DESC" selected="selected">' . $lang['Sort_Descending'] . '</option>';
    }
    $select_sort_order .= '</select>';

    //
    // Generate page
    //
    $page_title = $lang['Memberlist'];
    include($phpbb_root_path . 'includes/page_header.'.$phpEx);

    $template->set_filenames(array(
       'body' => 'memberlist_body.tpl')
    );
    make_jumpbox('viewforum.'.$phpEx);

    $template->assign_vars(array(
    // Start Online/Offline Status Images MOD
       'L_ONLINE_OFFLINE' => $lang['Online_Offline'],
    // End Online/Offline Status Images MOD

       'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'],
       'L_EMAIL' => $lang['Email'],
       'L_WEBSITE' => $lang['Website'],
       'L_FROM' => $lang['Location'],
       'L_ORDER' => $lang['Order'],
       'L_SORT' => $lang['Sort'],
       'L_SUBMIT' => $lang['Sort'],
       'L_AIM' => $lang['AIM'],
       'L_YIM' => $lang['YIM'],
       'L_MSNM' => $lang['MSNM'],
       'L_ICQ' => $lang['ICQ'], // Mighty Gorgon - Multiple Ranks - BEGIN
       'L_USER_RANK' => $lang['Poster_rank'],
       // Mighty Gorgon - Multiple Ranks - END
       'L_JOINED' => $lang['Joined'],
       'L_POSTS' => $lang['Posts'],
       'L_PM' => $lang['Private_Message'],

       'S_MODE_SELECT' => $select_sort_mode,
       'S_ORDER_SELECT' => $select_sort_order,
       'S_MODE_ACTION' => append_sid("memberlist.$phpEx"))
    );

    // Mighty Gorgon - Multiple Ranks - BEGIN
    require_once($phpbb_root_path . 'includes/functions_mg_ranks.'.$phpEx);
    $ranks_sql = query_ranks();
    // Mighty Gorgon - Multiple Ranks - END
    switch( $mode )
    {
       case 'joined':
          $order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page'];
          break;
       case 'username':
          $order_by = "username $sort_order LIMIT $start, " . $board_config['topics_per_page'];
          break;
       case 'location':
          $order_by = "user_from $sort_order LIMIT $start, " . $board_config['topics_per_page'];
          break;
       case 'posts':
          $order_by = "user_posts $sort_order LIMIT $start, " . $board_config['topics_per_page'];
          break;
       case 'email':
          $order_by = "user_email $sort_order LIMIT $start, " . $board_config['topics_per_page'];
          break;
       case 'website':
          $order_by = "user_website $sort_order LIMIT $start, " . $board_config['topics_per_page'];
          break;
       case 'topten':
          $order_by = "user_posts $sort_order LIMIT 10";
          break;
       // Mighty Gorgon - Multiple Ranks - BEGIN
       case 'staff':
          $where_sql = "AND user_level > 0";
          $order_by = "user_level ASC LIMIT $start, " . $board_config['topics_per_page'];
          break;
       case 'online':
          if ( $userdata['user_level'] == ADMIN )
          {
             $where_sql = "AND user_session_time >= $lastfivemin";
          }
          else
          {
             $where_sql = "AND user_session_time >= $lastfivemin AND user_allow_viewonline <> 0";
          }
          $order_by = "user_session_time DESC LIMIT $start, " . $board_config['topics_per_page'];
          break;
       // Mighty Gorgon - Multiple Ranks - END
    default:
          $order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page'];
          break;
    }

    $sql = "SELECT u.username, u.user_id, u.user_viewemail, u.user_posts, u.user_regdate, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_msnm, u.user_avatar, user_avatar_type, u.user_allowavatar, user_rank , user_rank2, user_rank3, user_rank4, user_rank5, user_level, user_session_time, user_allow_viewonline, b.ban_userid
       FROM " . USERS_TABLE . " u LEFT JOIN " . BANLIST_TABLE . " b ON u.user_id = b.ban_userid
       WHERE u.user_id <> " . ANONYMOUS . " AND ISNULL( b.ban_userid )
       $where_sqlORDER BY $order_by";
    if( !($result = $db->sql_query($sql)) )
    {
       message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
    }

    if ( $row = $db->sql_fetchrow($result) )
    {
       $i = 0;
       do
       {
          $username = $row['username'];
          $user_id = $row['user_id'];

          $from = ( !empty($row['user_from']) ) ? $row['user_from'] : '&nbsp;';
          $joined = create_date($lang['DATE_FORMAT'], $row['user_regdate'], $board_config['board_timezone']);
          $posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0;

          // Mighty Gorgon - Multiple Ranks - BEGIN
          $user_ranks = generate_ranks($row, $ranks_sql);

          $user_rank_01 = ($user_ranks['rank_01'] == '') ? '' : ($user_ranks['rank_01'] . '<br />');
          $user_rank_01_img = ($user_ranks['rank_01_img'] == '') ? '' : ($user_ranks['rank_01_img'] . '<br />');
          $user_rank_02 = ($user_ranks['rank_02'] == '') ? '' : ($user_ranks['rank_02'] . '<br />');
          $user_rank_02_img = ($user_ranks['rank_02_img'] == '') ? '' : ($user_ranks['rank_02_img'] . '<br />');
          $user_rank_03 = ($user_ranks['rank_03'] == '') ? '' : ($user_ranks['rank_03'] . '<br />');
          $user_rank_03_img = ($user_ranks['rank_03_img'] == '') ? '' : ($user_ranks['rank_03_img'] . '<br />');
          $user_rank_04 = ($user_ranks['rank_04'] == '') ? '' : ($user_ranks['rank_04'] . '<br />');
          $user_rank_04_img = ($user_ranks['rank_04_img'] == '') ? '' : ($user_ranks['rank_04_img'] . '<br />');
          $user_rank_05 = ($user_ranks['rank_05'] == '') ? '' : ($user_ranks['rank_05'] . '<br />');
          $user_rank_05_img = ($user_ranks['rank_05_img'] == '') ? '' : ($user_ranks['rank_05_img'] . '<br />');

          if ( $row['user_level'] == ADMIN )
          {
             // You may prefer to show the level instead of coloring the username
             // $level = '<b style="color:#' . $theme['fontcolor3'] . '">' . $lang['Memberlist_Administrator'] . '</b>';
             $username = '<b style="color:#' . $theme['fontcolor3'] . '">' . $username . '</b>';
          }
          elseif( $row['user_level'] == MOD )
          {
             // You may prefer to show the level instead of coloring the username
             // $level = '<b style="color:#' . $theme['fontcolor2'] . '">' . $lang['Memberlist_Moderator'] . '</b>';
             $username = '<b style="color:#' . $theme['fontcolor2'] . '">' . $username . '</b>';
          }
          else
          {
             // You may prefer to show the level instead of coloring the username
             // $level = '<b style="color:#' . $theme['fontcolor1'] . '">' . $lang['Memberlist_User'] . '</b>';
          }
          // Mighty Gorgon - Multiple Ranks - END


          $poster_avatar = '';
          if ( $row['user_avatar_type'] && $user_id != ANONYMOUS && $row['user_allowavatar']&& $mode == 'staff' )
          {
             switch( $row['user_avatar_type'] )
             {
                case USER_AVATAR_UPLOAD:
                   $poster_avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : '';
                   break;
                case USER_AVATAR_REMOTE:
                   $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : '';
                   break;
                case USER_AVATAR_GALLERY:
                   $poster_avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : '';
                   break;
             }
          }

          if ( !empty($row['user_viewemail']) || $userdata['user_level'] == ADMIN )
          {
             $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL .'=' . $user_id) : 'mailto:' . $row['user_email'];

             $email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>';
             $email = '<a href="' . $email_uri . '">' . $lang['Send_email'] . '</a>';
          }
          else
          {
             $email_img = '&nbsp;';
             $email = '&nbsp;';
          }

          $temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id");
          $profile_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_profile'] . '" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" border="0" /></a>';
          $profile = '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>';

          $temp_url = append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=$user_id");
          $pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>';
          $pm = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>';

          $www_img = ( $row['user_website'] ) ? '<a href="' . $row['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" border="0" /></a>' : '';
          $www = ( $row['user_website'] ) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $lang['Visit_website'] . '</a>' : ''; 

          if ( !empty($row['user_icq']) )
          {
             $icq_status_img = '<a href="http://wwp.icq.com/' . $row['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" border="0" /></a>';
             $icq_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $row['user_icq'] . '"><img src="' . $images['icon_icq'] . '" alt="' . $lang['ICQ'] . '" title="' . $lang['ICQ'] . '" border="0" /></a>';
             $icq =  '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $row['user_icq'] . '">' . $lang['ICQ'] . '</a>';
          }
          else
          {
             $icq_status_img = '';
             $icq_img = '';
             $icq = '';
          }

          $aim_img = ( $row['user_aim'] ) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?"><img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" /></a>' : '';
          $aim = ( $row['user_aim'] ) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?">' . $lang['AIM'] . '</a>' : '';

          $temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id");
          $msn_img = ( $row['user_msnm'] ) ? '<a href="' . $temp_url . '"><img src="' . $images['icon_msnm'] . '" alt="' . $lang['MSNM'] . '" title="' . $lang['MSNM'] . '" border="0" /></a>' : '';
          $msn = ( $row['user_msnm'] ) ? '<a href="' . $temp_url . '">' . $lang['MSNM'] . '</a>' : '';

          $yim_img = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg"><img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" /></a>' : '';
          $yim = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg">' . $lang['YIM'] . '</a>' : '';

          $temp_url = append_sid("search.$phpEx?search_author=" . urlencode($username) . "&showresults=posts");
          $search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . sprintf($lang['Search_user_posts'], $username) . '" title="' . sprintf($lang['Search_user_posts'], $username) . '" border="0" /></a>';
          $search = '<a href="' . $temp_url . '">' . sprintf($lang['Search_user_posts'], $username) . '</a>';

          $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
          $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

          $template->assign_block_vars('memberrow', array(
    // Start Online/Offline Status Images MOD
             'STATUS_IMG' => display_online_offline($user_id, $online_array),
    // End Online/Offline Status Images MOD
             'ROW_NUMBER' => $i + ( $start + 1 ),
             'ROW_COLOR' => '#' . $row_color,
             'ROW_CLASS' => $row_class,
             'USERNAME' => $username,
             'FROM' => $from,
             'JOINED' => $joined,
             'POSTS' => $posts,
             'AVATAR_IMG' => $poster_avatar,
             'PROFILE_IMG' => $profile_img,
             'PROFILE' => $profile,
             'SEARCH_IMG' => $search_img,
             'SEARCH' => $search,
             'PM_IMG' => $pm_img,
             'PM' => $pm,
             'EMAIL_IMG' => $email_img,
             'EMAIL' => $email,
             'WWW_IMG' => $www_img,
             'WWW' => $www,
             'ICQ_STATUS_IMG' => $icq_status_img,
             'ICQ_IMG' => $icq_img,
             'ICQ' => $icq,
             'AIM_IMG' => $aim_img,
             'AIM' => $aim,
             'MSN_IMG' => $msn_img,
             'MSN' => $msn,
             'YIM_IMG' => $yim_img,
             'YIM' => $yim,
    // Mighty Gorgon - Multiple Ranks - BEGIN
             'USER_LEVEL' => $level,
             'USER_RANK_01' => $user_rank_01,
             'USER_RANK_01_IMG' => $user_rank_01_img,
             'USER_RANK_02' => $user_rank_02,
             'USER_RANK_02_IMG' => $user_rank_02_img,
             'USER_RANK_03' => $user_rank_03,
             'USER_RANK_03_IMG' => $user_rank_03_img,
             'USER_RANK_04' => $user_rank_04,
             'USER_RANK_04_IMG' => $user_rank_04_img,
             'USER_RANK_05' => $user_rank_05,
             'USER_RANK_05_IMG' => $user_rank_05_img,
             // Mighty Gorgon - Multiple Ranks - END

             
             'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id"))
          );

          $i++;
       }
       while ( $row = $db->sql_fetchrow($result) );
       $db->sql_freeresult($result);
    }

    if ( $mode != 'topten' || $board_config['topics_per_page'] < 10 )
    {
       $sql = "SELECT count(*) AS total
          FROM " . USERS_TABLE . " u LEFT JOIN " . BANLIST_TABLE . " b ON u.user_id = b.ban_userid
          WHERE u.user_id <> " . . ANONYMOUS . "$where_sql"; AND ISNULL( b.ban_userid )";

       if ( !($result = $db->sql_query($sql)) )
       {
          message_die(GENERAL_ERROR, 'Error getting total users', '', __LINE__, __FILE__, $sql);
       }

       if ( $total = $db->sql_fetchrow($result) )
       {
          $total_members = $total['total'];

          $pagination = generate_pagination("memberlist.$phpEx?mode=$mode&order=$sort_order", $total_members, $board_config['topics_per_page'], $start). '&nbsp;';
       }
       $db->sql_freeresult($result);
    }
    else
    {
       $pagination = '&nbsp;';
       $total_members = 10;
    }

    $template->assign_vars(array(
       'PAGINATION' => $pagination,
       'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_members / $board_config['topics_per_page'] )),

       'L_GOTO_PAGE' => $lang['Goto_page'])
    );

    $template->pparse('body');

    include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

    ?>
here is the one before i made the edit

Code: Select all

    <?php
    /***************************************************************************
    *                              memberlist.php
    *                            -------------------
    *   begin                : Friday, May 11, 2001
    *   copyright            : (C) 2001 The phpBB Group
    *   email                : support@phpbb.com
    *
    *   $Id: memberlist.php,v 1.36.2.13 2006/12/16 13:11:24 acydburn Exp $
    *
    ***************************************************************************/

    /***************************************************************************
    *
    *   This program is free software; you can redistribute it and/or modify
    *   it under the terms of the GNU General Public License as published by
    *   the Free Software Foundation; either version 2 of the License, or
    *   (at your option) any later version.
    *
    ***************************************************************************/

    define('IN_PHPBB', true);
    $phpbb_root_path = './';
    include($phpbb_root_path . 'extension.inc');
    include($phpbb_root_path . 'common.'.$phpEx);

    //
    // Start session management
    //
    $userdata = session_pagestart($user_ip, PAGE_VIEWMEMBERS);
    init_userprefs($userdata);
    if ($userdata['user_id'] == ANONYMOUS)
    {
       redirect(append_sid("login.$phpEx?redirect=memberlist.$phpEx", true));
    }

    //
    // End session management
    //

    $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
    $start = ($start < 0) ? 0 : $start;

    if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
    {
       $mode = ( isset($HTTP_POST_VARS['mode']) ) ? htmlspecialchars($HTTP_POST_VARS['mode']) : htmlspecialchars($HTTP_GET_VARS['mode']);
    }
    else
    {
       $mode = 'joined';
    }

    if(isset($HTTP_POST_VARS['order']))
    {
       $sort_order = ($HTTP_POST_VARS['order'] == 'ASC') ? 'ASC' : 'DESC';
    }
    else if(isset($HTTP_GET_VARS['order']))
    {
       $sort_order = ($HTTP_GET_VARS['order'] == 'ASC') ? 'ASC' : 'DESC';
    }
    else
    {
       $sort_order = 'ASC';
    }

    //
    // Memberlist sorting
    //
    $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('joined', 'username', 'location', 'posts', 'email', 'website', 'topten');

    $select_sort_mode = '<select name="mode">';
    for($i = 0; $i < count($mode_types_text); $i++)
    {
       $selected = ( $mode == $mode_types[$i] ) ? ' selected="selected"' : '';
       $select_sort_mode .= '<option value="' . $mode_types[$i] . '"' . $selected . '>' . $mode_types_text[$i] . '</option>';
    }
    $select_sort_mode .= '</select>';

    $select_sort_order = '<select name="order">';
    if($sort_order == 'ASC')
    {
       $select_sort_order .= '<option value="ASC" selected="selected">' . $lang['Sort_Ascending'] . '</option><option value="DESC">' . $lang['Sort_Descending'] . '</option>';
    }
    else
    {
       $select_sort_order .= '<option value="ASC">' . $lang['Sort_Ascending'] . '</option><option value="DESC" selected="selected">' . $lang['Sort_Descending'] . '</option>';
    }
    $select_sort_order .= '</select>';

    //
    // Generate page
    //
    $page_title = $lang['Memberlist'];
    include($phpbb_root_path . 'includes/page_header.'.$phpEx);

    $template->set_filenames(array(
       'body' => 'memberlist_body.tpl')
    );
    make_jumpbox('viewforum.'.$phpEx);

    $template->assign_vars(array(
    // Start Online/Offline Status Images MOD
       'L_ONLINE_OFFLINE' => $lang['Online_Offline'],
    // End Online/Offline Status Images MOD

       'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'],
       'L_EMAIL' => $lang['Email'],
       'L_WEBSITE' => $lang['Website'],
       'L_FROM' => $lang['Location'],
       'L_ORDER' => $lang['Order'],
       'L_SORT' => $lang['Sort'],
       'L_SUBMIT' => $lang['Sort'],
       'L_AIM' => $lang['AIM'],
       'L_YIM' => $lang['YIM'],
       'L_MSNM' => $lang['MSNM'],
       'L_ICQ' => $lang['ICQ'],
       'L_JOINED' => $lang['Joined'],
       'L_POSTS' => $lang['Posts'],
       'L_PM' => $lang['Private_Message'],

       'S_MODE_SELECT' => $select_sort_mode,
       'S_ORDER_SELECT' => $select_sort_order,
       'S_MODE_ACTION' => append_sid("memberlist.$phpEx"))
    );

    switch( $mode )
    {
       case 'joined':
          $order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page'];
          break;
       case 'username':
          $order_by = "username $sort_order LIMIT $start, " . $board_config['topics_per_page'];
          break;
       case 'location':
          $order_by = "user_from $sort_order LIMIT $start, " . $board_config['topics_per_page'];
          break;
       case 'posts':
          $order_by = "user_posts $sort_order LIMIT $start, " . $board_config['topics_per_page'];
          break;
       case 'email':
          $order_by = "user_email $sort_order LIMIT $start, " . $board_config['topics_per_page'];
          break;
       case 'website':
          $order_by = "user_website $sort_order LIMIT $start, " . $board_config['topics_per_page'];
          break;
       case 'topten':
          $order_by = "user_posts $sort_order LIMIT 10";
          break;
       default:
          $order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page'];
          break;
    }

    $sql = "SELECT u.username, u.user_id, u.user_viewemail, u.user_posts, u.user_regdate, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_msnm, u.user_avatar, user_avatar_type, u.user_allowavatar, b.ban_userid
       FROM " . USERS_TABLE . " u LEFT JOIN " . BANLIST_TABLE . " b ON u.user_id = b.ban_userid
       WHERE u.user_id <> " . ANONYMOUS . " AND ISNULL( b.ban_userid )
       ORDER BY $order_by";
    if( !($result = $db->sql_query($sql)) )
    {
       message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
    }

    if ( $row = $db->sql_fetchrow($result) )
    {
       $i = 0;
       do
       {
          $username = $row['username'];
          $user_id = $row['user_id'];

          $from = ( !empty($row['user_from']) ) ? $row['user_from'] : '&nbsp;';
          $joined = create_date($lang['DATE_FORMAT'], $row['user_regdate'], $board_config['board_timezone']);
          $posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0;

          $poster_avatar = '';
          if ( $row['user_avatar_type'] && $user_id != ANONYMOUS && $row['user_allowavatar'] )
          {
             switch( $row['user_avatar_type'] )
             {
                case USER_AVATAR_UPLOAD:
                   $poster_avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : '';
                   break;
                case USER_AVATAR_REMOTE:
                   $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : '';
                   break;
                case USER_AVATAR_GALLERY:
                   $poster_avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : '';
                   break;
             }
          }

          if ( !empty($row['user_viewemail']) || $userdata['user_level'] == ADMIN )
          {
             $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL .'=' . $user_id) : 'mailto:' . $row['user_email'];

             $email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>';
             $email = '<a href="' . $email_uri . '">' . $lang['Send_email'] . '</a>';
          }
          else
          {
             $email_img = '&nbsp;';
             $email = '&nbsp;';
          }

          $temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id");
          $profile_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_profile'] . '" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" border="0" /></a>';
          $profile = '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>';

          $temp_url = append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=$user_id");
          $pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>';
          $pm = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>';

          $www_img = ( $row['user_website'] ) ? '<a href="' . $row['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" border="0" /></a>' : '';
          $www = ( $row['user_website'] ) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $lang['Visit_website'] . '</a>' : ''; 

          if ( !empty($row['user_icq']) )
          {
             $icq_status_img = '<a href="http://wwp.icq.com/' . $row['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" border="0" /></a>';
             $icq_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $row['user_icq'] . '"><img src="' . $images['icon_icq'] . '" alt="' . $lang['ICQ'] . '" title="' . $lang['ICQ'] . '" border="0" /></a>';
             $icq =  '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $row['user_icq'] . '">' . $lang['ICQ'] . '</a>';
          }
          else
          {
             $icq_status_img = '';
             $icq_img = '';
             $icq = '';
          }

          $aim_img = ( $row['user_aim'] ) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?"><img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" /></a>' : '';
          $aim = ( $row['user_aim'] ) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?">' . $lang['AIM'] . '</a>' : '';

          $temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id");
          $msn_img = ( $row['user_msnm'] ) ? '<a href="' . $temp_url . '"><img src="' . $images['icon_msnm'] . '" alt="' . $lang['MSNM'] . '" title="' . $lang['MSNM'] . '" border="0" /></a>' : '';
          $msn = ( $row['user_msnm'] ) ? '<a href="' . $temp_url . '">' . $lang['MSNM'] . '</a>' : '';

          $yim_img = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg"><img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" /></a>' : '';
          $yim = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg">' . $lang['YIM'] . '</a>' : '';

          $temp_url = append_sid("search.$phpEx?search_author=" . urlencode($username) . "&showresults=posts");
          $search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . sprintf($lang['Search_user_posts'], $username) . '" title="' . sprintf($lang['Search_user_posts'], $username) . '" border="0" /></a>';
          $search = '<a href="' . $temp_url . '">' . sprintf($lang['Search_user_posts'], $username) . '</a>';

          $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
          $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

          $template->assign_block_vars('memberrow', array(
    // Start Online/Offline Status Images MOD
             'STATUS_IMG' => display_online_offline($user_id, $online_array),
    // End Online/Offline Status Images MOD
             'ROW_NUMBER' => $i + ( $start + 1 ),
             'ROW_COLOR' => '#' . $row_color,
             'ROW_CLASS' => $row_class,
             'USERNAME' => $username,
             'FROM' => $from,
             'JOINED' => $joined,
             'POSTS' => $posts,
             'AVATAR_IMG' => $poster_avatar,
             'PROFILE_IMG' => $profile_img,
             'PROFILE' => $profile,
             'SEARCH_IMG' => $search_img,
             'SEARCH' => $search,
             'PM_IMG' => $pm_img,
             'PM' => $pm,
             'EMAIL_IMG' => $email_img,
             'EMAIL' => $email,
             'WWW_IMG' => $www_img,
             'WWW' => $www,
             'ICQ_STATUS_IMG' => $icq_status_img,
             'ICQ_IMG' => $icq_img,
             'ICQ' => $icq,
             'AIM_IMG' => $aim_img,
             'AIM' => $aim,
             'MSN_IMG' => $msn_img,
             'MSN' => $msn,
             'YIM_IMG' => $yim_img,
             'YIM' => $yim,
             
             'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id"))
          );

          $i++;
       }
       while ( $row = $db->sql_fetchrow($result) );
       $db->sql_freeresult($result);
    }

    if ( $mode != 'topten' || $board_config['topics_per_page'] < 10 )
    {
       $sql = "SELECT count(*) AS total
          FROM " . USERS_TABLE . " u LEFT JOIN " . BANLIST_TABLE . " b ON u.user_id = b.ban_userid
          WHERE u.user_id <> " . ANONYMOUS . " AND ISNULL( b.ban_userid )";

       if ( !($result = $db->sql_query($sql)) )
       {
          message_die(GENERAL_ERROR, 'Error getting total users', '', __LINE__, __FILE__, $sql);
       }

       if ( $total = $db->sql_fetchrow($result) )
       {
          $total_members = $total['total'];

          $pagination = generate_pagination("memberlist.$phpEx?mode=$mode&order=$sort_order", $total_members, $board_config['topics_per_page'], $start). '&nbsp;';
       }
       $db->sql_freeresult($result);
    }
    else
    {
       $pagination = '&nbsp;';
       $total_members = 10;
    }

    $template->assign_vars(array(
       'PAGINATION' => $pagination,
       'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_members / $board_config['topics_per_page'] )),

       'L_GOTO_PAGE' => $lang['Goto_page'])
    );

    $template->pparse('body');

    include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

    ?>
But you see some people here told me that the problem is here but my template looks like this
Select all
$sql = "SELECT count(*) AS total
FROM " . USERS_TABLE . " u LEFT JOIN " . BANLIST_TABLE . " b ON u.user_id = b.ban_userid
WHERE u.user_id <> " . ANONYMOUS . " AND ISNULL( b.ban_userid )";
Not exactly as you mod said which would be this
$sql = "SELECT count(*) AS total
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS;
so i just inserted the $where_sql";

so it becomes like . ANONYMOUS . "$where_sql";

so the results are
$sql = "SELECT count(*) AS total
FROM " . USERS_TABLE . " u LEFT JOIN " . BANLIST_TABLE . " b ON u.user_id = b.ban_userid
WHERE u.user_id <> " . . ANONYMOUS . "sql"; AND ISNULL( b.ban_userid )";

User avatar
Zaid
Registered User
Posts: 590
Joined: Thu Nov 08, 2007 2:06 pm
Location: South Pacific Ocean

Re: [2.0.14] Add Multiple Ranks And Staff View

Post by Zaid » Wed Apr 23, 2008 5:36 am

I need some help over here! hello!

James N
Registered User
Posts: 1737
Joined: Sat May 20, 2006 12:57 pm
Contact:

Re: [2.0.14] Add Multiple Ranks And Staff View

Post by James N » Wed Apr 23, 2008 8:14 am

Do you really want to use a MOD that wont be here next week?
A reminder that the final phase of this cleanup will be executed on the 30th of April. All MODs found within the MOD Database Cleanup forum will be deleted from this site. Please update your MODs. Thanks.
http://www.phpbb.com/community/viewtopi ... 0#p3204720

Post Reply

Return to “[2.0.x] MOD Database Cleanup”

Who is online

Users browsing this forum: No registered users and 7 guests