Perhaps this shuld be coupled with a variable ?

  if (empty($message['subject'])) {

such as :

  if (!variable_get('pmsg_allow_empty_subject', FALSE) && empty($message['subject'])) {

Comments

berdir’s picture

Status: Active » Needs review
StatusFileSize
new2.35 KB

- Added a configuration setting to allow empty subjects
- If set to yes, empty subjects are automatically filled with the first 20 characters of the body
- Only for users, api functions aren't changed.. They should always send a subject, because they don't know if it is allowed or not
- We need a subject to display the list and so on, so the validate function itself hasn't changed, it still checks for a non-empty subject

Question
- I made the body required for now, should that be configurable too ? We need atleast either the subject or the body.

berdir’s picture

StatusFileSize
new1.72 KB

Updated patch:

- removed configuration settings as discussed in irc
- removed body check in validate function
- If subject is empty and body is not, subject gets prefilled with the first 20 text-chars (html tags removed) of the body
- If both subject and body are empty, it fails with a message that subject is needed.

litwol’s picture

Status: Needs review » Fixed

Commited with minor change.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.