Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Database activity module FAQ.

Database activity module FAQ

From MoodleDocs

Where can I download additional database presets?

See Database presets for discussion links with presets for download.

How can I add to the list of database presets available for users to choose from?

In a default Moodle 1.x install there is one preset (Image Gallery): Database Presets.png

It is possible to create your own presets.

When you have created your database that you desire to set as a preset; go to the "Presets" tab of the database and choose "Save as preset". Give the preset a name and the database fields and templates will now be available as a preset for the rest of the site. You will need site admin rights to do this.

Please see the Database_presets for other available presets you can import into your system.

How can I create a database in which students can only view their own entries?


  • Set up the database so that entries require approval. If the entries are never approved, then only the student that added a particular entry and the teachers can view it.


  • Set the group mode of the database to "Separate groups" and assign each student to a separate group.

How can I enable a sort function by clicking on the field headings?

For sorting, you need to manually create the link in the template around that heading. To find the URL you need, you can do a sort using the menus and then look in the URLs. Take out everything but the d, sort and order parameters. For example,

How can I add highlighting like on the Module and plugins page?

In the repeated part of the template (note onmouseover and onmouseout to change the classes):

<tr onmouseover="this.className='trhighlight'" onmouseout="this.className='trnormal'">
 <td class="c0"><b><a href="##MoreURL##">[[Name]]</a></b></td>
 <td class="c1">[[Type]]</td>
 <td class="c2">[[Requirement]]</td>
 <td class="c3">[[Status]]</td>
 <td class="c4">[[Summary]]</td>
 <td align="center" class="c5">##Edit## ##Delete## ##More## ##Approve## </td>

In the CSS template there are two styles:

.trnormal td {
   background-color: #FFFFFF;
 .trhighlight td {
   background-color: #EEEEEE;

How can I list database information horizontally instead of vertically?

Can't get columns to line up in list view

How can I make an Encyclopedia database preset?

Is there a Time stamp for database entries?

How can I make the title of an entry into a link?

To make the title of an entry in list view link to the single view, add the following code to the list template:

<a href="##moreurl##">[[Title]]</a>

How can I make email addresses clickable?

To make email addresses clickable, add the following code to the single template:

<a href="mailto:[[Email]]">[[Email]]</a>

where 'Email' is the text field for inputting email addresses.

How can I delete a file attached to a database entry?

There is currently no user interface for deleting a file attached to a database entry, however a workaround would be to delete the entry completely and then create a new entry without the file attached.

How can I hide a database entry which was previously approved?

There is currently no user interface for hiding a database entry which was previously approved i.e. setting it to require approval again. However, an entry can be hidden using MySQL Admin by editing it in the data_records table and changing the approved value from 1 to 0.

How can I add a default sort order of entries?

In the Fields tab, select a default sort field, choose ascending or descending then click the Save button.

Why is my database so slow to show each page?

Try to go to "Administration > Miscellaneous > XMLDB editor" and choose "Check Indexes". If you have any missing indexes found; upgrade your Moodle to the latest weekly build of your version; re-run the test; backup your site database and then run the suggested SQL from the test on your site database. This should speed up your database activity load times.

See also

Using Moodle forum discussions: