Drupal ignores check_markup() It seems like Drupal is ignoring check_markup(). What is wrong with the code below?

print check_markup($node-&gt;body, 'microblog', TRUE);


Site's default input format filter is = 'Filtered HTML'. All users have access to the 'microblog' filter, but I see my 'microblog' filter is kind of not working, and it uses filtered HTML.

What am I doing wrong?
In Drupal 6, the second argument of check_markup() is the value of the "format" field in the "filter_formats" table; it is a serial field, which means it can contain only numbers.

The documentation for the function doesn't specify what you should pass; it uses a phrase that could be misunderstood, but it doesn't talk of format name.


  $format The format of the text to be filtered. Specify FILTER_FORMAT_DEFAULT for the default format.


Looking at how the function is called in node_prepare(), I noticed the code that calls the function is the following one:

  if ($teaser == FALSE) {
    $node-&gt;body = check_markup($node-&gt;body, $node-&gt;format, FALSE);
  }


The content of $node-&gt;format is always a number, in Drupal 6.

In a standard installation of Drupal 6, without any extra modules installed, these are the values for the format ID to pass to check_markup():


Format ID     Input format
---------------------------
1             Filtered HTML
2             Full HTML
3             PHP code


To get the format ID knowing the name (e.g. "Filtered HTML"), you should use code similar to the following one:

$format_id = db_result(db_query("SELECT format FROM {filter_formats} WHERE name = '%s'", $format_name));


The format ID required from the function is different from a filter ID: An input format is a set of input filters that are used together to filter out or change what entered from users. What the modules implement are input filters.