When a user's CVS account access status is set to disabled, they are sent an e-mail message, but the message is blank. The reason is that cvs_mail_user() doesn't have a case for CVS_DISABLED.

There are a few ways to fix this. One would be to just not send an e-mail message when an account is disabled. Another would be to send a message, but to tell the user they have been disabled. That's the approach I took, with code below. In all cases, just add the code after the similar code for the CVS_DECLINED condition.

In cvs_mail_user(), add this code:

      case CVS_DISABLED:
        $extra = $extra ? t('Reason:'). "\n". $extra ."\n\n" : '';
        $message = strtr($strings['cvs_disabled_email'], $message_variables);
        break; 

In cvs_settings_form(), add this code:

  $form['cvs_email_form']['cvs_disabled_email'] = array(
    '#title' => t('CVS account disabled e-mail message'),
    '#type' => 'textarea',
    '#default_value' => variable_get('cvs_disabled_email', $strings['cvs_disabled_email']),
    '#description' => t('The message to send to users whose accounts have been disabled.'),
  );

In _cvs_get_strings(), add this code:

  $strings['cvs_disabled_email'] = t('%account-name,
  We are sorry to inform you that your CVS account request has been disabled due to the reasons outlined below.

%cvs-admin-message
Please do not hesitate to contact us if you would like to discuss this further, as we can still review our position.

Kind regards,
%cvs-admin-name.

--------------------
User:
  %user-account-url

Motivation message:
  %motivation-message');  

AC

CommentFileSizeAuthor
#2 cvslog_access_disabled.txt1.93 KBaclight

Comments

dww’s picture

seems like an email in this case is in order. actually, the slick thing would be a checkbox on the cvs account editing form to enable/disable the email notification, but that's feature creep. so, i think i'd be in favor of going with the approach you've started here. however, i'd really appreciate a patch that accomplished the changes you outline, instead of cut-and-pasted code. thanks.

aclight’s picture

Assigned: Unassigned » aclight
Status: Active » Needs review
StatusFileSize
new1.93 KB

If you insist. :)

Here's the patch
AC

killes@www.drop.org’s picture

Patch looks good to me. Do we need an extra checkbox? Doesn't the one tht is already there apply here?

dww’s picture

Status: Needs review » Fixed

oh yeah, right, we already have that checkbox, which controls if cvs_mail_user() gets called at all. ;) tee hee.

reviewed, tested, and committed a slightly modified version to HEAD. i just changed the wording of the default message to say "... CVS account has been disabled..." instead of "CVS account request has been disabled...". installed on d.o, too.

thanks!
-derek

Anonymous’s picture

Status: Fixed » Closed (fixed)