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: 639
  • 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]

Welcome to SimplePortal.net! You can download SimplePortal from the Downloads Area!

Author Topic: Staff List Block - Ordering?  (Read 6741 times)

0 Members and 1 Guest are viewing this topic.

Offline artica_james

  • Semi Newbie
  • *
  • Posts: 6
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Staff List Block - Ordering?
« on: October 18, 2010, 08:51:20 AM »
Hey,

I am using SMF 2.0 RC3 with SimplePortal 2.3.2

The website is www.supremealliedcommanders.co.uk

I want to change the order of the staff in the staff list block by their ID number or username.

How can i do this?

I took a look at this http://simpleportal.net/index.php?topic=2110.msg14032;topicseen#msg14032 but this was ordering by registration date/descending. I would like it ordered manually by their member ID number like so (9,1,4) etc

Any help would be much appreciated.

Many Thanks
James :)

Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
Re: Staff List Block - Ordering?
« Reply #1 on: October 18, 2010, 05:23:33 PM »
Those edits are for SMF 1.1, however.

Do you want their ID, or their name?

Offline artica_james

  • Semi Newbie
  • *
  • Posts: 6
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Staff List Block - Ordering?
« Reply #2 on: October 18, 2010, 05:34:27 PM »
I want their usernames to be ordered by their member ID.  ;D
Thanks
« Last Edit: October 18, 2010, 05:45:42 PM by artica_james »

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Staff List Block - Ordering?
« Reply #3 on: October 19, 2010, 10:35:32 AM »
SimplePortal doesn't have a way to do that, out of the box.
You will need to customize the code.
 
Here's how you can begin:
From the file PortalBLocks.php, take a copy of function sp_staff
Copy it into a custom php block and rename it to function sp_staff_custom or whatever you want to call it.
 
At the bottom, after the function's closing bracker (}), call the function
 
Code: [Select]
$parms = array (
'id_order' => '9,1,4'
);
sp_staff_custom($parms,0,false);

When you have finished fixing up the function, you can, of course, replace sp_staff in PortalBlocks.php with your custom function.
 
Just to get you started, here's a suggestion:

Code: (find) [Select]
else
  $local_mods = array();
Code: (replace) [Select]
else
  $local_mods = array();
 
 $idorder = explode(',',$parameters['idorder']);
 $orderById = ! ( empty($idorder) || empty($parameters['idorder'] );
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline artica_james

  • Semi Newbie
  • *
  • Posts: 6
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Staff List Block - Ordering?
« Reply #4 on: October 19, 2010, 01:30:28 PM »
Thanks. I tried this method however i get a parse syntax error after replacing:
 
Code: [Select]
else
  $local_mods = array();

With
 
Code: [Select]
else
  $local_mods = array();
 $idorder = explode(',',$parameters['idorder']);
 $orderById = ! ( empty($idorder) || empty($parameters['idorder'] );

* I am quite new to PHP but am picking it up as go*

Thanks
James
« Last Edit: October 19, 2010, 01:37:24 PM by artica_james »

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Staff List Block - Ordering?
« Reply #5 on: October 19, 2010, 02:52:38 PM »
I'm afraid the code suggestions I made are going to be quite bad that way.
 
I tried that snippet 1 line at a time, narrowed it down to the second line, and finally saw that parentheses didn't match.
Code: [Select]
$orderById = ! ( empty($idorder) || empty($parameters['idorder'] ) );
I should have used a programmer's editor to help me avoid that that, instead of just typing off the top of my head. Notepad++ and many other free editors help with braces matching.
« Last Edit: October 19, 2010, 02:54:47 PM by AngelinaBelle »
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline artica_james

  • Semi Newbie
  • *
  • Posts: 6
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Staff List Block - Ordering?
« Reply #6 on: October 19, 2010, 04:43:58 PM »
Thanks again. However i am still having a couple of problems for some reason.

I have followed the instructions you gave me accordingly and used the code you gave me replacing where necessary however either the order doesn't change when the code is present or i get a parse error in the staff block.

Your help is much appreciated.

Many Thanks
James  ;D

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Staff List Block - Ordering?
« Reply #7 on: October 20, 2010, 08:58:21 AM »
I am sorry that I do not have the time to follow my own suggestions and develop a custom-ordered list block for you at this time.
 
If you are interested in pursuing this yourself, my advice is to change only 1 line at a time, check it for parse errors and bugs, and then add another line.
 
You may find it convenient to do your editing in an editor that gives you line numbers, then copy the entire contents into the block you are using to test the code.  That will make it easier to find a bad line.
 
Since you are new to php, I'll give you my understanding of the sp_staff block and what I've suggested for the sp_staff_custom function.
 
* sp_staff creates an array $staff.  Each element of this array has a key that is a combination of the user type and the user id. ( $type . '-' . $userid )
* after $staff is populated, the php function ksort is used to sort the array by its keys.  That puts admins first, ordered by userid, etc.
 
* in sp_staff_custom, I have suggested adding a parameter -- a text string containing several userids separated by commas
* This text string is then turned into an array using the php function explode
* This array is used to construct keys in $staff.
  + for users on the "special order" list, the key will start with '0' instead of 1, 2, or 3, which will put all of these users at the beginning of the list.
  + for users not on the "special order" list, the key to $staff will be as it is in sp_staff
* So, when ksort is used to reorder $staff, all the "special order" userids should wind up first, and in the order you listed them.
 
If you've never done programming before, you could learn a lot quickly.
Good Luck!
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline artica_james

  • Semi Newbie
  • *
  • Posts: 6
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Staff List Block - Ordering?
« Reply #8 on: October 21, 2010, 05:31:05 AM »
Ok no problem. Thanks for all your help, it's been much appreciated. I will now try and get this thing to work haha.

Thanks Again
James :D