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

Please share 🙂
  • goodkat

    Thanks for the detailed instructions.
    But I think it is even better to map any created field name dynamically.
    E.g. on your iphone, you create a custom field of type phone.
    Then Turba should at least create a field for it with a name like “Other Phone”, “Other Phone 2” and so on.
    Static field names are not practicable I think.
    The best would be to create the custom field in Turba when synced from mobile.

    • Christopher

      Thanks for the tip! I did not know you could map fields dynamically.
      I will look into this as it does sound like a better method.
      I will update the post accordingly once I have researched 🙂

  • Baronmax

    Hi Monotok,

    Thanks for this, looks like exactly what I need to sync my Outlook contacts to a CARDdav server on cpanel. But I’m a bit lost as to how you go about modifying these files via cpanel – can it be done? Have browsed using the file manager but can’t find the /var directory so not feeling hopeful….