Creating a staff directory for you community can be useful for all sorts of reason. Maybe just so that your members can see the staff just at a glance, or maybe you run a gaming community where the Staff may actually be staff within your game. Whatever the reason, you can create a staff directory with ease in the IPS4 Admin CP.
To add a staff directory, visit Members>Staff>Staff Directory, from within your admin CP. By default you will first see this (if you expand the 2 groups) with the administrator and moderators groups already added.
You can add either groups or individual members to a category within this page by clicking on the plus icon at the side of any group. To add a new category click on Create Category.
Once you have clicked the plus to add a member or group to a category. You will be presented with one of 2 sets of information to enter. If it is a group then you would simply select the group. If a member then there are also other items you can select here
New Directory Entry
You will note that you can change what you display for the member if you are entering an individual into the staff directory. This is handy if for example you wish to show someones real name or something different. So I may have a member called X2201 and want to show them as Dave (X2201) so its clear who the person is. This is the same with the user title, so they may have "Happy Guy" where I may want to put "Clan Leader" for example.
You can change the way in which the directory is displayed my changing the display of each category. You can change these by selecting the pencil icon at the right of any category in the list. Once selected you will be shown a screen similar to the below.
You can choose from any of the layouts provided, and can even create more layouts if you are a more advanced user. Using these options you can create some great layouts
Staff Directory Example
It is possible to create custom layouts for the Staff Directory page. You will need to write the templates using HTML, so to do this you will need to be familiar with HTML, as well as basic PHP logic.
In the AdminCP, go to Customization -> Themes and click the "Edit HTML and CSS" button for your default theme. Then, from the "New" dropdown, choose "HTML Template". You can name the template whatever you like, and fill the rest of the form out with the following details:
Location: Add to an existing location
Existing Location: front
Group: Add to an existing group
Existing Group: staffdirectory
You will then need to navigate to your newly created template within the many on the left (it will be under core -> front -> staffdirectory) and here is where you write the HTML code for your template. The template will be passed a $users variable which is an array of \IPS\core\StaffDirectory\User objects. Your code can include template logic and template tags You can use one of the existing templates as an example.
After this you will also need to create another template with the same name (and settings above) but with "_preview" appended to the name (for example, if the template you just created is called "myCustomLayout" the template you create now will be "myCustomLayout_preview") which contains the HTML to display on the form when creating a Staff Directory group in the AdminCP. Since you know what the layout will look like, you can make this quite simple.
You will need to repeat these steps for every theme you have installed (except child themes which will inherit the templates of their parents).
Once this is done, when creating a Staff Directory group, you will see the template you have created as one of the available options.