administration

Take Big Action With Views Bulk Operations

Recently I had to plan the unenviable task of adding terms from a new taxonomy category to dozens of nodes that had previously been created on a site. As I pondered my options (including a temporary Caribbean vacation) I remembered module I had seen pop up on Drupal.org called Views Bulk Operations or VBO for short. 

What VBO allows you to do create a view that will apply an action to many nodes at one time. So you must have the Views module installed and it helps to know your way around views a little bit because after installing and enabling VBO you'll need to create a Node view that will allow you to create a list of the nodes that you want to apply actions to.

The view that I created to make the taxonomy updates to the nodes in question had a pair of fields that allowed me to identify the nodes to update. Those fields for Title and Type, as in node type. This was just enough info to know for sure whether or not I wanted to make a change to the node. I added to the view a couple of exposed filters that would allow me to narrow down the list of the nodes by selecting the node type and a string of text from the title. The image below shows you what the finished product looks like.

So with this layout using exposed filters I can then make a couple of choices to filter the list down to the nodes I want to change. Then in the actions to take section I can indicate what I want to do by selecting the appropriate radio button. Then I can select one or more of the vocabularies in order to make that change. In my case I had added a whole new vocabulary with new terms so I chose Add the selected terms and then selected the vocabulary term that I wanted to apply (in this case from the Node Type vocabulary) before selecting the nodes (either one by one or by clicking the box next to Title to select all) then clicking the button (not shown in the image) at the bottom of the page to apply the update. At the end of the process you should see a confirmation that the nodes were updated. At that point you should double check a few of the nodes to make sure the updates were applied as you intended them.

Here's a little more about how I got to the end described above. The image below shows where you would select the style of Bulk Operations which is required for your view to offer you the correct options. Take note that the type of display you're looking for is one of Page. One more important thing to notice is the Access setting. Since this is the kind of function you would only want available to special users make sure you have Access set in a way that limits the ability to get to the page. In my case the user must have the permission to administer content types.

 

The image below shows the many options for the Bulk Operations style choice. Notice that I chose Modify node taxonomy terms as the only option. I don't know enough about the module yet to choose multiple options at once so I just stuck with the one.

The image below is what the preview looked like before I saved and attempted to use the view for the first time. Take note once again of the three elements. 

  1. Exposed filters which allowed me to narrow down the list of nodes
  2. The actions to take which should be consistent with my Bulk Operations settings choices
  3. The fields, Title and Type, which allow me to identify whether or not these are the correct nodes to take action on

Okay, so now you're ready to do some damage (in a good way of course) and make big changes to your nodes in a very short period of time. A final word of caution though. I did all of this on a pre-production site so if I did make a mistake it wouldn't affect site users. If you are trying VBO out for the first time I recommend doing so on a test site so that you can get the hang of what you need to do without having to back out major changes. Of course, if you make the wrong changes using VBO you can always back those changes out....using VBO.

Bookmark and Share Bookmark or Share Post

Managing A Drupal Site On The iPad

For the past couple of months I've had my hands on an Apple iPad and one of the first things I was interested in trying out was how effectively I could manage my Drupal sites with the device. Since I didn't want to jump to hasty conclusions about how good or bad the experience is I've waited all this time to write about it. In general I'll say that it's not a bad experience. The larger screen makes managing your site much more realistic than on the iPhone which I think is nearly an impossible task because of the small screen size. With that said you won't want to sound much time engaging in hard core site building on the iPad either.

Here's what you can do. You can access any menu item even with the Administration Menu module that places a bar at the top of the screen. The drop down menus work fine so you can navigate around very quickly. You can enter text anywhere there is a plain text box. HTML formatting must be accomplished by hand. I haven't tried it yet but one of the modules that adds the correct code for you at the press of a button might make things easier. It's on my to do list to try that. You can move around the administration section and change settings pretty easily. Comment moderation and responding is also very doable especially if you don't rely on a rich text editor. You can create basic blocks and nodes (I'm creating this post on my iPad) as well but the limitations I'll mention in a moment make it a frustrating task for anything beyond basic text entry.

Here's what you can't do. You can't use a WYSIWYG editor in a text area. You can work around that by making sure the "switch to plain text editor" link is available. That allows you to enter plain text but also wipes out the line breaks once you preview the node. So your nodes or blocks will have limited formatting. You also can't access your local file system which means that you can't upload attachments or images. So the expectation should be that you can do basic editing and content creation but nothing fancy. I use the Popups API to make things easier when managing blocks and comments. I've found that the resulting popups don't scroll so that module is not very helpful if you're on the iPad. You also can't scroll within or resize the text input area which makes creating long nodes very difficult. In fact nothing that usually involves clicking and dragging, or hovering the mouse works as far as I can see. In general the experience of managing Drupal via the iPad is a mixed bag. You can get to your site settings, manage comments and create basic nodes and blocks. Since I do my most serious managing of the site at home this level of access works fine for me. I'd like to upgrade the experience though. I suppose it's on Apple to offer access to the file system and perhaps upgrade mobile Safari to work with WYSIWYG editors. Even Google Docs doesn't work yet so we're not alone there.

The bottom line is that there are limitations that prevent anyone from doing serious development on a Drupal site via the iPad. So if you have your heart set on building and creating content on a light weight device then a netbook is a much better choice. So that's my take. If you have suggestions for work arounds, modules or helpful apps I'd love to hear about them in the comments.

Here are some screenshots that I added to this post after creating it on the iPad. From left to right they show what it looks like when editing a block, activating a popup dialog and editing a comment entry, all in landscape mode. I like the landscape mode better for management because it allows me to see the appropriate areas of the screen close up and the keyboard size is much more usable.

Drupal Block Editing on the iPad Drupal pop up dialog on the iPad. Drupal comment editing on the iPad.
Bookmark and Share Bookmark or Share Post

Bringing Your Site Back Online (...And user roles)

 I recently received an email asking me how to bring a Drupal site back online after taking it offline for site maintenance. For those of you who haven't done this yet you can take your site offline (and put it back online) by going to /admin/settings/site-maintenance. If you take your site offline for maintenance, then log out of the site you will get the "Site off-line message" indicated in your settings. To get back into your site all you need to do is go to /user/login. There you will be presented with the login form that you can complete in order to gain entry to your site.

It's important to understand that unless you specifically set the permission for "administer site configuration" under the system module then only user #1 can manage the maintenance status of the site. If you do want to grant this access to another user then you will also probably want to grant access to "access administration pages" as well. A screenshot of the appropriate section of the user permissions page (/admin/user/permissions) is included below.

System Module Permissions

I received another question recently that relates to roles and permissions as well. A reader asked how they could eliminate all of the extra fields below the node body when editing a node. An example of these "extra fields" is shown below.

Vertical Tabs

This is what the node submission form looks like with the vertical tabs module installed. Vertical tabs is highly recommended for Drupal 6 sites. In Drupal 7 this is a core module so you'll have it out of the box. What about the fields though? Users should not see those "extra fields" as long as they don't have the "administer nodes" permission.

If you're concerned about what your users who can contribute content to your site are seeing I recommend that you do two things. First, check your permissions in the Node Module section of the User Permissions page to see what the appropriate role can and cannot do. Second, create a user for yourself with a role equal to that of your contributors. This way you can login with the contributor role and see what they see. The Masquerade module looks like something that would assist with switching on the fly so you don't have to log out and log back in. You can also use separate browsers or use something featured in the Google Chrome web browser called an incognito window.

At this point I think it's worth noting just how important roles are on your Drupal site. They are definitely worth thinking about. Out of the box there are two user roles which are anonymous and authenticated. Those roles are in addition to the everything (or "god") role that is granted to user #1 on the site. If you're going to have a site where people cannot sign up for accounts (configure that at /admin/user/settings) then you won't have to spend too much time on it. Your user setting options are pictured below.

User Settings

If you are going to allow people to sign up for accounts then think hard about the access they will have. If you're in a situation where there will be other administrators or site editors then it is likely that you will want to set up additional roles (do this at /admin/user/roles) to give those users special permissions. For example, if you have people who are editing content or perhaps moderating comments then you would create a separate role, assign the appropriate permissions to the role then assign the role to that user. Roles can be assigned manually in the account page of a user as shown in the picture below.

If you want roles to be assigned automatically I suggest that you investigate the Auto Assign Role module. I haven't used it yet but I have it on my list of modules to try for another site that I am working on.

If you have any ideas, tips or tricks related to user roles I'd love to hear about them in the comments.

Bookmark and Share Bookmark or Share Post

Site Administration Basics

Lesson Ten of my special Getting Started With Drupal series of instructional videos.

This lesson focuses on the basics of administering your Drupal site. Topics covered include the site Status Report, module and core update status settings. Includes step-by-step instruction on how to update contributed modules and the core Drupal release.

The premium version is a full resolution (1024x768) version that contains additional content as indicated below.

Premium Content: 
  • Review of database logs
  • Setting different administration theme
  • Error reporting options
  • Cache settings to improve performance
  • Adding a special administration menu bar
Bookmark and Share Bookmark or Share Post

Moving A Localhost Site To The Web

Lesson Nine of my special Getting Started With Drupal series of videos.

This lesson provides instruction on how to move a localhost Drupal site to a web server. Steps shown in the video include creating a domain, creating a web database, exporting the local drupal database and importing the exported database to the web database.

The premium version is a full resolution (1024x768) version that contains additional content as indicated below.

Premium Content: 
  • Uploading new settings.php file
  • Turning off comments and user registrations
  • Reviewing content for errors
Bookmark and Share Bookmark or Share Post

Upgrading From Drupal 5 To Drupal 6

Yesterday I took the plunge on my site at www.awakenedvoice.com and upgraded the version of Drupal from 5 to 6. I kept a log of the steps involved in the process which you'll find below.

Before you get started I recommend that you take a look at Greg's upgrade video at http://www.masteringdrupal.com/screencast/upgrading-to-drupal-6. I watched it and it definitely helped with the process.

The upgrade process took me two hours. If you are using Drupal for a single user blog site, and are making minimum use of CCK and Views then I think that you should be able to execute the upgrade in the same amount of time it took me. If you're running a community site with a lot of content, a few custom content types with associated views then you're probably looking at three to four hours.

Keep in mind that there are separate upgrade steps for CCK and those steps need to be followed as well. Also, step # 1 below will be a lot easier if you install the Update Status module first. The module is removed in a later step because this functionality is part of core in Drupal 6.

Don't forget to check if your Drupal 5 theme has a Drupal 6 release. If the theme does not have a Drupal 6 release you'll want to investigate new theme possibilities. Switching over to the core Garland theme during the upgrade is an important step in the process so if you don't investigate this beforehand you may have to delay (unless you want to keep Garland) taking the site back live till you find a new theme.

As I said above there are special upgrade steps for CCK. I didn't find any special steps for Views. As a result I had to rebuild my views using the new interface for Drupal 6. If this information is new to you have a look at the posts in the view I've created over at http://learnbythedrop.com/cckandviews for a crash course on the new features.

One of the last steps below involves re-saving and positioning blocks. The need to reposition the blocks was likely due to the fact that I switched to a new theme. But even after positioning the blocks I had to go to each block and save it again so the location rules I had set (like display only on the front page for example) were not working.

If you make backups beforehand and give yourself plenty of time it should be okay. Feel free to post your own D5 to D^ war stories in the comments. Good luck.
 

1. Update all modules to latest version.
2. Backup database.
3. Download all site files.
4. Disable/Uninstall Update Status Module.
5. Disable all contributed modules.
6. Switch to Garland theme.
7. Delete D5 files, saving sites, files and any extra folders or files I added.
8. Delete D5 contributed modules
9. Upload latest Drupal release files.
10. Upload D6 versions of contrib modules.
11. Go to /update.php and select continue then update.
12. Review update messages for significant errors.
13. Review modules and enable those compatible with D6.
14. Enable new (but optional) core update status module.
15. Check contributed theme status and update if necessary.
16. Re-save blocks and position.
17. Rebuild any previously built views.
18. Bring the site back online.

Bookmark and Share Bookmark or Share Post

Taking Security Seriously

I've had good reason to think about security on my Drupal sites lately. This site and a few others were hacked recently. The result of the hacking was a script injected into both the generated pages and the RSS feeds of the site. I picked up on the hack pretty fast because the RSS feeds on the site were not behaving correctly and that broke something else that relies on the feeds to work. I also checked the site in Internet Explorer and things weren't displaying properly.

I spent about an hour investigating the issues before I realized that the site had been hacked for sure. One of the first things I did once I realized that the site had been hacked was that I took it offline. Whatever the script that had been injected into the site was doing it couldn't have been good. Then I took steps to correct the situation.

Since multiple sites were affected I assumed that somehow an FTP user password (which I thought was obscure enough) had been compromised. So I changed every password I could think of. Then I uploaded the latest version of Drupal to all of my sites. Next I checked the directories to see if there were any suspicious files remaining. Finally I checked the site RSS feeds and pages for signs of the script that I had found when I discovered the problems. It was only after taking those steps that I brought the sites back online.

The process was time consuming and painful enough for me to cause me to remember how important security is for any type of site you put up on the web. I should've known better since I've been caught by spammers before, but it's been a long time so I got a bit complacent.

I'd like to pass on some tips (and links to related modules) that can give you an idea of some of the security features to take advantage of when you're using Drupal.

Bookmark and Share Bookmark or Share Post

Basic Site Configuration

Lesson Two of my special Getting Started With Drupal series of instructional videos.

This video explores the basic configuration options to consider once you have successfully installed Drupal.

Bookmark and Share Bookmark or Share Post

Understanding Input Formats

From time to time people will ask me questions about problems they are having with content not displaying properly in nodes. Site developers may have problems displaying images, javascript, flash and php code. The problem is usually related to the input format chosen when publishing the node. The following video provides a very detailed look at how input formats work within Drupal.

 

Quicktime Video

Input Format Basics

There are three "out of the box" input formats for Drupal. These formats can be found on your site at admin/settings/filters.

  1. Filtered HTML - This format allows very basic text input and some HTML. This is a good format for comments and user generated content since it limits the ability of the user to add malicious code to the node.
  2. Full HTML - This format allows the full range of HTML tags including <embed> codes that are typically used for inserting widgets or embedded videos. This is my preferred format as a site administrator for creating all nodes and blocks on my sites. You can open this up to site users but it's recommended only for logged in users that have accounts at your site.
  3. PHP Code -  This format allows the posting of PHP code. This is used to customize the nodes on your site. There is a gallery of PHP snippets on Drupal.org where you can find examples thay may help extend the features of your site. This is a format that should only be available to admin users of the site. Opening up the PHP format to users jeopardizes the security of the site. So take great care when using this format.

The input formats in Drupal are highly customizable so you're not stuck with the exact formats that come standard with Drupal. Since these input formats greatly effect how and what content is posted to your site it is definitely a worthwhile investment of time to get to know them better.

Bookmark and Share Bookmark or Share Post

Upgrading Drupal

This video provides step-by-step instructions on upgrading Drupal core within a major release. For example, this would be helpful if you wanted to upgrade from Drupal 6.1 to 6.2.

Bookmark and Share Bookmark or Share Post
Syndicate content