New config option: Expose user emails #32

merged 3 commits into from Nov 16, 2012


None yet
2 participants

MarkMaldaba commented Nov 13, 2012

A new option to dictate whether user e-mail addresses should be exposed in the e-mail notifications sent by ProjectPier. Defaults to true, to keep current behaviour.

This requires a DB update. I have updated the initial_data.sql file, but I don't know where to put the code to update existing installations. I have included the necessary SQL in the commit message.

MarkMaldaba added some commits Apr 28, 2012

Currently there are three files in the cache directory, which don't n…
…eed to be there:

* /cache/autoloader.php
* /cache/log.php
* /cache/trace.txt

These files ship as empty place-holder files, but will be written to by the application in certain situations. This causes problems with revision control, as the files show up as 'modified' and may end up being committed to the source repository. This is not just a problem in the main ProjectPier repository, but it has down-stream implications too.

The code already creates these files automatically if they don't already exist, but there are a couple of places where errors may be raised if they are not present. This commit contains the necessary modifications to remove these errors:

* When including the autoloader.php, we suppress errors using @ prior to the fopen() statement.
* The __production_error_handler() was logging all errors (except E_STRICT), even if they were deliberately suppressed using @. This patch updates the function so that it ignores suppressed errors. I've also added a comment to explain what 2048 means, and why the E_STRICT constant isn't being used.

This has been logged as a bug at
Added a new config option, 'expose user emails', which defaults to tr…
…ue (to mimic old behaviour). If set to false, then all e-mail will come from the site address defined in the Mail From field (or automatically calculated if not set). I also split the code that generates the site e-mail address into a getSiteEmailAddress() function, so that we encapsulate the logic to generate it better - it can now be called from elsewhere, if needed.

This will involve a change to the DB data (to add the new option to the config_options table, and to modify the ordering of a subsequent item).  I have added the necessary changes to initial_data.sql, but I don't know how to manage updates to existing systems.  Here is the code that will need to be run, but I have no idea where to put it, I'm afraid!

    INSERT INTO `<?php echo $table_prefix ?>config_options`
     (`category_name`, `name`, `value`, `config_handler_class`, `is_system`, `option_order`, `dev_comment`)
     ('mailing', 'mail_expose_user_emails', '1', 'BoolConfigHandler', 0, 12,
      'Enable to expose user e-mails in the from/reply-to field, or disable to always use the site address, below.');

    UPDATE `<?php echo $table_prefix ?>config_options`
    SET `option_order` = 13
    WHERE `category_name` = 'mailing' AND `name` = 'mail_from';

phpfreak added a commit that referenced this pull request Nov 16, 2012

Merge pull request #32 from MarkMaldaba/ExposeUserEmailsOption
New config option: Expose user emails

@phpfreak phpfreak merged commit 38a6074 into phpfreak:master Nov 16, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment