Merge pull request #2186 from drshawnkwang/drupal_fix-privatemsg-delimiterbug-3

Drupal: Reverted code to use a comma as separated between BOINC username
This commit is contained in:
tristanolive 2017-11-02 10:57:31 -04:00 committed by GitHub
commit f4a402a14a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 8 deletions

View File

@ -896,8 +896,8 @@ function privatemsg_new(&$form_state, $recipients = array(), $subject = '', $thr
$to_themed[$user->uid] = $myname;
}
if (!empty($to)) {
$recipients_string = implode(' ', $to);
$recipients_string .= ' ';
$recipients_string = implode(', ', $to);
$recipients_string .= ', ';
}
if (isset($form_state['values'])) {
if (isset($form_state['values']['recipient'])) {
@ -913,7 +913,6 @@ function privatemsg_new(&$form_state, $recipients = array(), $subject = '', $thr
elseif (!$thread_id) {
drupal_set_title(t('Write new message'));
}
$form = array();
if (isset($form_state['privatemsg_preview'])) {
$form['message_header'] = array(
@ -936,7 +935,7 @@ function privatemsg_new(&$form_state, $recipients = array(), $subject = '', $thr
$form['privatemsg']['recipient'] = array(
'#type' => 'textfield',
'#title' => t('To'),
'#description' => t('Separate multiple names with a space. The number appearing in the suffix is the BOINC id. You can find a user\'s BOINC id on their user profile page.'),
'#description' => t('Separate multiple names with a comma followed by one space. The number appearing in the suffix is the BOINC id. You can find a user\'s BOINC id on their user profile page.'),
'#default_value' => $recipients_string,
'#required' => TRUE,
'#weight' => -10,
@ -1089,7 +1088,7 @@ function _privatemsg_load_thread_participants($thread_id) {
*/
function _privatemsg_parse_userstring($input) {
if (is_string($input)) {
$input = explode(' ', $input);
$input = explode(', ', $input);
}
// Start working through the input array.
@ -1420,7 +1419,7 @@ function privatemsg_sql_deleted(&$fragments, $days) {
function privatemsg_user_name_autocomplete($string) {
$names = array();
// 1: Parse $string and build list of valid user names.
$fragments = explode(' ', $string);
$fragments = explode(', ', $string);
foreach ($fragments as $index => $name) {
if ($name = trim($name)) {
$names[$name] = $name;
@ -1435,11 +1434,11 @@ function privatemsg_user_name_autocomplete($string) {
db_set_active('boinc');
$result = db_query_range($query['query'], $fragment, 0, 10);
db_set_active('default');
$prefix = count($names) ? implode(' ', $names) . ' ' : '';
$prefix = count($names) ? implode(', ', $names) . ', ' : '';
// 3: Build proper suggestions and print.
while ($user = db_fetch_object($result)) {
$myname = preg_replace("/ /", "\xc2\xa0", $user->name);
$matches[$prefix . $myname . "_" . $user->id . ' '] = htmlentities($myname) . '(' . $user->id . ')';
$matches[$prefix . $myname . "_" . $user->id . ', '] = htmlentities($myname) . ' (' . $user->id . ')';
}
}
// convert to object to prevent drupal bug, see http://drupal.org/node/175361