Q:

How can I set "Assigned To" for an Activity to default to the logged-in user name?

Our users are creating many new Activities which are Assigned To the user creating the Activity. I want to save them time and keystrokes by having Assigned To: default to that logged-in user's name. How can I do this? Thanks. 

A:

Create a simple extension implementing hook_civicrm_buildForm like so:
function myextension_civicrm_buildForm($formName, &$form) {
  if ($formName == 'CRM_Activity_Form_Activity' && $form->getAction() == CRM_Core_Action::ADD) {
    $form->setDefaults(array('assignee_contact_id' => $form->_currentUserId));
  }
}

A:

You can (must) use an extension.
You can either use hook_buildForm to include a jQuery snippet that looks up the current user and populates the field, or you can use hook_post to do the same if there's no "Assigned to" set.  The first approach lets the user see the "Assigned To" with their name, but the second approach covers activities created via other means than the "New Activity" form (import, API, profiles, etc.).  If you go the second route, you need to make sure it's not assigning activities automatically for people contributing online etc.!

