| 1 |
<?php |
<?php |
| 2 |
// $Id: gamertags.module,v 1.2.2.1 2009/11/22 19:43:40 pobster Exp $ |
// $Id: gamertags.module,v 1.2.2.2 2009/11/22 19:46:04 pobster Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* Implementation of hook_filter(). |
* Implementation of hook_filter(). |
| 44 |
* Implementation of hook_menu(). |
* Implementation of hook_menu(). |
| 45 |
*/ |
*/ |
| 46 |
function gamertags_menu() { |
function gamertags_menu() { |
| 47 |
$items['admin/config/gamertags'] = array( |
$items['admin/config/people/gamertags'] = array( |
| 48 |
'title' => 'Gamertag Settings', |
'title' => 'Gamertag Settings', |
| 49 |
'description' => 'Settings for the Gamertags module.', |
'description' => 'Settings for the Gamertags module.', |
| 50 |
'page callback' => 'drupal_get_form', |
'page callback' => 'drupal_get_form', |
| 165 |
} // gamertags_settings |
} // gamertags_settings |
| 166 |
|
|
| 167 |
/** |
/** |
| 168 |
* Implement hook_form_FORM_ID_alter(). |
* Implement hook_form_alter(). |
| 169 |
*/ |
*/ |
| 170 |
function gamertags_form_user_profile_form_alter(&$form, &$form_state) { |
function gamertags_form_alter(&$form, &$form_state, $form_id) { |
| 171 |
if ($form['#user_category'] == 'account') { |
if (($form_id == 'user_register_form' && variable_get('gamertags_on_registration', TRUE) || $form_id == 'user_profile_form') && in_array($form['#user_category'], array('account', 'register'))) { |
| 172 |
$account = $form['#user']; |
$account = $form['#user']; |
| 173 |
if (!_gamertags_test_any()) { |
if (!_gamertags_test_any() || empty($account)) { |
| 174 |
return; |
return; |
| 175 |
} |
} |
| 176 |
$form['gamertags'] = array( |
$form['gamertags'] = array( |
| 220 |
); |
); |
| 221 |
} |
} |
| 222 |
} |
} |
| 223 |
} // gamertags_form_user_profile_form_alter |
} // gamertags_form_alter |
| 224 |
|
|
| 225 |
/** |
/** |
| 226 |
* Helper function to return TRUE if any gamertags are set to be collectable/ displayable. |
* Helper function to return TRUE if any gamertags are set to be collectable/ displayable. |