Add Custom Fields Horde 5 Turba

This post will show you how to add multiple custom fields to Horde 5’s Address Book Application. Annoyingly the system only has an email field by default but there are several ways to easily enable a workEmail and HomeEmail field. There are many tutorials showing you how to do this but I couldn’t find an up to date tutorial on adding a custom field.

Any horde configuration file should not be edited! You should create a .local.php file instead and begin the file with <?php and then add any edits in there.

To enable the homeEmail and workEmail fields then create a new file called /var/www/turba/config/backends.local.php

Add the following (This is for SQL backend):

I found it easier to just copy the backends.php file to the backends.local.php.  Then I removed everything except for the following:

The parts that I added were:

These map the field names defined in the attributes file to the MySQL column names in the table.
I also added the fields to the communications section so they actually display in the web interface.

The extra fields still do not display in the web interface as of yet. We still need to add the custom fields to the attributes file and then add the extra entries to the MySQL database.

Copy the attributes.php file to attributes.local.php and then open the file with nano. Once opened pressing Ctrl + W will open a search box, enter without quotes “homeEmail”. It should take you to a section with this:

Just duplicate the homeEmail section with the additional email address fields, in this case it would be the following:

Now we need to add the additional columns to the MySQL database. Open the database using:

In this case the database is “horde” and the table we need to modify is “turba_objects” so we enter the following commands:

The following will add an extra email column called object_other1email. Make sure the names match the names given in the backends.local.php file.

The table should look like this now (I removed most of the columns to shorten the post).

If all has gone well then it should all be working now as seen below:

Selection_040