collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 757
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Blocks speak! Do you have an interest in getting more blocks - or even making your own? The Blocks Board is for you!

Author Topic: Staff list order, once again  (Read 7300 times)

0 Members and 1 Guest are viewing this topic.

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Staff list order, once again
« on: November 25, 2014, 06:23:19 AM »
Hi all :) some of you might know me from sm.org, some might not.

So I have read all the documentation, I have read all the similar topics but I can't figure out the query I would need to sort the staff list by member id, I mean, not just order like member 1 will come before member 2, I mean that I would have to manually type EACH member id in the query. That would be the best thing to me as I have too many customizations and I can't possibly use the other queries that had been provided.
Thanks in advance :)

P.s. I beg you, I really do, please make the captcha easier or get rid of it... It's useless anyway, bots can easily read them nowadays :/
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: Staff list order, once again
« Reply #1 on: November 27, 2014, 06:07:21 AM »
Tiny bump please?
« Last Edit: November 27, 2014, 11:33:28 AM by ♦ Ninja ZX-10RR ♦ »
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Staff list order, once again
« Reply #2 on: November 28, 2014, 05:26:30 PM »
This is difficult to get right with something simple, but here's the easiest that I came up with:

PortalBlocks.php

Code: (Find) [Select]
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$colorids[$row['id_member']] = $row['id_member'];

Code: (Replace) [Select]
$orderids = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$colorids[$row['id_member']] = $row['id_member'];
$orderids[$row['id_member']] = 100 + $row['id_member'];

Code: (Find) [Select]
$staff_list[$row['type'] . '-' . $row['id_member']] = array(
Code: (Replace) [Select]
$staff_list[$row['id_member']] = array(
Code: (Find) [Select]
ksort($staff_list);
Code: (Replace) [Select]
array_multisort($orderids, SORT_ASC, $staff_list);
Now with the changes above, all the members will be sorted by their member ids. If you want fine tuning, you can edit the $orderids array. For instance, if I wanted to have the member with the id of 5476 appear the first and member with the id of 128 to appear second, I would do this:

Code: (Find) [Select]
array_multisort($orderids, SORT_ASC, $staff_list);
Code: (Replace) [Select]
$orderids[5476] = 1;
$orderids[128] = 2;
array_multisort($orderids, SORT_ASC, $staff_list);

You can do pretty much whatever you want using array_multisort but it's not easy to get it right at first. You can have a look at the related section at the PHP Manual for that: http://php.net/array_multisort
And slowly, you come to realize... It's all as it should be...

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: Staff list order, once again
« Reply #3 on: November 28, 2014, 05:30:48 PM »
Oh jeez this is seriously a mess. Thanks I will try this when I will have some time and report you back, I hope I will be able to get that right with all those edits >_<
Many thanks again.
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Staff list order, once again
« Reply #4 on: November 28, 2014, 05:35:54 PM »
You're welcome. I think you will manage that. I've actually quite liked how customizable it turned out to be, so I'll probably include the first three changes in the next version of SimplePortal. Then anyone who would like to modify the default sorting can just push their changes to $orderids array as in my example with the last change. Overall, it's difficult to come up with a sorting method that works for everyone. The best we can rely on is the access levels for the groups but even then people still want to customize the order within those groups.
And slowly, you come to realize... It's all as it should be...

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: Staff list order, once again
« Reply #5 on: November 28, 2014, 05:42:52 PM »
Yeah I can *understand* how much complicated it might be trying to please everyone with just a single solution (included in the mod or even with Underdog's permission tweak)... Thank you for trying so hard, I really appreciate that.
As a sidenote I am posting a feature request in the proper board, you might consider it, I think it would be awesome, but it's just my humble opinion, I am not a coder - just a supporter, always was, always will be :)
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Staff list order, once again
« Reply #6 on: November 28, 2014, 05:59:50 PM »
Well, you're welcome, thank you and keep those feature requests coming. ;)
And slowly, you come to realize... It's all as it should be...

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: Staff list order, once again
« Reply #7 on: November 29, 2014, 11:56:16 AM »
I have troubles with the edits, there are many places that look identical in the file... Already the first edit I can't understand where it is that, you are a coder and you know where the stuff is but I have no idea about how the mod was coded >_< and also if I have to edit those things multiple times or not since there are a few identical places, could you point me the lines? I didn't make any custom edits to the file so they should match...
Sorry for not understanding it clearly :/
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Staff list order, once again
« Reply #8 on: November 29, 2014, 12:01:34 PM »
The second and third edits are certainly unique. The first one is unique as well, unless your edit does not multiple searching for multiple lines. If you still have problems, you can attach your file here and I can apply the first three edits for you. Then you can customize it to your liking as I had shown with the fourth edit above.
And slowly, you come to realize... It's all as it should be...

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: Staff list order, once again
« Reply #9 on: November 29, 2014, 12:05:29 PM »
Perhaps yes, I would do a compare and see where I was wrong, if you could do it I would appreciate it a lot, sorry again >_< and yes I am trying to edit it with the notepad++ but it finds a ton of results already for the first edit... I really want to see where it should have been placed though, always happy to learn, especially if I have never seen a mod's code.
Thanks in advance once again so helpful!
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Staff list order, once again
« Reply #10 on: November 29, 2014, 12:10:29 PM »
I have attached the file with the edits. I should note that you seem to have installed something that is supposed to change sorting for that block but I had to remove some lines related to that to make my changes work. Perhaps you should revert all the changes related to modifying the sorting for that block and just use the one I gave above.
And slowly, you come to realize... It's all as it should be...

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: Staff list order, once again
« Reply #11 on: November 29, 2014, 12:17:31 PM »
It's the staff permission for SimplePortal by Underdog --> http://simpleportal.net/index.php?topic=10209.0 so I uninstall it and then use your file? Or should I uninstall and then re-attach the file? I just don't want to have my error log filled with some errors for uninstalling half of that package or something like that.
Installed since I don't want the administrator membergroup to show up in that block.

EDIT: just noticed that there are 7 edits to that file, it might be a problem if I just replace it with yours given that you removed some pieces of it. IMHO I should uninstall and then ask you to make the edits again >_<
« Last Edit: November 29, 2014, 12:20:45 PM by ♦ Ninja ZX-10RR ♦ »
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Staff list order, once again
« Reply #12 on: November 29, 2014, 12:27:07 PM »
Yeah, first uninstall the mod, then attach your file. While I'm at it, I can add a line of code that would exclude Administrator group from staff list (group id 1) if you want.
And slowly, you come to realize... It's all as it should be...

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: Staff list order, once again
« Reply #13 on: November 29, 2014, 12:31:25 PM »
Yes if you can please exclude the administrator group from being automatically shown. Thanks in advance once again, sorry for the misunderstanding.
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Staff list order, once again
« Reply #14 on: November 29, 2014, 12:43:56 PM »
The change for excluding certain groups:

Code: (Find) [Select]
WHERE m.id_member IN ({array_int:staff_list})',
array(

Code: (Replace) [Select]
WHERE m.id_member IN ({array_int:staff_list})
AND m.id_group NOT IN ({array_int:exclude_groups})',
array(
'exclude_groups' => array(1, 2, 3),

You just need to change 1, 2, 3 as the id of member groups you want to exclude separated by commas. This change is already applied to the attached file as well, with only group with the id of 1 excluded.
And slowly, you come to realize... It's all as it should be...

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: Staff list order, once again
« Reply #15 on: November 29, 2014, 12:47:44 PM »
This is *EXACTLY* what I wanted! Awesome I'm going to do it in a few minutes, still need to sort some .css stuff out and then I will be tackling this one :) Thanks again, I will either edit the message or post again to report the result :)
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: Staff list order, once again
« Reply #16 on: November 29, 2014, 01:30:32 PM »
Damn, I must be doing something wrong.

Quote
http://vige.altervista.org/forum/index.php
2: array_multisort() [<a href='function.array-multisort'>function.array-multisort</a>]: Array sizes are inconsistent
File: /Sources/PortalBlocks.php
Line: 2353

So the code I am using is this one:
Code: [Select]
$smcFunc['db_free_result']($request);
$orderids[2] = 1; /*Ninja*/
$orderids[1] = 2; /*Nayabinghi93*/
$orderids[70] = 3; /*BurkeKnight*/
$orderids[6] = 4; /*Virtual Anubis*/
$orderids[37] = 5; /*Wolf*/
array_multisort($orderids, SORT_ASC, $staff_list);
$staff_count = count($staff_list);
$count = 0;
$icons = array(1 => 'admin', 'gmod', 'lmod');

What's am I doing wrong? Thanks in advance, again. >_<
Maybe 1 2 3 4 5 were supposed to be the admin, gmod or lmod icons and the order is granted by the sorting? I tried to read the documentation but I'm in a hurry and it's *very* complicated... :(

Note: I'm off for dinner so I will reply in a bit more than half an hour.
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Staff list order, once again
« Reply #17 on: November 29, 2014, 02:42:04 PM »
The only case in which you would get that error is when you set an orderid for a user that does not get listed in the staff list. In the code you quoted, try making the following change:

Code: (Find) [Select]
array_multisort($orderids, SORT_ASC, $staff_list);
Code: (Replace) [Select]
foreach ($orderids as $key => $dummy)
if (!isset($staff_list[$key]))
unset($orderids[$key]);
array_multisort($orderids, SORT_ASC, $staff_list);

That should prevent the error from happening by unsetting orderid members that are not listed in the staff list. But you should check and see which members do not appear and if they really should not appear, then you should make sure that you don't set an orderid value for them.
And slowly, you come to realize... It's all as it should be...

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: Staff list order, once again
« Reply #18 on: November 29, 2014, 02:49:00 PM »
It did the trick indeed! Nice one :) thanks a lot, it now shows things the way I wanted them! *very happy*
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis