Prevent hook_form_alter to works only on frontend not in admin? I have used a hook_form_alter to alter a form fields value randomly and its working fine, but the problem is that when i open this webform in admin panel its just change the value  which i dont. Its should keep the same value which is submitted by frontend user. i want this hook to work in case of frontend only not for admin.
you could use the global variable $user to achieve it.

&lt;?php

function MODULE_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  global $user;

  if($user-&gt;uid == 1) {
    return;
  }
  else {
    //alter fields logic goes here
  }
}