Fabrik: Create a Custom Joomla User List

Fabrik: Create a Custom Joomla User List

This is another of our series of tutorials on Fabrik. Now, instead of using Fabrik to collect information, we're going to use it to display information.

In this tutorial we're going to do two things:

  • Create a list of your Joomla users.
  • Search that list in advanced ways.

In a previous tutorial we used Fabrik to create a contact form. In a second tutorial, we set up a custom user registration form.

Step 1: Create a New List

  • If you don't yet have Fabrik on your site, read this tutorial to install and configure Fabrik.
  • Go to Components > Fabrik > Lists. Click New.
  • Give it a Label name "Users" or any other name.
  • Click the "Data" tab located on the right side and view Database table, click the drop down and connect it to your core Joomla users table. (jos_users).
  • Scroll down and click the Advanced drop down, and set Alter existing field types to "No".
  • Click on Save & Close.
tutuploadsmedia_1336086980000.png

Step 2: Set Access Levels to this User List

  • You should set most of these options to have specific access levels so no one can go in and manipulate your core users table.
tutuploadsmedia_1336087059605.png

Step 3: Repeat Step 1 and Step 2 for the Usergroup_map Table

  • Create a Label name.
  • Choose a Database Table to connect to.
tutuploadsmedia_1336087318950.png

Step 4: Repeat Step 1 and Step 2 for the Usergroups Table

  • Create a Label name.
  • Choose a Database Table to connect to.
  • Save and Close.
tutuploadsmedia_1336087424981.png

Step 5: Open your Users Table

  • Click on List.
  • Open your Users table.
  • Click the "Data" tab and click on "Joins"
  • Set Display mode to "Merge rows".
tutuploadsmedia_1336087593738.png

Step 6: Join Your usergroup_map and usergroups Tables Together

  • In order to perform the search query we need to join the data together in one table.
  • Click on Add.
  • LEFT JOIN user_usergroup_map into your users table with the user_id matching the id.
  • Click on Add again.
  • LEFT JOIN your usergroups table into your usergroup_map table, where the id of the usergroups table matches the group_id of your usergroup_map table.
  • Save and Close.
tutuploadsmedia_1336087901479.png

Step 7: Publish Your User List

  • Go to Menus > Main Menu > New.
  • Choose "Fabrik List" as your Menu Item Type.
  • Create a Menu Title.
  • Change your Access level to Special.
  • Choose "Users" as your List in the Required Settings.
  • Save and Close.
tutuploadsmedia_1336088099420.png

Step 8: Remove Columns You Do Not Need

  • Removing unneeded columns will make it easier to see and browse your table.
  • Click on Elements.
  • Click on the -Select Form- drop down and select "Users".
  • Click on the checkboxes for the fields you do not want to view and click on Remove from List. (Do not unpublish it).
tutuploadsmedia_1336088359774.png

Step 9: Activate Your Advanced Search Function

  • Click on List.
  • Select "Users".
  • Click on the Filters drop down.
  • Set the Advanced search to Yes.
  • Save and Close.
tutuploadsmedia_1336088600442.png

Step 10: View Your Users Table

In my example here, I have 4 users who are Authors: John Doe, Eva Martin, Princess Leigh, and Laura Williams. In the query we will perform, we are searching for the Authors who hasn' t logged in in over 30 days. As you can tell from the user list provided, the result should show "Eva Martin" and "Laura Williams". But if we have a user list with several dozens and more, it would be a good idea to have a searchable query.

tutuploadsmedia_1336088684472.png

Step 11: Perform Your Query

  • Click on the Binoculars icon to open your search function.
  • Click on Add.
  • Search Where "title" equals to "Author".
  • Click on Add again.
  • Search "lastvisitDate" is "LESS THAN" 30 days prior to todays date, which would be 2012-04-03.
  • Click "Apply".
tutuploadsmedia_1336088887084.png

Step 12: View Your Successful Results

  • As a result, we have 2 users who are Authors, who haven't logged in in over a month. Congratulations!
tutuploadsmedia_1336089075812.png