I think you are trying to shorten the country select box in user registration form and user edit form. You should not hack the contributed modules. You could create your own module and override the forms using hook_form_alter().
I assume you have a custom module and you could implement hook_form_alter() to update the country list as you need. Here is the code in mymodule.module tested in my test site:
function mymodule_form_alter(&$form, &$form_state, $form_id) {
if( $form_id == 'user_register_form' || $form_id == 'user_profile_form' ){
$countries = array( // define the countries you want
93 => 'Afghanistan',
355 => 'Albania',
213 => 'Algeria'
);
$form['sms_user']['gateway']['country']['#options'] = $countries; // update sms country select box.
}
}
But, to access the field group sms_user, your module must have the heaviest weight, otherwise you won't be able to update $form['sms_user']['gateway']['country']
.
You can make sure your module is heaviest by creating yourmodulename.install
.
/**
* Implementation of hook_install()
*/
function mymodule_install(){
# Fetch max module weight from "system" table.
$max_weight = db_query("SELECT MAX(weight) FROM {system} WHERE type = 'module'")->fetchField();
# Make sure this module is the heaviest one in order to run last
db_update('system')
->fields(array('weight' => $max_weight+1))
->condition('name', 'mymodule')
->execute();
}
/**
* Implementation of hook_uninstall()
*/
function mymodule_uninstall(){
db_delete('system')
->condition('name', 'mymodule')
->execute();
}
If you are expert, you can tweak the weight
field of your module in the system
table to make it heaviest without creating yourmodulename.install
, but not recommended. You may need to flush all caches after you implemented this.
hook_form_alter()
and unset the rest of the values.