5

I see that from admin/config/content/formats/plain_text I can not disable it for a individual role. How can I do this?

UPDATE: I can change the attributes of the format and rename it, however I see no way to change the machine name of the format. It should be a better way to achieve this.

1
  • Felip is right. Simply changing the filter_fallback_format() in the variables table will solve this problem completely, even for Ek Kosmos concern, since you won't have mismatching human and machine names.
    – jtbayly
    Jun 4, 2012 at 15:02

6 Answers 6

5
+50

The "Plain text" input format cannot be disabled for any role. Even if you disable the permission to use the plain text format for a role, users with that role will be able to use the plain text format.

To allow all users to use the full HTML format, you need to:

  • disable all the input format, except the plain text format (which is the only one you cannot disable), in admin/config/content/formats
  • rename the plain text format in "HTML." You cannot rename it "Full HTML," or "full HTML" as Drupal will report you that a input format with that name already exists.
  • change the settings for the input format as shown in the following screenshots, which show the settings before and after the changes.

before

after

(PHP evaluator will be visible only when the PHP filter module is enabled.)

You can also disable the "Convert line breaks into HTML" filter, if you want. In that case, the new line characters will not converted in <br /> tags, and the text will not be wrapped in <p> tags. I would also disable the "Convert URLs into links" filter, which is the filter that changes texts like http://example.com in http://example.com (as it is done in SE sites). I would keep enabled the "Correct faulty and chopped off HTML" filter, which is the filter that fixes the missing closing tags; this avoids that a user can mess with the HTML layout of your site by leaving out a closing tag, such as </b> that would render all the page in bold, or </table> that would seriously mess-up the layout of the page.

To notice that the disabled input formats will not be visible anymore in the settings page, but the "filter_format" table will still contain the data about those input formats; that is the reason you cannot rename the "Plain Text" format as "Full HTML." That database table is also the table that you need to alter, if you want to change the machine name of the input format; in that case, I would first delete the rows for the input formats you don't need.

3
  • 1
    Actually I don't want to overcharge the users with too many options I want them to use only the Full HTML format, and other formats to be disabled.
    – radu c
    Apr 10, 2011 at 15:36
  • How can select another input format as default one? I see no way to do this only to change the attributes of the format and rename it, however I see no way to change the machine name of the format. Which is not a big problem for now, but over time it will result in confusion...
    – radu c
    Apr 11, 2011 at 7:28
  • 2
    A problem with the above solution is that any pages that have been created with previous formats are unrenderable until reset. Fortunately you can reset the status field of the disabled formats in the {filter_format} table to recover the lost pages.
    – Diogenes
    Feb 12, 2012 at 10:17
7

Better Formats module will allow you to select the default input format per role, and disable the formats selection part of the node edit form http://drupal.org/project/better_formats

1
  • 3
    This module is not doing much in Drupal 7. As they say: Most of the features in BF are in Drupal 7 core now.
    – radu c
    Apr 15, 2011 at 11:43
3

The "Plain text" input format cannot be disabled for any role. Even if you disable the permission to use the plain text format for a role, users with that role will be able to use the plain text format.

I have just had to deal with this particular issue. It is actually a little more subtle than that: all Drupal asks for is a fallback format, which is usable by any role. The good news is you can change it (see function filter_fallback_format()), so that you could set filter_fallback_format to filtered_html in the variable table.

2

Drupal requires a single format to be available for all roles. This is called plain text by default, but can be modifying to function like any format you could create.

2
  • 1
    True. But how do I change the machine name of the plain text format ? I can chance the user name but I can not change the machine mane... and over time it could be the subject of confusion.
    – radu c
    Apr 11, 2011 at 7:21
  • 1
    All extensive Drupal sites should contain documentation packages for future maintainers. This is the kind of thing that you should include in the dev docs package.
    – James
    Apr 19, 2011 at 17:05
2

The default text input is configurable as well.
Instead of creating two input formats (i.e. Filtered HTML and Plain Text) you can just rename the default input format and uncheck the HTML to plain text conversion.

2
  • 1
    Yes, but the machine name of the format will remain unchanged, so it could be the subject of confusion over time. I think must be other solution for this...
    – radu c
    Apr 11, 2011 at 7:18
  • This is a good workaround.
    – Jay
    Feb 1, 2012 at 16:51
2

By enabling the filters for Plain text on admin/config/content/formats/plain_text you can make Plain text to Full HTML as default. And if still you require a Plain text field then you must create one text format and disable all the filters to use it as Plain text format.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.