/** * The purpose of this method is to determine if there are already generated templates in the database for the given variables. * @param string $messenger messenger * @param string $message_type message type * @param int $GRP_ID GRP ID ( if a custom template) (if not provided then we're just doing global template check) * @return bool true = generated, false = hasn't been generated. */ public static function already_generated($messenger, $message_type, $GRP_ID = 0) { EEH_MSG_Template::_set_autoloader(); //what method we use depends on whether we have an GRP_ID or not $count = empty($GRP_ID) ? EEM_Message_Template::instance()->count(array(array('Message_Template_Group.MTP_messenger' => $messenger, 'Message_Template_Group.MTP_message_type' => $message_type, 'Message_Template_Group.MTP_is_global' => true))) : EEM_Message_Template::instance()->count(array(array('GRP_ID' => $GRP_ID))); return $count > 0; }