Category Archives: Technology

Drupal Learning Journal 19. A Book of Videos

There is an yet-unsolved bug in the Media module (for Drupal 7) that prevented us from making the video gallery of a site work that we ported from one host to another. The issue has been documented and discussed here, here, here and here. We couldn’t wait any longer so I worked out a relatively simple substitute. There were only a few features that I had to keep in mind when thinking of a different solution:

  1. Paging through one video to the next within a category was a must.
  2. Providing a title, tags and description of each video was also required.
  3. On the gallery page display I could use thumbnail images only, because embedding more than one YouTube video on a webpage might cause problems.
  4. The site doesn’t have a lot of videos: 18+4 in two categories, so at this point the solution didn’t have to be hugely scalable.

 

One of the main features of Drupal’s “books” content type is the ability of paging through content, so it was obvious that I had to create my first “book” for this video gallery to satisfy criteria #1. I learned two lessons in “writing” my first book:

  1. Any type of content can be made a page or top page/cover of a book, but you have to put it on the list of “Content types allowed in book outlines” at “/admin/content/book/settings”.
  2. Only published content can be made part of a book. My original plan for this video gallery was to set it all up of unpublished pages, get the client (who has admin rights on the site) to view and approve it and then build out the whole gallery. But I couldn’t do the unpublished beta as part of a “book” so I created the gallery at temporary/secret URL for the client’s approval. Once that happened I finished building the gallery (, unpublished the old one) and specified its URL to be the same as  the old, non-functioning gallery’s URL.

To make sure that criteria #2 is ideally handled I made a custom content type for the individual videos, imaginatively named “Videos”, with only the few fields needed: title, tag, description and I used the default” body” field for the HTML code of the YouTube/Vimeo embedding code. I had to pay to attention to two things with the code:

  1. Getting the correct code: The default code you get on YouTube when you click on the “embed” button under a video has changed recently to an “iframe” solution from the older “object/embed” method. The problem with the new system is that it is possible in some browsers to disable “iframes”, so those visitors who do that would not see the videos on our site. Fortunately the old method is still available, but you have to check the “Use old embed code” checkbox to get it. I also made sure that the other checkboxes are unchecked. (I just read the description of what the “Enable privacy-enhanced mode” checkbox does and in the future I will check that.)
  2. Posting the correct code: I made sure that the text format for the field on our site where I am pasting the code accepts the “object” tag. Otherwise after posting the code Drupal would simply strip it out as it does with every tag that is not explicitly listed as an acceptable one. The default text formats (Plain text and Safe HTML) do not allow the “object” tag as there is a possibility of malicious misuse, so I selected a different text format.

I could have used “Views” to make the main/top gallery page, but in this case it was faster and simpler to do a simple HTML table and paste it in “body” field of the book’s top page. Voila, the gallery is up and running. The only aspect I didn’t like about my solution that below the table of thumbnails is the list of book pages, therefore there is duplication of content. I could have created an appropriately modified tpl.php file, but that would take more time than avoiding this minor visual redundancy is worth. If there is another way to disable the listing of page son the top book page, please somebody let me know. I didn’t find it.

Drupal Learning Journal 18. Field Permissions, Password Strength, Editable Grid

I have been slowly working on several sites and in the process discovered some useful modules.

Field Permissionsallows site administrators to set field-level permissions.

  • Why would you need such a thing? The idea is that certain fields could be viewed by certain roles only. E.g. I decided to add the distributors of the films I am listing at my Jewish Film Festivals site. However I am hoping to come up with a business model where this site can generate some revenue. So one of the benefits for paying members would be the access to the distributors. So I set it that the distributor info only shows up for people with the right role.
  • Yes, I am aware that what I am gathering is freely available on the web, but I am putting a lot of time pulling this scattered information into one central location.
  • The module has only a dev version for Drupal 7, but is working fine, i.e. there is no bug posted in its issue queue. The Drupal 6 version is solid.

Password Strength is a module that administrators can use to “restrict passwords to only be, for example, “high” strength.

  • I thought it was too inconvenient for potential users to of one of the site I was working on being forced to create a password that had to have all of these:
    – at least 6 characters
    – both upper and lowercase letters
    – numbers
    – punctuation
  • With the help of the Password Strength module I could lower the minimum characters for password to four and set the number of rules the passwords have to comply with lower.
  • The module exists only for Drupal 5 and 6.

An editable grid–where content of nodes and their fields are displayed in a table format with the content of each cell editable right there–would often come handy. I’ve seen something like that in Drupal so I thought it is possible with off-the-shelf modules. My first implementation is halfway successful. With the help of the Slickgrid module I have a table where if I click on a cell I get a pop-up layer where I can edit the content. Next time I will want something without the pop-up layer, so I could edit many cells at the same time. Slickgrid works fine (for Drupal 6), but was not what I was looking for. On the plus side it required the Beautytips module, which is a great way to add balloons to any content any where. That’s a good discovery, helpful for explanation or help features.

Drupal Learning Journal 17. Learning OG

Fear is a bad advisor. I have been afraid of starting to work with Organic Groups (OG), because I’ve heard that it is so complex. Before I go further let me share OG’s official description : “[It is a Drupal module that enables] users to create and manage their own ‘groups’. Each group can have subscribers, and maintains a group home page where subscribers communicate amongst themselves.”

My schedule, including my learning schedule was so full the last few weeks that I was afraid of jumping into learning OG, before I knew I could do it with full attention. I was also afraid of OG, because my first encounter with it was at a site where when  my colleagues attempted to install and enable it it messed up the site in some major ways. And you know how first impressions have resulting effects. I hope I can overcome them though.

Finally earlier this week I started the process of learning OG with watching a number of tutorial and informational videos. I did that first because in the past I found that I can learn quite well Drupal related techniques from videos. In hindsight I realize that it was not the best approach in this case. I should have started with how I am doing with less complex modules and projects:

  1. Read the manual/instructions, then
  2. Start playing with it and gain hands on experience.

There are two reasons why I think the “videos first” approach was not ideal for this process:

  1. I didn’t find the ideal video for me that would have shown how to set up OG 7 from beginning to end. Most of them what I found was about the Drupal 6 version and I learned only rather later in the process of watching them that Drupal 7 version is significantly different from Drupal 6.
  2. OG 7’s ReadMe file is so  clear and short that having read that first, the videos would have seen less daunting.

Nevertheless here are the list of videos I watched, with my comments. Only the first two is about/for Drupal 7.

  1. I started with one that our Drupal guru, who fixed what went wrong with out OG installation, recommended. The problem was that I had no idea what I was watching. The title sounded promising: “Organic groups for Drupal 7“, so did  the description of the video, “From the session in Drupalcon Copenhagen, 2010 given by Amitai (Amitaibu) Burstein.” As I learned later Amitaibu is the maintainer of OG, so he is the authority on it. This video is a really funny 19 minutes introduction into the possibilities of what you would be able to do with OG for D7. At the time the presentation was given OG for D7 was not ready yet, so Amitaibu could not demo it. Instead he used his knowledge of world politics and lots of humor about fictional scenarios for groups and assured the audience that for all of the OG will be able to satisfy all of those imagined user requirements. It was good to learn about all those possibilities, but not the ideal introduction for an OG beginner like me.
  2. The “Organic Groups 7” video, that you can watch or download from here, is 44 minutes long and is a presentation by Amitai Burstein. (I recommend downloading he QuickTime version as that has the highest resolution.) With a little digging I found out that it is from February 5 this year. Amitaibu demoed OG7, explained some of the thinking behind the rewrite and compared it to OG6. I will need to rewatch it a few more times, once i started playing with OG, because he gives a lot of examples on how to do things. Excellent resource, even if in the QA part I often didn’t hear the questions from the audience.
  3. This 4 minutes long video, titled “Creating an organic group“, from March 2010 steps you through the process of creating a new group. It is for for OG for D6. It is a fine video with three and a half caveats: 1, it assumes OG is already installed. 2, the resolution of the video is too low and cannot be viewed at a higher one to really see what’s going on, 3 the volume is a bit low (and the half: the presenter’s dialect is occasionally hard for me to understand, but fortunately he spoke slowly enough.)
  4. The title of this 5 minutes long video is quite precise: “How to add a new Organic Group in a standard OG implementation in Drupal” I liked it more than the previous one, because I could watch t in high resolution seemed to go more into the details and because they used a theme for the Drupal installation the site they made the video on was visually more pleasing.
  5. The title of this 8 minute video, “How to use Organic Groups,” should have been appended that it only applies for The Australian Greens. It is a guide from March 2010 for the members (not the developers) of one particular website on how to use the groups they have access to there. To the credit of the person who made the video the title is clear on the video itself, even if not in the text of the YouTube video itself. I wish he would have put a few words of description under the video though.
  6. This 15 minutes long video is from MustardSeed Media, who have a great series of Drupal video podcasts. The good parts: it is free, the presenter covers a lot of territory and the video contains lots of hands on tips. The not so good parts: it  is from July 2009, the presenter talks really fast, he is using Panels in combination with OG and I am not familiar with that yet, he is using lots of theming and retheming in order to accomplish things (i.e. not vie the GUI), they skip basic steps in order to cover only the more challenging aspects of OG6.
  7. Drupal Dojo‘s 18 minutes long screencast shows how the groups.drupal.org was set up with OG and panels. Good show of what could be done in OG5 for a large scale site. Meanwhile it’s good to note that the Dojo site has dozens of god screencasts on all sorts of Drupal topics. even if it hasn’t seen any new one for a while.
  8. DevelopmentSeed‘s blog entry and 13 minutes long video from March 2009 explains how to use in combination with each other three Drupal modules: “Context, Spaces, and Organic Groups“.

The official OG page at Drupal.org links two more videos, but the page they provide a link to moved and I didn’t find on the new site the videos (that based on an assumption of what URL’s “free-videos” section meant) I should have been able to access for free. And I am not ready to sign up for Drupalize.me’s fee based service yet. There are probably more videos out there about OG, but I didn’t find more for free.

Drupal Learning Journal 16. Interests field in profiles

I was asked to make the “interests” field of the user profiles in a Drupal 7 sites pivoting, i.e. a way to enable users to find other users with the same interests. Sounds simple doesn’t it? It wasn’t so.

1. First of all the existing “interests” field contained long sentences that the users filled in. Not exactly easy to “pivot.” OK, we made the decision with the client to have add a new field to the profiles, which would have the list of keywords (interests) that are possible to pivot around.

2. Next decision how to add the new field for these terms? There are two options both had its cons and pros, neither of them are perfect.

A, Add a new field to the account, under “Configuration » Account Settings »Manage fields.” The advantage of this solution is that it allows the new field to be of a “Term reference” type. That means that I can assign a specific Taxonomy to it, e.g. an “Interests” vocabulary to it. This solution would allow free tagging and auto fill, so users could easily add new terms to the list. This also means that each term on the user profile and on the user list page can easily made clickable. Ideal, right? Nope. The problems with this solution are:

  • The location of the new field on the registration page is not standard. On the registration page it would be way under or way above compared to the rest of the fields and even compared to the “Create new account” button. It proably can be moved to the right place, but only by changing the appropriate tpl.php file, not by using the web based UI
  • Same applies to the user profile page. The field created this way would be way below the save button and not under the same tab (in our case “Personal Information”) as the rest of the fields.
  • I don’t exactly recall(, because I went with the other solution), but I think its display was also problematic on the userlist page.

B, Add a new field to the Profile at “Configuration » People » Profiles“. The advantages are clear:

  • Earlier this week I was told by a Drupal guru that the proper way to add fields to the user’s profile is here. He told me this in the context of use trying to make profile fields truly required, i.e. no way for a user to access the site without filling them out. Putting these fields into the other area didn’t make them fully required.
  • The field(s) in the Profile puts them to the standard location and integration with the rest of the profile.There is one major problem with this solution: it doesn’t allow connecting a taxonomy to the new field. My (relevant) options for what kind of filed it can be are checkbox, list selection, free form list. Using  the checkbox option would require me to create a checkbox for every single possible interest: not viable. The list option would allow users to select only one interest: not enough. This left me with the Freeform list. That is fine as long as we regularly synchronize the list and making sure that close variants of the same thing are combined.

3. The next issue is are how to display and link the contents of this new “interests” field on the userlist page. When I started working on this issue the site had a mostly standard Userlist page. It had a few issues on its own:

  • Custom theming was difficult to override/change when developing the list
  • The list was sorted by chronological order of access, putting the user who last signed on to top
  • It was displaying the username. We asked our users to use their full name as username,s but not everybody did, so the list was not as informative as we hoped for.

So I decided the build a new user directory using the “Views” module. The results were mixed.

  • I still have issues with theming in this new directort, but only when I try to display the users’ profile images.
  • The list is sorted alphabetically by name, which makes more sense. I also have more granular access to sorting and paging. E.g. when the bugs in the Views module will be sorted out it will be possible for users to change the default sorting, e.g. sort by countries. Right now there aren’t a lot of users so I left the number of users displayed on a screen unlimited. But when we’ll have much more users I can set that number to anything we want to, e.g. 50 or 100. (and users will be able to page through the userlist by looking at 50/100 at a time and using pagination links to move on.)
  • I can set whatever field I want to be shown on the userlist. (This applies to both kind of userlists, but the lack of theming works better on the new one.)
  • There is a “Members” link in the breadcrumb to go back to the full list when looking at the sublists (e.g. members from a certain country.)

4. The last issue, closely related to the previous one, is how to display and link the content of this new “interests” field on the individual profile pages. Right now, in both directories clicking on the a country or an interest takes you to a page which lists the appropriate users in the old style, standard directory. This is obviously not ideal for the new Views based directory, but I ran out of time on trying to figure out how to create a userlist page just for a people from a  certain country or people interested in certain topics. I strongly believe that the Views based directory is better, but without fixing this last detail (and the theming) we may not be able to make it work.

As I ran out of steam and ideas I called in my colleague to help and curious how he will solve the above.

Drupal Learning Journal 15. Panels

Last week a client asked me to split vertically the first, sticky entry on a Drupal site for logged in users and put replace the right side with a nature image. My immediate reply was that I don’t know how to do that. (So, instead of creating a new block for the image I just placed the image straight into the right side of the existing entry. The effect is almost the same: an image appeared where the client wanted it.)

Meanwhile at the back of my mind I was aware that this is exactly what the minds of Drupal contributors created “Panels” for. Here is the current official description of what this module can do for you,

The Panels module allows a site administrator to create customized layouts for multiple uses. At its core it is a drag and drop content manager that lets you visually design a layout and place content within that layout. Integration with other systems allows you to create nodes that use this, landing pages that use this, and even override system pages such as taxonomy and the node page so that you can customize the layout of your site with very fine grained permissions.

On the same day I also reached chapter 15   in my “Beginning Drupal 7” book, the one that is dedicated to Panels. Theoretically I should be able to do Panels, now, because based on the book’s description it seems logical and as simple as possible. However I know that it is complex enough that for my first try should not happen on a live client site. Furthermore, I have this unchecked assumption that doing panels for the front page and noly for one set of users (logged in) is not the simplest Panels setup. I cannot even check the validity of the assumption, before I learn more about Panels. Maybe I should do something simpler first. I have something in my mind, just need to find the time to play with it. So for now I am just putting this post up as a reminder to learn Panels. Here are some resources to do that:

BTW. Panels is in alpha for Drupal 7 and right now has 22 active bug reports

Drupal Learning Journal 14. Nice Menus

A few weeks ago I was involved in moving a Drupal 7 site from a host where D7 was available for users when while it was still in beta to another commercial host, which was one of the first one to offer it, when D7 came out of beta. Unfortunately, lots of features and aspects of the sites got broken with the move. Some of these went down because when the files were copied to the new server their permissions got lost. Others because the tech support of the new host didn’t have enough clues how to migrate a D7 site.

Yet other issues came to surface because the original host had a funky way of handling a few features, e.g. the theming/CSS customization was handy, but not standard. I think the fact that our expandable menus were no longer expanding at the new host was due to a combination of permission and overcustomized CSS issues. I am not sure, because I never managed to figure out the real reason, we eventually asked a Drupal guru to fix it for us.

Before calling in the big gun I tried to fix the menu and realized that it was a custom CSS/javascript code. I was surprised to see that, because I knew of the Nice Menus Drupal module, which is dedicated to do exactly this. Looking into its history I see that its first beta for D7 came out on October 26. I don’t know whether the first version of the site in question was built before or after that date, so maybe it was not available yet back then yet.

I attempted to fix the custom coded version, but my limited knowledge of CSS and Javascript, prevented me from finishing it. So I installed the Nice Menus module and attempted to recreate the menu. I had mixed success. The menu worked, but a, it didn’t exactly follow the look and feel of the original, b, when expanding (down) it pushed down the content of the rest of the page. I tried to use z-index and overflow, but couldn’t overcome the problem. Hence the help of the drupal guru was required.

Meanwhile I started to create my own first D7 site, where I also wanted to use expanding menus. The installation and configuration went without a hitch, so the menus worked out of the box. The only problem was that it was using the default CSS that came with the module and not my theme’s. I am using the MAYO (“MAke Your Own”) theme with one of the preset color themes and header image. It works great and I will do some customization, when I am ready to market the site. Right now I am still building it.

To cut the description of the troubleshooting process short this is what I had to do to make the Nice Menus using the MAYO’s CSS:

  • Use the “Nice Menu 1” block,
  • set the “Menu Parent” option  for “Main menu”
  • under the region settings set the “MAYO (default theme)” option for “Menu bar”

BTW: I found the name for the animation feature of nice menus funny: Superfish. It can be set under Home » Administration » Configuration » User interface » Nice menus

Byron….: Using Drupal (2008)

I never reviewed a technology book before that I studied from. All the books I wrote about have been either fiction or non-fiction that I read or studied for my school. But I didn’t have any formal schooling related technology, at least not on the coding level. (We did some basic HTML and XML when I studied for my MLIS, but by the time I got there I knew all that.) So when I sat down to write a “review” about Using Drupal* I realized that I have to use different criteria than usual for my reflections.

When judging a tech textbook first and foremost I should assess what I have managed to learn from it. The answer in this case is a tremendous amount. Right now though, I don’t know how lasting my learning will be. That will depend on how much work I will be doing in Drupal and how much I retained in the first round of studying. As it was a library book, i.e. I have to give it back tomorrow, I tried to take as much note as I could. Nowadays I try to put every informational on the web, except confidential pieces, so you can find my notes on my blog here: chapter 2, 3, 4, 5, 6, 7, 8, 9, 10, and 11.

I think that studying the book was very useful for me. I wasn’t a total novice in using Drupal 6, so I can’t say I learned everything I know from it. But I can say that my knowledge feels much more grounded now. And there was plenty of new information, tips, trick, modules for me in there. I enjoyed the clear style of the writing, the detailed explanations, the description of the processes and the screenshot that helped me along the way. My only regret was that halfway through the book the site accompanying the book went down and I still cannot reach it. I hope usingdrupal.com will come back, so I could reuse the code snippets from the book, without having to type them in.

The book had a lot of authors, most of them are members of the team at Lullabot. Let me spell out all of their names, that I  couldn’t do in the title of this post (hence the ellipsis there): Angela Byron, Addison Berry, Nathan Haug, Jeff Eaton, James Walker, Jeff Robbins. Thanks to all them making for putting together an excellent resource. Too bad that by the time I was done with the book, that covers Drupal 6 , Drupal 7 came out and now I can start the process (almost) all over again.

Here is the official descrption of what Drupal is: “a free software package that allows anyone to easily publish, manage and organize a wide variety of content on a website.”

The book @ Amazon

Drupal Learning Journal 13. “Using Drupal” – Chapter 11 – Theming

Chapter 11 of Using Drupal, is ab out theming which assumes working knowledge of PHP and CSS. I have the former, but not the latter (yet). This the time, when I wish I could keep this library book longer. But somebody has it on reserve, so I had to relinquish it in 3 days. As I didn’t have time to play with what I learned form this chapter and because this is the chapter that contained the most newish information I am afraid I may forget. Nevertheless here are the notes that may or may not trigger my memory later when needed.

  • List of variable available for templates is at: http://drupal.org/phptemplate (Page 397)
  • The Devel module has a “Theme Developer” segment. (Page 398) (D7 versions exists.
  • The code example on page 399 shows where the breadcrumb is in the page.tpl.php file and how to move it.
  • The code example on page 401 explains where the the “submitted by” and “taxonomy” info is and how to move it on the node.tpl.php or node-story.tpl.php files.
  • To understand how to override variables and functions in the theme’s template.php file read this page. (page 405)
  • All variable go through the preprocess function. One can crate a mytheme_preprocess_page function. Here is the info on how to override them. (page 406/7)
  • “Snippets” are bits and pieces of Drupal code that people have found useful and wish to share with the community. They are available here. (page 411)
  • Theme snippets are here and mini modules for D6 are here.

Drupal Learning Journal 12. “Using Drupal” – Chapter 10 – Online Store

I finally reached Chapter 10 of Using Drupal, where I can learn some of the secrets of how to set up an e-commerce site/online store, with the help Ubercart. I started to work on a site a few months ago, but had to abandoned. Hopefully after reading this chapter I can go back to it. I will be taking more notes as usual, so I could go back checking it even after I gave back the book to the library.

Ubercart (UC) modules (page 342):

  • Cart – including checkout
  • Conditional actions – for taxes and shipping
  • Order – ordering, invoicing, hooks for fulfillment
  • Product – available items
  • Store – management interface
  • (optional) Core (page 344)
    – Attribute – product variation
    – Catalog – categorization
    – File Downloads – digital products
    – Notify – email to customers
    – Payment – framework for Test Gateway, Payment Method Pack, recurring Payments, Credit Card
    – Report – sales reports
    – Roles – turning customers to members
    – Shipping – calculating shipping costs, generating labels, creating tracking numbers
    – Shipping Quotes
    – Taxes – rule specific
  • Extra (page 348)
    – Cart Links – to construct URLs that will add certain quantities of specified products – to be use don external sites for “buy now” links.
    – Importer – does export/import of UC data
    – Product Kit – grouping products to be sold together
    – Repeater – Update product info on remote UC stores
    – Stock – tracking and managing stock levels

Mixed tips and reminders

  • Each product class has its own specific properties; they need to inherit the base product field (page 354)
  • Check for “Vocabulary Catalog has been identified as the Ubercart catalog” at Store administration or do it by hand at store admin -> config -> catalog
  • “Continue shopping link URL” can be set (for “catalog”) at Admin -> Store admin -> Config -> Cart setting
  • Shopping Cart block (e.g. for top left)  can be set up at …blocks

Payment/encryption (page 369)

  1. Add the test gateway payment method at Admin -> Store admin -> Config -> Payment setting -> Payment methods
  2. Create “keys” directory for encrpted CC datae that is not web accessible, e.g. /home/username/keys
  3. Make it temporarily writable (a+w)
  4. Expand the “credit card settings” fieldsate and enter the path for “Credit number encryption key filepath”
  5. In the checkout workflow” section ensure that “Attempt to process cc payments at checkout” is checked
  6. Enter additional info at “Check settings”
  7. reset keys permission to a-w

Permissions (page 375):

  • “view cc details”: OK for editor
  • “view cc numbers” (last four): only for admins
  • “delete any order”: for admin only: it can remove already completed  orders

The Secure Pages module will “redirect the required pages to a SSL version of the page.” (Page 377) Drupal 7 version is in dev.

Drupal Learning Journal 11. “Using Drupal” – Chapter 9 – Event management

Chapter 9 of Using Drupal is about event management. Instead of using the Event module they authors went for the using CCK with Date and Calendar modules (both under active development for Drupal 7). Here are my learning points from the chapter:

  • The Signup module is designed for tracking event attendance. (Page 313) I found no mention of a possible Drupal 7 version.
  • Process (Page 314-328):
    1. Create a new “Event” content type,
    2. Understand date (timezones, field types, widgets and settings)
    3. Add configured  Date/Time field to the Event content type.
    4. Build an “upcoming events” view
  • The Calendar module provides a new view type (Page 329)
  • Use the Flag module for attendance, by creating a new “attendance” flag. (Page 333)
  • Create an “Attendees” view. (Page 334)
  • Additional useful ideas (Page 336)
    – The Countdown module adds a block that shows the time left until an event. (Drupal 7 version is in alpha.)
    – Create Flag actions (part of the Flag module) to send emails, unpublish/delete nodes.
    – The Location and GMap modules et people use a Google map to select the location for each event. (Both are in dev for Drupal 7)