Time dependant user selection

dRaz - October 24, 2008 - 14:45

Here is what I am trying to do:

Every week I would like a user to be randomly selected as an "In the spotlight" member.

This would be in the form of a block which simply displays the username of a randomly selected user which doesn't change every time you refresh, but once a week.

So far:

I have created a block called "random" using views which selects a random user from a certain role type and displays the username.

This is what I am looking, but the selected user obviously changes every time I refresh the page. How can I achieve the "once a week selection" that I need?

Many Thanks.

Shaun

I think you'll have to store

Barrett - October 24, 2008 - 15:06

I think you'll have to store the selected user and the date they were selected. Then the script's first action when kicking off would be to check the date the currently selected user was picked against the current date and either select a new user or display the currently selected user, as appropriate.

Or you could separate the display from the picking and set your block to just display the currently selected user and have a separate function tied into the cron hook that picks a new user when appropriate. That may be the better way to do it.

I haven't looked but I wouldn't be surprised if there there's a module already built to do this.

Appreciate the reply. The

dRaz - October 24, 2008 - 15:11

Appreciate the reply.

The first part went totally over my head I'll be honest. I wouldn't know where to start.

I have searched high and low for an existing module but it looks like there is no such thing. The closest I could find would be the competition module but this seems to have been suspended with no port to d6.

Yeah, I'm shocked, but there

Barrett - October 24, 2008 - 15:24

Yeah, I'm shocked, but there doesn't seem to be a "Spotlight/Featured Content" type module. At least not that I could find.

Anybody else know of one? Or another/better way of doing this?

there is the

WorldFallz - October 24, 2008 - 15:29

there is the http://drupal.org/project/daily module-- perhaps it could be adapted.

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

That's not a bad shout, I

dRaz - October 24, 2008 - 18:10

That's not a bad shout, I will install it and see how close it comes to what I want.

Cheers.

 
 

Drupal is a registered trademark of Dries Buytaert.