Drupal tips

This is a collection of brief Drupal-related tips for AMNH site maintainers.

Adding a page

First, see Brian Abbot's documentation on the topic

It's worth emphasizing that you should mind the "Automatic alias" checkbox in the "URL Path Settings" section of the page. You want this unchecked if you have entered a custom alias before. If the existing alias is fine (e.g. if you like your site's automatic alias settings), then don't worry about it.

If you have been set up with the "Workflow Access" Drupal modules (and therefore see various workflow options available to you under a box labeled "Draft-Done"), then be aware that this works in conjunction with the "Publishing options" box at the bottom of the page. If you are using the advanced workflow, you still need to have "Published" selected under "Publishing options."

Finally, be aware that you have revisioning at your disposal. Under "Revision information" you can create new revisions after you've initially added the page to your site. This is handy if you have to undo anything in the future.

Adding a user

People with the "Manager" role in Drupal can add user accounts to their sites. Here is how.

  1. Go to Administer -> User Management -> Users, then click the "Add user" tab.
  2. Fill in the information on that page and click "create new account."

By default, Drupal will try to check a user's login credentials against the Museum's LDAP system. If the user's name as it is entered does not match an account name in LDAP, Drupal will fall back to checking its own internal user database. Thus, you can add accounts for people both internal and external to the institution.

If you are adding an LDAP user, you still need to enter a password on the "Add user" page ... you should pick a secure password, but it will not be used. You should not select "Notify user of new account," as this will cause Drupal to send a message with the dummy password that you just typed. This will cause an authentication failure when LDAP authentication is attempted.

Finally, if on the account's Edit page you see a tab named "Personal Information," you should go there and add the user's full name in the Display Name field.

Alternative method

This method only works for users who already have LDAP accounts at the AMNH.

These are the instructions for the user who needs the new account:

  1. Create a new account in your department's site by logging in to it using your LDAP user name and password. To do so, browse to /user/login under your department's website and fill in the user name and password. The user name is the name part of your email address. Use the same password that you use for email. (Do not select the "create new account" tab. Select the "log in" tab of the login page. An account is automatically created when you log in for the first time via LDAP.)
  2. Once logged in, you will encounter a page with a tab that says "edit," which, when clicked, will display another page that has a "Personal Information" tab. Click on that, and then enter your full name in the "Display Name" field.
  3. After that, you are done. Contact your departmental site's manager to be set up with the particular privileges that you will need for creating your content.

Adding an image to a page

Before proceeding to add an image to your page, open to the Image Placement & Styles page of the Research Theme Guide (which you can access by following the "Web Guide" link at the top of your Drupal site banner). Keep this page handy as you continue with the following steps.

To add an image to one of your pages in Drupal, you must first upload an image file to the page that you are editing:

  1. Begin editing your page by clicking the page's "Edit" tab.
  2. In the "File attachments" section of the Edit page (which you can expand by clicking), upload your file by choosing it from your local filesystem and pressing the "attach" button. The file will be uploaded behind the scene while your current Edit page remains on the screen.
  3. Next, in the updated "File attachments" section, un-check the "List" checkbox next to your new image file.
  4. Note that the URL to the new image is displayed in the file attachments listing. Copy the path part of this URL (i.e. the part after ".org") to your clipboard by highlighting it and pressing ctrl-C (Win) or command-C (Mac).

Now you are ready to edit your content and insert the HTML for your image. You need to enable one of the Drupal Input Formats that supports the direct entry of HTML code. See the "Input Format" area of the Edit page. On most AMNH Research Drupal sites, the input formats that support this are named "Full HTML" or "WYSIWYG HTML."

  1. (Only if you are using the WYSIWYG editor) In the WYSIWYG toolbar, click the "Source" button. Now you are editing the HTML source of the page.
  2. Using the example in the Research Theme Guide document (see above) for guidance, put in your div tag, img tag, and caption paragraphs. This is where you can paste in the path to the image file, which you copied earlier. (Ctrl-V [Win], Command-V [Mac])
  3. If you like, you can press the "preview" button at the very bottom of the edit page to check your work.
  4. To save your change, click the "save" button at the bottom of the Edit page.

Internal links in your HTML

To create HTML anchor links to other pages in your site, use Drupal's Path Filter link format, where the href attribute of your <a> tags is of the form "internal:node/123" (where instead of 123 you use the actual node number of the destination page.

For example:

<a href="internal:node/100">my link</a>

See also the Drupal Path Filter site.

Tip: although you can link to the alias of your page (e.g. "documentation/foo"), it's best if you use the "node/123" syntax if you want your links to stay unbroken, should you happen to re-alias the pages on your site. To find the node number, go to the target page and mouse over its "edit" link, and observe the URL in your browser's status bar. Alternately, if you have access to "Administer -> Site Building -> URL Aliases" you can see the node numbers for all of your aliased content.

Another advantage of using this type of link is that you can move your Drupal site to another URL path in the future, without the links breaking.

Also note: if you have any problems with Path Filter links being broken after you change your site aliases, try going into "Adminster -> Performance" and clearing your Drupal site cache.

Staff pages

Most of our websites have pages that list departmental personnel. If, in addition, you need for staff members to have personal pages within your site, the following guidelines apply.

We recommend that any staff members' sections that are larger than one page (or that could expand in the future) be created as Drupal Books, for the greatest ease of maintenance. Books are nice because they automatically generate navigation for you as you add and rearrange pages.

After a user has been added, hover your mouse over the "Content management" menu at the top of your screen, go to "Create content", then go to "Book page". On the page that follows, select "Staff" in the "Staff page assignment" box. This will ensure that the new page will show up under "/staff" in your site.

(Some of our older sites were not set up with this "Staff page assignment" feature. Contact us if you think you could use it.)

Before saving the new staff page, be sure to expand the "Authoring information" section of the form and add the user's user id (the short name) in the "Authored by" box.

You may wonder whether it would be easier to simply create a Book named "Staff" and add the users' pages as child pages of that book. We create separate books as described above in order to allow you to use a plain Drupal Page for your main roster page, so that, on this top-level page, you can do away with the book navigation (with staff members names and links to their pages) which would, in this instance, be redundant with the staff members' names in the center of the page. There is, unfortunately, no convenient way at the moment to selectively turn off the Book navigation on one particular page of a Book. Though the Book navigation is normally a huge benefit to everyone, in this case we want not to see it.

Staging and publishing revisions to pages

If your site has the "Revisioning" module installed, you can stage and test new revisions of your content while the older revision remains "published" for the rest of the world to see. When you are done vetting your new content, someone with sufficient privileges can publish the new revision.

With Revisioning enabled, an editor clicks on the "Edit Current" or "Edit" tab near the top of the page, and makes changes. Upon clicking "Save," rather than the page "going live" to the public, it is instead saved as a new revision, and is subsequently available under the page's "Revisions" tab. This new revision is kept behind the scene, and is not visible yet to the general public.

When a website manager or someone given the necessary privileges to approve website content logs in to the site, he or she can navigate, via the page's Revisions tab, to the new revision and click the "Publish this" link at the top of the page. Alternately, supervisory users will find links to pages pending approval in the left-hand navigation bar throughout most of the site.

Edit pane options

In the "Edit" pane of every page, there are two sets of options related to this revision-control workflow.

Under "Revision information" you should leave the "Create new revision" checkbox checked, as is its default. It helps to write a descriptive log message describing the change you are making to your page. If the option labeled "New revision in draft, pending moderation" is available to you, be sure that is checked.

Under "Publishing options," leave the "Published" option checked if this is a new revision for an already-published page.

If you are creating a new page, leave the "Published" option unchecked unless you really want it to go live immediately. Only users with the sufficient privileges to publish pages will be able to select this option.

Even if you are using this revision-control functionality to keep a new revision in staging (invisible to the public), you still want the page's status in his area to be "Published," if this is a new revision to an existing page.

To inspect or publish the staged content

Someone who has been granted the role of publishing content can perform the following steps to validate or publish a new revision.

  1. In the left-hand navigation bar, where it lists pending revisions, click on the one you want to inspect or publish.
  2. You will be taken to the "View" sub-tab of the page's "Revisions" tab. Inspect the new revision.
  3. To publish the new revision, click "Publish this".


  1. Navigate through the website to the page that you want to inspect or publish.
  2. Click "Revisions"
  3. Select the revision that is "in draft/pending publication" by clicking on its timestamp in the listing.
  4. Inspect the new revision.
  5. Click "Publish this" if it's ready to go live.

Using the rich editor

If you site has been configured to use a "rich editor," the text area where you enter the content of your pages will be "WYSIWYG" (what you see is what you get) and you will have a variety of buttons and menus at your disposal for formatting your text.

Document section headers: Use the "Format" dropdown box to select section headers, such as h2, h3, h4, and so on.

Pasting from other applications: You generally want not to preserve formatting from other applications, like Word, when you are copying and pasting into the editor window. You can use the "paste from word" button (the one that looks like a clipboard with a Word logo on it) to help strip out unwanted formatting that is going to make your page look bad.

Adding hyperlinks: Use the "link button" (the one with the globe and chain links) to add hyperlinks to other pages. First, type the text that you want to make into a link, then highlight it, and then press the button. For links to other sites, it should be self-explanatory. For internal links, to pages within your site, you probably want to use the internal link format of href attribute. In this case, after you press the "link" button, select "other" in the "Protocol" dropdown, and type internal:node/nn in the URL box, where "nn" is the node to which you want to link. (See the page on internal links for more information.)