Thứ Sáu, 13 tháng 7, 2012

Creating A Custom Page Using Panels

This video shows you how to create a custom page for your site using the Panels module. You can use Panels to help you make pages (including a front page) that include a variety of content from your site including content that exists in views, blocks and nodes. The Panels module is dependent on the Chaos Tool Suite module.

Note: Click the 'full screen' icon (to the left of the volume control) in order to watch online at full 1280x720 resolution.

Video Links

View the original article here

Take Big Action With Views Bulk Operations

Printer-friendly versionPDF version

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. 

Exposed filters which allowed me to narrow down the list of nodesThe actions to take which should be consistent with my Bulk Operations settings choicesThe 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.


View the original article here

Thứ Năm, 12 tháng 7, 2012

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

Printer-friendly versionPDF version

 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.


View the original article here

Running Cron On Dreamhost

This short video shows you how to create a cron job using the Dreamhost web panel that will allow you to execute cron on a Drupal site. As I have noted previously execution of the cron file is an important task for any Drupal site. Many modules rely on cron for periodic processing of data including the core search and aggregator modules. Running cron also prompts the system to check for module updates. 

Here's what I entered in the video. Be sure to replace the url with url of your site. wget -qO /dev/null http://yoursite.com/cron.php

This video is one in a series of videos I created called Getting The Most Out Of Dreamhost. If you're a current Dreamhost customer you probably already know how to do things like set up a domain or create a MySQL database so it may not be relevant to you. If you're considering Dreamhost I think the series offers a very good preview of how the web panel functions make it easy to launch new Drupal sites. There's also a discount code (LEARNDRUPAL2010) on that page that will save you $50 on a new Dreamhost web hosting account.

Note: Click the 'full screen' icon (to the left of the volume control) in order to watch online at full 1280x720 resolution.

Video Links

View the original article here

Managing A Drupal Site On The iPad

Printer-friendly versionPDF version

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.


View the original article here

Adventures In Authentication

Printer-friendly versionPDF version

A Capital Region Drupal meetup (the first of its kind I believe) is scheduled for March 6th and I hope to be able to talk about authentication and identity. Just a couple of years ago the issue of authentication and identity on Drupal sites was limited to the functions of the Drupal login system. I remember that the first module I ever utilized to improve the login process was LoginToboggan. LoginToboggan adds such nifty features as logging in with name or email address, placing a login form on pages not accessible to anonymous users and much more. It's a great module and I still use it today. Since then we've also seen a few social networks like Twitter and Facebook increase greatly in popularity. So while millions of people create accounts on those services they may not necessarily want to create an account (and have to remember another password) on your Drupal powered site.

Lucky for us Drupal site builders that the big social networking players realized that in order to get even bigger they would need to reach out to other sites. They have done so via APIs such as Facebook Connect, the Twitter API and Google Friend Connect. All three of these services allow someone to login to a website with their credentials from each of these services. So this allows people to log in to your Drupal site with their identity from Facebook, Google, or Twitter. Pretty cool, eh? All you need are the modules that make the connection between your site and these services.

Modules do exist for each of the three services mentioned above. Facebook Connect, Twitter, and Google Friend Connect all allow you to authenticate users to your site. They require varying degrees of technical expertise to set up and the exact functionality varies too. The good part is that they all seem to excel at verifying the identity of an anonymous visitor to your site, at least temporarily. The bad part is that they really don't fit in with the normal Drupal account creation process. If you're just looking for someone to be able to authenticate temporarily to add a comment they work great. If you want someone to be able to quickly create a full account, with access to all of the features of your site, with Google, Facebook or Twitter credentials then the modules fall short. What seems to work best is a hybrid approach where a user first creates an account on your site and then later connects to their account on the social network. After that they can log in with one of these services (provided you add the right links) and get all the benefits of a member of your site.

Earlier I mentioned varying degrees of functionality. Besides authenticating users these modules can do some publishing back to social networks as well. Facebook Connect will publish a link to a comment to an authenticated user's wall on Facebook. It will not publish to the wall when a new node is created though. The Twitter module will post to the wall when you add a new node but not when you add a new comment. The Google Friend Connect module will publish and update a site's "social bar" when you add a node or comment but it's not clear to me where else this activity shows up. What would be nice, and what I hope to see at some point would be for each of these modules to have similar functionality where users could choose to share a variety of activity on the site they logged in with.

The issue of account creation is also an important one. In order for these modules to be very useful they really need to fit in well with the standard Drupal account creation process. At this time they do not. One possibility would be to be able to assign people authenticating via a social service a certain type of limited role while capturing the minimum amount of information (such as username and email address) to create an account. Then generate an email that invites the person to return to the site and fill out a full profile. 

One other issue worth noting with the modules mentioned involves the placement of login buttons. Both the Twitter and Facebook modules add a button to the page at /user/login and to the login block. The Friend Connect button adds a button just above the comments but nowhere else. You can also use a snippet of code to place the Facebook and Twitter buttons where you want although the code isn't specifically made available. I just grabbed a snippet after viewing the page source html. I have been unable to do the same thing with the Google Friend Connect button. Examples of login placement are shown below.

Facebook and Twitter Login

Facebook and Twitter Login

Google Friend Connect Login

Google Friend Connect Login

As you can see there are various differences and shortcomings with these three modules. In order to really have a positive impact on site membership I think they need to be more flexible (placement of the login buttons for example), more integrated with the Drupal account creation system from the start and have consistent publishing functionality. There are other options available if you want something that is "plug and play."

If you just want to authenticate for comments and offer cross-publishing you can add the Disqus module which utilizes the service of the same name to manage commenting. In order to use this you need to turn off Drupal comments and you also lose the capability to search comments. Also keep in mind that Disqus does not create accounts on your site either. For account creation there is the Gigya Socialize module which integrates with the Gigya service. I have tested the Gigya module a little bit but I'm a bit concerned about running user data through the servers of another party besides my site and the one that the user is authenticating from. If Gigya goes down or has performance issues then it could prevent logging in or registering on my site. The same things goes for the Disqus service. There's also the issue of terms of service. I noticed the following in Gigya's terms of service for the socialize module in section 3, paragraph b.

End User Content. You retain all rights in your End User Content. However, by uploading, posting, submitting, linking to or otherwise transmitting any End User Content on or via the Site or Service, you hereby grant to Gigya a non-exclusive, worldwide, royalty-free, sublicensable, perpetual and irrevocable right and license to use, reproduce, modify, distribute, prepare derivative works of, display, publish, perform, transmit and access your End User Content in connection with the Service and Gigya’s (and its successors) business including, without limitation, for promotion and redistributing part or all of the Service (and derivative works thereof), in any media formats and through any media channels. 

I'm not completely comfortable with those terms. Gigya is well within their rights to set those terms since they are offering up free technology and computing power. As a site builder I would prefer to not expose myself or my community members to the possibility that their content could be published elsewhere. You might feel differently and in that case Gigya's service might work pretty well for you.

I think that it's important to discuss and ultimately create solutions for the issues discussed in this post. In fact I recently posted a bounty on drupal.org for a unified social authentication module. The bounty offer still stands. I'm also open to funding bounties for improvements to the individual modules as I have offered on in the Google Friend Connect issue queue. There are other discussions about this that I am aware of. The discussion called Social networking accounts: unified approach to store in external account data in user content profiles? covers some of the same issues I mention here and even mentions the fact that there is no module for LinkedIn. That's where I first say the Post It Everywhere module which is geared towards making authenticated cross posting easier. This module doesn't handle the sign up though. So there's still fragmentation.

All of this is a lot to digest. And I think it's too much to ask for one solution that does everything. After all, the meaning of everything changes as new social services and new functionality appears. It's an important discussion that I hope will lead to some better functionality soon. I'm going to do my part by talking about it, exchanging ideas and perhaps devoting some funds to help developers bring the features closer to what I would like to see.


View the original article here

Albany Drupal Meetup Notes

Printer-friendly versionPDF version

The first quarterly (hopefully ) Drupal meetup for the Albany, NY group took place last Saturday. Seven people from the upstate New York area attended and there was a lot of really good discussion about Drupal. Here's a summary of some of the things that we discussed.

Drupal for Educators

One member of the group was interested in using Drupal in an education setting. There was a discussion of whether or not Joomla or Drupal would best meet this person's needs. It's not surprising that we all felt Drupal was a great choice. That said I think it's important to be able to clearly and concisely make the value proposition for Drupal vs. other platforms such as Joomla and WordPress. Like anything else if we want Drupal to grow in a competitive environment then we need to know how to sell Drupal.

I recommended joining the Drupal in Education group for active discussion with people who are using Drupal for education on a daily basis. I also recommended checking out Moodle Integration which can add learning management features to a Drupal site. After the meeting I also discovered another Drupal 4 Educators site. There are also plenty of sites to be found via a Google search on "Drupal, Education."

Authentication and Identity

This was a topic that I initiated and lead the discussion on and it was inspired by my recent post about my Adventures in Authentication. This is a topic that everyone is interested in but for different reasons. From an educational point of view it seems that Facebook authentication is most important. There's also the issue of schools only wanting verified students and teachers to be able to sign up. Both security and process are very important. My needs are more general. I want to widen access to site features, build community and also cut down on spam and trolls. 

One very good point was made about consistency of the various APIs made available by the social services. It's hard to have consistent authentication and sharing functionality across services (Twitter, Facebook, Google, LinkedIn, etc.) because of differing API functionality. So while you may need different code in order to connect with each service you will also have different feature sets made available. 

Multi Site Support

I have received a number of queries on this site about how to run multiple domains off of a single Drupal install. This is something you might do if you have yoursite.com and want to also add community.yoursite.com, and allow visitors to have the same account across both sites. The Domain Access module was mentioned as a very good module to use for this purpose. A recent Lullabot blog post shows you how to do it without using a contributed module.

Code Management

Code management is very important for those who are managing very complex sites and maintaining multiple environments. For example, a site administrator might have environments for development, test and production. It's a challenge to keep track of code in those situations. The challenges become even greater when you have multiple sites to manage with multiple environments for each site. Drush was mentioned as a tool to help streamline the module update process. I'm drawing a blank on some of the other tools discussed (Note to self: Take notes next time!) but I found a discussion on Drupal groups called Code Deployment and Build Management that includes a few links to useful contributed modules.

Other Topics

The subject of hosting was discussed and most agreed that shared hosting is for the birds. People differed on their preference for hosting providers. Nothing new there. Virtual Private (or Virtual Dedicated) Servers are coming down in cost (Media Temple, $50/mo. | Dreamhost, $25/mo.) and the performance improvements are worth it. When talking hosting I mentioned Acquia's Drupal Gardens which is now in private beta as an option for those who want to get started quickly with minimum technical knowledge. I also introduced the group to the newly released Fusion themes for Drupal. I am using Fusion/Skinr/Acquia Prosper on Learn By The Drop and the combination has really been awesome in helping me organize and redesign the site.

Final Thoughts

Communicating with the world online is great but these offline (aka face-to-face) interactions are so crucial for networking, community building, and knowledge sharing. So I want to thank Julie Johnson from the Kinderhook Memorial Library for organizing the gathering. It's really worth the time that people put into planning and attending these types of Drupal events so consider organizing or attending one in your local area if you have the time.


View the original article here