I would like to be able to test the banner to ensure that it displays in a way that looks appropriate for my site... is there a way to do this?

Comments

mgifford’s picture

It's enabled by a block and blocks can be restricted to particular roles, so you can certainly do this.

Setting it up so that the view is exposed only to a particular role would do it also (and could be done by adding in user_access('view earth hour'); into the earth_hour_block() function). However that would make it harder to set up. Best to just use the blocks to do this I think.

Might also be useful to set up a test mode to display what the site will look like when it is disabled. Maybe a link in a configure page that would display a page that is what the users will see.

Could see about changing this next year, however earth hour is starting in a few hours in some parts of the world, so don't want to be rushing to put out a new release.

I do like the idea however and there will be other events where a countdown like this is useful to raise awareness that this could be applied to.

pumpkinkid’s picture

Right the configuration page method is the way I was hoping for, I just wanted to trigger it and ensure it would look right when Earth Hour Started!

Thanks for the module btw!

mgifford’s picture

Maybe we could put in a 30 second test button for the current user.

pumpkinkid’s picture

Actually, I guess now more importantly is, how does the March 26, 2011 date fit into this module? do we upgrade just to change the date it is to trigger?

mgifford’s picture

I haven't looked at this code in a while, but I took out any hard coded dates in it. It should all be auto-generated. There shouldn't be a need to upgrade the module ever year, unless we add a new graphic or find a security problem with it.

With the upgrade to D7, I'm hoping to add a function to allow folks to more easily test this as I outlined above. Give folks more confidence in what it will look like in Earth Hour.

pumpkinkid’s picture

Very cool, but how are you having the code generate the date? Last year it was March 27th, this year its March 26th

mgifford’s picture

There is probably a more elegant way to do it, but I wrote (or possibly borrowed) this function:

/* 
 * get day for earth hour for each year
 */
function earth_hour_find_date() {
  $year = date('Y');
  $last_day_of_march = date('D', strtotime(date("$year-3-31"))); 
  $days_array = array('Mon' => -2, 'Tue' => -3, 'Wed' => -4, 'Thu' => -5, 'Fri' => -6, 'Sat' => 0, 'Sun' => -1);
  $last_sat_of_march = (31 + $days_array[$last_day_of_march]);
  $earth_hour_start_time  = gmmktime(20, 30, 0, 3, $last_sat_of_march, $year);
  return $earth_hour_start_time;
}

I don't think this was from the WordPress plugin, but not 100% sure.

pumpkinkid’s picture

Very nice! I didn't realize it always fell on the last Saturday of March.

So do you need any help coding the functionality to test the "blackout"? I was thinking the 30 second test button sounded great, and as you said, just for the current user testing it.

mgifford’s picture

Absolutely, I could use some help testing.

I think I have it fixed for D7 actually, although that needs more testing too.

Which version are you interested in testing with? I have to back port the changes to D6 but definitely need to do that and reach out to get folks to upgrade too. I discovered an annoying bug with last year's code.

pumpkinkid’s picture

grr, sorry for the double post...

pumpkinkid’s picture

So you're saying D7 has the demo option? I use D6 primarily, but either one you need help with, Eventually my goal would be to move to D7, and I don't want to sacrifice functionality to do so... It would also benefit me as well to have a D7 install so just let me know. :-)

mgifford’s picture

I'm very frustrated trying to put out both a D6 & D7 version of this project.

I have a D6 version, but can't seem to force out a release. Send me an email and I'll send you a tarball to test.

mgifford’s picture

I've now put out a new d6/d7 version with the new git repository.

Worth checking out the versions for the testing functions.