Jump to content


[ Module] MKPStaff 1.0h 21.01.2006


12 replies to this topic

#1 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 04 April 2005 - 01:28 AM

MKPStaff Module v1.0h 21.01.2006
by visiblesoul
http://www.visiblesoul.net

based on MKPortal module code
by Meo aka Luponero
© 2004-2005 mkportal.it
+---------------------------------------------------------------------------

!!! NOTE: PLEASE RESPECT THE WORK OF OTHERS. DO NOT REMOVE AUTHOR CREDITS OR COPYRIGHT.

+---------------------------------------------------------------------------
Module is for MKPortal Multiboard versions M06 and greater x IPB 1.3, IPB2, SMF, vB, phpBB.

This module will allow you to display site staff or any member groups in one central location for easy reference.

Features:

* Staff List
1) [IPB 1.3, IPB2, vB, phpBB] Team icon (if any)
2) Member group title
3) Online Status - Online, Offline, and Online Anonymous (viewable by Admins only)
4) Username (member id #1 in red)
5) Join Date
6) Time Zone
7) Forum Posts
8) Files (in MKP downloads section - link to file search)
9) Last Activity

* Downloads File Search
1) Username (in table title and browser title bar)
2) Files
3) Category
4) Downloads
5) Views
6) Votes
7) Rating
8) Entry Date


* Configuration options
1) Display as many member group as you need
2) Format join date and last activity date
3) Sort members by id, name, join date, posts, last visit, or last activity in ascending or descending order.
4) Set number of search results per page.
5) Allow or prohibit guest access to module

* Language files are included for English, Italian, French, German, Dutch, Arabic , Hebrew, Spanish, and Bulgarian.

* READ ME included in English, French and German.

+---------------------------------------------------------------------------
| CHANGELOG:
+---------------------------------------------------------------------------
v1.0h - fixed "Unknown column 'm.id' in 'order clause'" bug (21.01.2006)
added Turkish translation by cyberjack
+---------------------------------------------------------------------------
v1.0g - added IPB 1.3 support (18.05.2005)
added Bulgarian lang by kukareki
fixed phpBB multiple sessions bug
+---------------------------------------------------------------------------
v1.0f - fixed vB usergroup title bug
added online/offline for vB version
added Hebrew lang by ohad
added German READ ME by PsychoWolf
+---------------------------------------------------------------------------
v1.0e - added guest "not authorized" error message to lang file
fixed "member access only" bug
added online/offline for SMF version
added Dutch lang by champi
added French READ ME by The_fouine
+---------------------------------------------------------------------------
v1.0d - added Spanish lang by cur and Arabic by albisher
added ability to use non-default table prefixes ($prefix)
changed "Last Activity" date not to display if member has never logged in
+---------------------------------------------------------------------------
v1.0c - added French lang the_fouine and Arabic by albisher
v1.0b - added Italian lang by archi
v1.0a - added German lang by PsychoWolf
+---------------------------------------------------------------------------


Download


Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#2 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 10 September 2005 - 12:28 AM

There is a bug in the code for vB, phpBB and SMF. If you get "Cannot execute the query" errors try this...

FIND:
ORDER BY m.$sort $order");

REPLACE WITH:
ORDER BY $sort $order");

Thanks to WildJoker
http://www.mkportal.it/community/forum/ind...indpost&p=53479

and 4rd4r1c0 for the fix.


Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#3 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 10 September 2005 - 12:31 AM

By default the MKPStaff module v1.0g shows only member #1 in red. If you do not want member #1 in red comment out this code...

/*



if ($row['id'] == '1') {

    $namecolor = "<a style=\"color: red;\" href=\"$mkportals->forum_url/index.php?action=profile;u=$mid\"><b>$name</b></a>";

   } else {

    $namecolor = "<a href=\"$mkportals->forum_url/index.php?action=profile;u=$mid\"><b>$name</b></a>";

   }



*/



Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#4 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 10 September 2005 - 12:35 AM

The phpBB version uses Ranks, not groups. The rank ID can be forund by going to

phpBB Admin CP > [User Admin] Ranks

Hover over the "Edit" link for each Rank. You will see a URL like this...

Quote

localhost/forums/admin/admin_ranks.php?mode=edit&id=3&sid=2386aaea76e...
The Rank ID number is in red above. This Rank's ID is "3".



I plan to work on phpBB and SMF groups and ranks for the next version.

I have added a few things for IPB already but I have not released this yet.

1) Group colors
2) "Comments" row in the "files" search results for each staff member.
3) If no members are in a group a "no members in this group" message is displayed.
4) No table shown for a non-existent group id in the config array

A few other things I am thinking about adding...

1) More complete SMF and phpBB groups configuration
2) Sort feature for search results
3) Team icons for SMF


Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#5 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 10 September 2005 - 12:43 AM

SMF users who want to display realName instead of memberName on the staff list can make the following edits

FIND (in function stafftable):
$query1 = $DB->query( "SELECT m.ID_MEMBER AS id, m.memberName AS name, m.ID_GROUP AS mgroup, m.dateRegistered AS joined, m.posts, m.timeOffset AS time_offset, m.lastLogin AS last_activity, m.showOnline AS login_anonymous, g.ID_GROUP, l.ID_MEMBER AS loggedin

           

           FROM {$prefix}members m,

           {$prefix}membergroups g        

           LEFT JOIN {$prefix}log_online l ON (m.ID_MEMBER=l.ID_MEMBER)        

           WHERE g.ID_GROUP='$group'

           AND m.ID_GROUP=g.ID_GROUP        

           ORDER BY m.$sort $order");

REPLACE WITH:
$query1 = $DB->query( "SELECT m.ID_MEMBER AS id, m.memberName AS name, m.realName, m.ID_GROUP AS mgroup, m.dateRegistered AS joined, m.posts, m.timeOffset AS time_offset, m.lastLogin AS last_activity, m.showOnline AS login_anonymous, g.ID_GROUP, l.ID_MEMBER AS loggedin

           

           FROM {$prefix}members m,

           {$prefix}membergroups g        

           LEFT JOIN {$prefix}log_online l ON (m.ID_MEMBER=l.ID_MEMBER)        

           WHERE g.ID_GROUP='$group'

           AND m.ID_GROUP=g.ID_GROUP        

           ORDER BY m.$sort $order");


FIND (in function stafftable):
$name = $row['name'];

ADD BELOW:
$dname = $row['realName']; //SMF realName

FIND:
               if ($row['id'] == '1') {

                   $namecolor = "<a style=\"color: red;\" href=\"$mkportals->forum_url/index.php?action=profile;u=$mid\"><b>$name</b></a>";

               } else {

                   $namecolor = "<a href=\"$mkportals->forum_url/index.php?action=profile;u=$mid\"><b>$name</b></a>";

               }

REPLACE WITH:
               if ($row['id'] == '1') {

                   $namecolor = "<a style=\"color: red;\" href=\"$mkportals->forum_url/index.php?action=profile;u=$mid\"><b>$dname</b></a>";

               } else {

                   $namecolor = "<a href=\"$mkportals->forum_url/index.php?action=profile;u=$mid\"><b>$dname</b></a>";

               }


To make the realName show on the search results will be a little more work. I will add it to the next version.


Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#6 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 10 September 2005 - 01:04 AM

WildJoker said:

Further note. By default phpBB only has one rank and that is Site Admin which is set to 1. So if you have not created more ranks and are getting two extra blank boxes below your Site Admin listing then set your stafftable array like this.
$stafftable = array(1);




Ok I have come up with something that will bring in the forum colors for both Admin and Moderators. There is some limits to this but it is a start. First you must go to your Forum CP and set up a Rank for Moderators. Make note of the number for the rank. I only had Admin set up so the Moderator rank was number 2 which I'll use in this example.

Open /mkportal/modules/staff/index.php
FIND: In function stafftable() around line 97
global $mkportals, $DB, $std, $print, $mklib, $Skin, $mklib_board, $table_prefix;

REPLACE WITH:
global $mkportals, $DB, $std, $print, $mklib, $Skin, $mklib_board, $table_prefix, $theme;


The only thing I have done above is add $theme to global which is set by the forum code.

FIND: In function stafftable() around line 104
$stafftable = array(1);

Add the moderator rank number.
EXAMPLE REPLACE WITH:
$stafftable = array(1,2);


FIND: In function stafftable() around line 171
$query1 = $DB->query( "SELECT m.user_id AS id, m.user_active, m.username AS name, m.user_rank AS mgroup, m.user_regdate AS joined, m.user_posts AS posts, m.user_timezone AS time_offset, m.user_lastvisit AS last_activity, m.user_allow_viewonline AS login_anonymous, m.user_level, r.rank_id, s.session_logged_in AS user_active, s.session_ip

REPLACE WITH:
$query1 = $DB->query( "SELECT m.user_id AS id, m.user_active, m.username AS name, m.user_rank AS mgroup, m.user_regdate AS joined, m.user_posts AS posts, m.user_timezone AS time_offset, m.user_lastvisit AS last_activity, m.user_allow_viewonline AS login_anonymous, m.user_level AS user_level, r.rank_id, s.session_logged_in AS user_active, s.session_ip

What I did here is add AS user_level after m.user_level

FIND: In function stafftable() around line 211
if ($row['id'] == '2') {

    $namecolor = "<a style=\"color: red;\" href=\"$mkportals->forum_url/profile.php?mode=viewprofile&u=$mid\"><b>$name</b></a>";

   } else {

    $namecolor = "<a href=\"$mkportals->forum_url/profile.php?mode=viewprofile&u=$mid\"><b>$name</b></a>";

   }

REPLACE WITH:
$style_color = '';

   if ( $row['user_level'] == ADMIN )

   {

    $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';

   

   }

   else if ( $row['user_level'] == MOD )

   {

    $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';

   

   }

   

    $namecolor = "<a href=\"$mkportals->forum_url/profile.php?mode=viewprofile&u=$mid\" $style_color><b>$name</b></a>";

Ok above you may understand what I have done if you are at all familiar with phpBB2 code. By makeing $theme part of the globals I was able to use the theme colors that phpBB2 uses for admins and moderators. ADMIN and MOD are variables that at defined by phpBB2 and by default they actually refer to the numbers 1 and 2 but if you have mods this may change so the code should still work if you have done that by using them. Please note that the 1 and 2 of ADMIN and MOD has nothing to do with the Rank id that you set. Those could be different numbers.

I did test this and it worked. I am not going to have time to trouble shoot this right away so use at your own risk and make back ups! smile.gif

I will note that if you did not want to use the colors from your forum theme then you could change $style_color = 'style="color:#' . $theme['fontcolor3'] . '"'; to a hard coded color i.e. $style_color = 'style="color:#FF0000"';. That is the hexidecimal code for red... or close to it. That is just basic HTML so I won't go in to detail on that.



Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#7 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 10 September 2005 - 01:14 AM

lolo8 said:

Hello I have a little problem with mkpstaff and groups icons display( MKPortal M1.0 IPB 2.0.4 )

The groups icons url are for exemple
mysite.com/forums/style_images/master/folder_team_icons/Administrateur_t.gif
the right url is
mysite.com/forums/style_images/1/folder_team_icons/Administrateur_t.gif

The IPB g_icon from ibf_groups is style_images/master/folder_team_icons/Administrateur_t.gif

the master IPB macro is not replaced


I solved the problem for me
I have replace
$gicon =  $row['g_icon'];
by
$gicon = str_replace("style_images/<#IMG_DIR#>", "style_images/1", $row['g_icon']);

in the function stafftable()



Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#8 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 10 September 2005 - 01:16 AM

ProjectXIII said:

I'm not sure if this is here in this thread yet, as I don't have the time to read through the whole thing...but I use this with SMF and ran into a problem with my moderators not being listed on the staff list due to the process SMF uses to assign mod status, and the way this mod was written wouldn't pull the correct info from the database.

To make it work like a charm with SMF, first install it by the instructions given in the download, and perform this one extra step:

in index.php FIND:
$query1 = $DB->query( "SELECT m.ID_MEMBER AS id, m.memberName AS name, m.ID_GROUP AS mgroup, m.dateRegistered AS joined, m.posts, m.timeOffset AS time_offset, m.lastLogin AS last_activity, m.showOnline AS login_anonymous, g.ID_GROUP, l.ID_MEMBER AS loggedin

 

  FROM {$prefix}members m,

  {$prefix}membergroups g  

  LEFT JOIN {$prefix}log_online l ON (m.ID_MEMBER=l.ID_MEMBER)  

  WHERE g.ID_GROUP='$group'

  AND m.ID_GROUP=g.ID_GROUP  

  ORDER BY m.$sort $order");  
and REPLACE WITH:
$query1 = $DB->query("

  SELECT DISTINCT

   m.ID_MEMBER AS id, m.realName AS name, m.ID_GROUP AS mgroup, m.dateRegistered AS joined, m.posts,

   m.timeOffset AS time_offset, m.lastLogin AS last_activity, m.showOnline AS login_anonymous, m.ID_GROUP,

   lo.ID_MEMBER AS loggedin

  FROM {$prefix}members AS m" . ($group == 3 ? ", {$prefix}moderators AS mods" : '') . "

   LEFT JOIN {$prefix}log_online AS lo ON (m.ID_MEMBER = lo.ID_MEMBER)

  WHERE " . ($group == 3 ? "m.ID_MEMBER = mods.ID_MEMBER" : "m.ID_GROUP = '$group'") . "

  ORDER BY m.$sort $order");

You're moderators will now be listed correctly.



Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#9 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 21 January 2006 - 02:48 PM

New bug-fix version available here.


Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#10 draghetto

  • Members
  • 6 posts

Posted 15 April 2006 - 09:26 PM

i have an error

ERROR: Database error.
Cannot execute the query: SELECT m.ID_MEMBER AS id, m.memberName AS name, m.ID_GROUP AS mgroup, m.dateRegistered AS joined, m.posts, m.timeOffset AS time_offset, m.lastLogin AS last_activity, m.showOnline AS login_anonymous, g.ID_GROUP, l.ID_MEMBER AS loggedin FROM smf_members m, smf_membergroups g LEFT JOIN smf_log_online l ON (m.ID_MEMBER=l.ID_MEMBER) WHERE g.ID_GROUP='2' AND m.ID_GROUP=g.ID_GROUP ORDER BY id ASC
MySql Error returned: Unknown column 'm.ID_MEMBER' in 'on clause'
MySql Error code: 1054

why?? :) :) :(

#11 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 17 April 2006 - 09:23 AM

draghetto said:

i have an error

ERROR: Database error.
Cannot execute the query: SELECT m.ID_MEMBER AS id, m.memberName AS name, m.ID_GROUP AS mgroup, m.dateRegistered AS joined, m.posts, m.timeOffset AS time_offset, m.lastLogin AS last_activity, m.showOnline AS login_anonymous, g.ID_GROUP, l.ID_MEMBER AS loggedin FROM smf_members m, smf_membergroups g LEFT JOIN smf_log_online l ON (m.ID_MEMBER=l.ID_MEMBER) WHERE g.ID_GROUP='2' AND m.ID_GROUP=g.ID_GROUP ORDER BY id ASC
MySql Error returned: Unknown column 'm.ID_MEMBER' in 'on clause'
MySql Error code: 1054

why?? :( :( :(
What version of MKPortal and what forum version are you running?


Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#12 draghetto

  • Members
  • 6 posts

Posted 17 April 2006 - 10:07 AM

visiblesoul said:

draghetto said:

i have an error

ERROR: Database error.
Cannot execute the query: SELECT m.ID_MEMBER AS id, m.memberName AS name, m.ID_GROUP AS mgroup, m.dateRegistered AS joined, m.posts, m.timeOffset AS time_offset, m.lastLogin AS last_activity, m.showOnline AS login_anonymous, g.ID_GROUP, l.ID_MEMBER AS loggedin FROM smf_members m, smf_membergroups g LEFT JOIN smf_log_online l ON (m.ID_MEMBER=l.ID_MEMBER) WHERE g.ID_GROUP='2' AND m.ID_GROUP=g.ID_GROUP ORDER BY id ASC
MySql Error returned: Unknown column 'm.ID_MEMBER' in 'on clause'
MySql Error code: 1054

why?? :( :( :(
What version of MKPortal and what forum version are you running?
mkportal 1.1 rc1 and smf 1.1 rc2

#13 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 15 May 2006 - 03:39 AM

draghetto said:

i have an error

ERROR: Database error.
Cannot execute the query: SELECT m.ID_MEMBER AS id, m.memberName AS name, m.ID_GROUP AS mgroup, m.dateRegistered AS joined, m.posts, m.timeOffset AS time_offset, m.lastLogin AS last_activity, m.showOnline AS login_anonymous, g.ID_GROUP, l.ID_MEMBER AS loggedin FROM smf_members m, smf_membergroups g LEFT JOIN smf_log_online l ON (m.ID_MEMBER=l.ID_MEMBER) WHERE g.ID_GROUP='2' AND m.ID_GROUP=g.ID_GROUP ORDER BY id ASC
MySql Error returned: Unknown column 'm.ID_MEMBER' in 'on clause'
MySql Error code: 1054

why?? ;) :) :(
Try this...

FIND in /mkportal/modules/staff/index.php:
			FROM {$prefix}members m, 
			{$prefix}membergroups g
REPLACE WITH:
			FROM ({$prefix}members m, 
			{$prefix}membergroups g)
That might fix it if it is a MySQL5 issue.


Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users