Home

Primary links

  • top o the deck
  • Drupal for Beginners
  • about
  • links
  • give me some sugar

Drupal stuff

  • EDAM
  • STARDOM
  • Question Bank
  • Drupal musings
  • Drupal tips
Home

Key stuff on this site

Easy Drupal Admin Manual (EDAM)

SEO, Traffic and Revenue: Drupalace's Online Manual (STARDOM)

Drupal for Beginners

Subscribe to posts by RSS or email

Subscribe to Drupal Ace by RSS feed RSS feed 

Subscribe to Drupal Ace by Email

Donate towards my web hosting bill! Get a great host!

Share and save

Share/Save

Random piece of content

!How to hide a node title?

Manuals on this site

  • Easy Drupal Admin Manual (EDAM)
    • Welcome to Your Site
    • First Steps: Please Read!
      • Understanding These Instructions
      • Important Terminology!
      • Best Practices for Site Admins
    • Super Quick Guide (for the experienced and the brave)
    • Logging In
    • Your Administrator Tools
    • Setting Site Basics
      • Setting Site Information
      • Configuring Your Theme
    • Creating Content
      • Node Types
      • Create a Page Node
      • Create a Story Node
      • Create a Blog Entry Node
      • Making Images and Other Files Available
      • Using Text and Image Editors
    • Organizing Your Content
      • Terms, Vocabularies, and Taxonomy: "Tagging" Your Content
        • Taxonomy Suggestions
      • Menus, Links, and Paths: Navigating the Site
        • Content Paths and URLs
        • Creating Links
        • Working with Menus: Administration Form (Drupal 6)
        • Working with Menus: Administration Form (Drupal 5)
        • Creating Menu Items on the Fly
        • Placing Menus on Your Pages
      • Placing Content on pages
        • Creating a page from a Single Node
        • Creating a page from a List of Nodes
        • Setting the Front Page
      • Working with Blocks
    • Maintenance Stuff
      • Maintenance and Construction Notices
    • Other Fun Things
      • Changing Color of Garland Theme
      • Free Aliases!
  • SEO, Traffic and Revenue: Drupalace's Online Manual (STARDOM)
    • Set a Clear Goal
    • Make a Good Site
      • Put out the Welcome Mat
      • Make Great Content
      • Build a Great Brand
      • Make Navigation Easy
      • Tune Site Performance
    • Drive Traffic
      • Promote your Site
      • Get Found with SEO
    • Build a Community
      • Build an Offsite Community
    • Monitor and Improve
    • One-Page Checklist
    • Drupal and the Blogging Starter Checklist
      • Drupal and the Blogging Starter Checklist, Part 1
      • Drupal and the Blogging Starter Checklist, Part 2
      • Drupal and the Blogging Starter Checklist, Part 3
      • Drupal and the Blogging Starter Checklist, Part 4
      • Drupal and the Blogging Starter Checklist, Part 5
      • Drupal and the Blogging Starter Checklist, Part 6
      • Drupal and the Blogging Starter Checklist, Part 7

Recent comments

  • It worked

    adding $GLOBALS['tempUser'] = $user; worked but I find it worth noting that I had to delete...

  • very good document...

    very good documentation for beginners!!!!!! thanks!!

  • del penitential 62

    strike out abject
    eliminate penitent 5

  • Chat

    Thank you a lot about very beneficial to my work was very useful thank you

  • Drupal Resources f...

    I would start learning from the "Diving In" section above. That links to the good beginners'...

more

Drupal Tutorial: Make Custom Fivestar Graphics

  • article
  • Drupal
  • modules
  • how-to

Okay, experts, stop snickering. Yes, the procedure for making custom ratings "stars" for the Fivestar module is pretty darn obvious to anyone who peeks into the module's files. But it doesn't come with those instructions, and I could have saved a little time had there been a few how-to notes.

For the newbie wanting to tackle an easy customization project, this is a good one. You'll add those spiffy "rate this page" stars to your nodes – with said stars being smily faces, check boxes, butterflies, or anything else completely unique to your site alone.

Even stars like mine: the winking offspring of the Drupal icon and the ace of spades.

What's Fivestar?

Fivestar is a simple module that adds a nifty "rating star" widget to your nodes. The module displays a number of stars that you set; a single click from by a reader rates the page with that number (i.e., casts a single vote for that number). You can view the average ratings over all viewers, and find out how popular that node is.

To see an example, look no further than the bottom of this page. See the spade-shaped "stars"? Note the smooth rollover action, courtesy of jQuery. Click, and see your "vote" cast without a page refresh

In addition to adding a bit of "speak your mind" fun for visitors, the significance of the Fivestar rating for a webmaster is obvious: a high rating means "more of this, please!", and a low rating, "no more, thanks".

There are other ways to rate nodes, but Fivestar is one of the quickest and easiest ways to add the feature.

Ah, Fivestar. If you were Tenstar, you'd go to eleven.

Get ready

Installation

Find the module here: http://drupal.org/project/fivestar

Download and install per the README file.

Per that file, note that you'll need to visit three admin locations to fully enable Fivestar:

1) The main Fivestar configuration page. All you set there is choose the sitewide style for stars.

2) The content type page for every node type on which you want the stars to appear. Plenty of options there (though none to change star appearance by node type), all of which are obvious. I missed "Allow users to undo their votes" for a while; without that checked, users who click once on a rating have no chance to undo the choice. With the option checked, users see a "delete" graphic in addition to stars.

3) Access Control. It's always a good habit to visit Access Control after installing any module; there's often a permission to enable before things work as you expect.

Check that everything works. If so, you're ready to customize.

Make me a star!

Ready for the fun part?

1) Open the module and find the folder "widgets". You'll see "hearts" inside, one of the included star designs; let's create new stars from a copy of that.

2) Copy the "hearts" folder to your computer. Rename the folder to a descriptive name for the stars you'll make: "aces" in my example (for my spade-shaped stars).

3) Delete "heart.gif" and "heart_broken.gif" from the folder; we'll make our own replacements for these graphics.

4) Create your star graphics: three images, each 16x16 pixels. Stack them vertically into one new graphic, 16x48 pixels.

The top image is the "no rating" image; a pale or B&W image works well. The middle image marks the rated stars; a colorful image works well. The bottom image is the roll-over image; use something that stands out more than the top image, but less than the middle image.

See the images in the "default" or "hearts" folders for examples.

Name your new 'star' graphic file whatever you like, and save it in the folder we're working in.

4) Create two 16x16 pixel delete images, for users who cancel their ratings. Stack them vertically into one 16x32 pixel image.

The top image is the default image; pale works well. The bottom image is the rollover image.

Name your new 'delete' image file whatever you like, and save it in the folder we're working in.

(Another choice: if you don't see a need to make new graphics for this purpose, just do what I did: copy the delete.gif file from the "default" folder. I'm happy with that.)

5) Edit the .css file in the folder. Change every instance of "heart.gif" to the name of your 'star' image file ("aces.gif" in my case). Change every instance of "heart_broken.gif" to the name of your 'delete' image file ("delete.gif" in my case).

Save and close. Change the name of the .css file if you like.

The contents of my "aces" folder:

stars

6) Upload your new folder to the fivestar/widgets folder in your Drupal installation. Go back to the Fivestar administration page, and you should see your new stars among the offerings.

The finished result:

stars2

And that's all there is to it. Any questions?

 

Share/Save
  • Printer-friendly version
  • Quote
Unknown Drupaloid's picture

five star problem

Submitted by Unknown Drupaloid (not verified) on Thu, 2010-03-04 16:23.

 i want change This

Average :

stars image( its shown default)

 

but i want change that like this

 

Average: star image

both are one line

please...

  • reply
  • quote
Drupalace's picture

Fivestar layout

Submitted by Drupalace on Tue, 2010-03-09 18:10.

You want to put the label "Average:" and the following stars all in a line? It's not something I've looked into, but I would think it's very doable by tweaking the CSS. There are several CSS files within the module folder, and a possibly helpful posting at http://drupal.org/node/228271 .

Any luck in figuring out what to tweak?

  • reply
  • quote
New Drupaloid's picture

Is there a way to edit the

Submitted by New Drupaloid (not verified) on Thu, 2010-02-18 06:25.

Is there a way to edit the text/name assigned to each star rating? For instance: "poor" changes to "terrible." Sorry if there's an obvious answer; I'm very new to this.

  • reply
  • quote
Drupalace's picture

How to edit Fivestar labels

Submitted by Drupalace on Sat, 2010-02-20 14:52.

There sure is a way, though it's not in the first place you'd look (the Fivestar admin page). 

Head to admin/content/types, choose "edit" for a given content type, and on the resulting form you'll see a "Fivestar ratings" section. Under there is a "Star labels" section; that's where you can change the rating names. 

You have to do this separately for each content type you want to customize. On the other hand, the ability to set up Fivestar differently for each content type, should you want to, is a nice thing!

  • reply
  • quote
Lirix's picture

Thank you for the helpful

Submitted by Lirix (not verified) on Mon, 2010-02-15 00:16.

Thank you for the helpful Tutorial! Now Its very easy to make new graphics!

 

Thx a lot

  • reply
  • quote
IsabelG's picture

Thanks; it was very useful!

Submitted by IsabelG (not verified) on Wed, 2009-11-04 19:06.

Thanks; it was very useful!

  • reply
  • quote
Unknown Drupaloid's picture

Re: Drupal Tutorial: Make Custom Fivestar Graphics

Submitted by Unknown Drupaloid (not verified) on Thu, 2008-09-04 00:15.

thanks great tutorial !

  • reply
  • quote
Tranzactii imobiliare's picture

reply

Submitted by Tranzactii imobiliare (not verified) on Tue, 2008-04-01 01:41.

If you're a graphic designer you could use more nice sets of stars to include with Fivestar.Fivestar works best with the latest stable release of Drupal 5 or 6.

  • reply
  • quote

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><br><p>
  • You may quote other posts using [quote] tags.
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options


Relevant Content

The Drupal Ace logo has dealt these content suggestions from the deck.

  • Why would Color-enabled themes work for all sites but one?
  • Limiting node access: three quick'n'easy tools
  • Dumb mistake #27747: Wrong module version
  • Putting Seth Godin to work
  • Sweet module love: the What Would Seth Godin Do? module
  • Find and rate Drupal modules
  • Working with Menus: Administration Form (Drupal 6)

Learn Drupal, hands-on

Get the beginner-friendly ebook that teaches community site building via a live case study.

Drupal 6 Ultimate Community Site Guide

Read the review

Drupal mini tip

Site visitors seeing your ugly error messages on the screen (along with details of your Drupal installation path)? Once your site goes from dev to launch, you probably want to have errors recorded in the log but not splashed across the screen. Head to the handy Error Reporting settings found at admin/settings/error-reporting. 

It's a deal!

Dreamhost dealsDrupal Ace presides over his domain, proudly ensconced in his DreamHost eyrie. Won't you join me?

Promo code deal!

Just enter the code 49ER when you register for an account, and save $49 off the already-low price. No strings!

Read my hosting service review

Powered by Drupal, an open source content management system

Copyright 2007 and forever after. Made with Drupal, of course. On OS X, of course. Served up by DreamHost. DreamHost

RoopleTheme