hook_form_alter not running if cache enabled I have enabled the cache in Administer->Development->Performance. I have changed user profile form using hook_form_alter. But the code inside hook_form_alter strops automatically after few days. I thinks, it may be cache issue. 

Everything I did in hook_form_alter is not running. I changed the submit button value. I added a custom Save and Continue button.

My Sample Code is below : 

if($form_id == "user_profile_form" &amp;&amp; $user-&gt;uid == 1) {
    $userid = arg(1);
    if(is_numeric($userid)) {
      drupal_set_message("Current User Id on site: ".$userid);
    }
   }


Attached screenshot :
Messages set by drupal_set_message() goes thorough message router and may end up displayed on another page than the one you set them. If you want to add informative element to your form, use markup Form API element instead.

if($form_id == "user_profile_form" &amp;&amp; $user-&gt;uid == 1) {
  $userid = arg(1);
  if(is_numeric($userid)) {
    $form['info'] = array(
      '#markup' =&gt; t("Current User Id on site: !uid", array('!uid' =&gt; $userid)),
      '#weight' =&gt; -9999,
    );
  }
}