Postfixadmin

From coopzone
Revision as of 17:49, 24 July 2018 by Cooperd (talk | contribs) (Created page with "'''Adding a new field''' in the config file: (normally config.php or config.inc.php) <pre> function x_mailbox_struct_hook($struct) { # additional field 'x_notify'...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Adding a new field

in the config file: (normally config.php or config.inc.php)

function x_mailbox_struct_hook($struct) {
# additional field 'x_notify'
           $struct['x_notify'] = pacol(1,1,1,'text', 'Notify_email_text','pNotify_email_text',''); 
      return $struct; # important!
}

In the example above, x_notify is the new field in the mailbox table:

+----------------+--------------+------+-----+---------------------+-------+
| Field          | Type         | Null | Key | Default             | Extra |
+----------------+--------------+------+-----+---------------------+-------+
| username       | varchar(255) | NO   | PRI | NULL                |       |
| password       | varchar(255) | NO   |     | NULL                |       |
| name           | varchar(255) | NO   |     | NULL                |       |
| maildir        | varchar(255) | NO   |     | NULL                |       |
| quota          | bigint(20)   | NO   |     | 0                   |       |
| local_part     | varchar(255) | NO   |     | NULL                |       |
| domain         | varchar(255) | NO   | MUL | NULL                |       |
| created        | datetime     | NO   |     | 2000-01-01 00:00:00 |       |
| modified       | datetime     | NO   |     | 2000-01-01 00:00:00 |       |
| active         | tinyint(1)   | NO   |     | 1                   |       |
| phone          | varchar(30)  | NO   |     |                     |       |
| email_other    | varchar(255) | NO   |     |                     |       |
| token          | varchar(255) | NO   |     |                     |       |
| token_validity | datetime     | NO   |     | 2000-01-01 00:00:00 |       |
| x_notify       | varchar(64)  | YES  |     | NULL                |       |
+----------------+--------------+------+-----+---------------------+-------+

and the two text fields are added in the language files and contain the text to display on the admin page, like this:

usr/share/postfixadmin/languages/en.lang:$PALANG['pNotify_email_text'] = 'Users notify email address';
usr/share/postfixadmin/languages/en.lang:$PALANG['Notify_email_text'] = 'Notify';