Hello. Transfer of points from one user to another is not convenient. The name of user must be given correct and completely. PrivateMessages module includes the feature to auto-completion of user names. The following code uses provides the support for this feature:
File user2userpoints.module (function user2userpoints_giveform)
old code:
$form['to'] = array(
'#type' => 'textfield',
'#title' => t('To'),
'#default_value' => $name,
'#size' => 50,
'#maxlength' => 64,
'#required' => TRUE
);
new code:
$form['to'] = array(
'#type' => 'textfield',
'#title' => t('To'),
'#default_value' => $name,
'#size' => 50,
'#maxlength' => 64,
'#required' => TRUE
);
// check if module is privatemsg is loaded
if (module_exists('privatemsg')) {
$form['to']['#autocomplete_path'] = 'privatemsg/autocomplete';
}
Comments
Comment #1
jredding commentedCan you please supply a patch to provide this functionality. Additionally you can use autocomplete without the private messaging module so I would request that you remove the if (module_exists) portion of the patch and simply use the autocomplete feature within FAPI.
Forms API (FAPI) documentation can be found at http://api.drupal.org
Thanks for taking the time to submit the code changes and a patch, everyone appreciates it!
Comment #2
the.tdd commentedThis code works too:
So we can avoid using personal messages module!
Comment #3
jredding commentedwonderful! thanks for cleaning up the code to remove the dependency on the PM modules.
Now could I bother you to create a patch for this, please?
http://drupal.org/patch for instructions.
Patches are THE way to get your code commited into a project. The code you provided is immensely useful and a patch would be divine.
Thanks!
Comment #4
berdirSorry for pinging the participants.
Now that Drupal 7 is out, there is no support for Drupal 5 and the
corresponding modules anymore. Therefore, I'm closing all old issues
which are still open.
I suggest you upgrade to Drupal 6 or 7 and figure out if you're feature
is still needed or the bug still exists and open a new issue in that
case.