How can I show only 3 countries in country list (select box)? I'm using SMS User module which validates users' mobile numbers. There's a select box and all countries in it. Users select country and write their mobile numbers.

I want to show only 3 countries in it, but there's no option in admin panel. I looked up the sms_user table. There is a gateway column and country codes writing. That's all.

How can I modify the country list? When I looked into the module code, I found nothing about countries.
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(&amp;$form, &amp;$form_state, $form_id) {
    if( $form_id == 'user_register_form' || $form_id == 'user_profile_form' ){
        $countries = array( // define the countries you want
            93  =&gt; 'Afghanistan', 
            355 =&gt; 'Albania', 
            213 =&gt; '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'")-&gt;fetchField();
    # Make sure this module is the heaviest one in order to run last
    db_update('system')
        -&gt;fields(array('weight' =&gt; $max_weight+1))
        -&gt;condition('name', 'mymodule')
        -&gt;execute();
}
/**
 * Implementation of hook_uninstall()
 */
function mymodule_uninstall(){
    db_delete('system')
        -&gt;condition('name', 'mymodule')
        -&gt;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.