Archive for February 15, 2011

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