How to theme a flag for different pages? I want to theme a flag for different pages like on user profile page the html of the flag will be different then on the view page . I can make  use of the flag.tpl.php and theme it but, I don't how to theme it for different pages.

Any suggestions?
Something like this will work for user pages. You can adapt for other pages. Put it in your theme's template.php file.

function MYTHEME_preprocess_flag(&amp;$variables) {
  if ($variables['flag']-&gt;name == "MACHINE_NAME_OF_FLAG") {
    if (arg(0) == 'user') {
        $variables['theme_hook_suggestions'][] = 'flag__user_page';
    }
  }
}


and the template file name then becomes

flag--user-page.tpl.php