Option to remove "Reported on"

digital006 - September 30, 2009 - 08:38
Project:Weather
Version:6.x-5.7
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi,

Would it be possible to add an option to remove the "Reported on" feature from the block?

For the time being I'll just edit the module file but it'd be nice to have that option.

Cheers,
Mike

#1

toddy - September 30, 2009 - 09:58

Well, it would be possible of course, but I'm not sure it's a good idea. The data of some locations can be quite outdated, in some cases even a few days.

#2

biocomp.pat - October 16, 2009 - 08:38

Could something be added so that it's only displayed after a given/chosen amount of time? What you mentioned is really valid, but often won't apply :)

If I get some time, I'll try to look into it sometime

#3

biocomp.pat - November 19, 2009 - 00:25

Wow, just realized how unclear my last message was. Let me try again:

Couldn't we add a checkbox in settings that would say

Only display "Reported on" info when data is greater than 24 hours old.

Or it could be 12 hours. Or customizable. Whatever seems right. The point is that this "Reported on" info is only useful when the conditions aren't current. Otherwise, it's unnecessary clutter :)

#4

biocomp.pat - November 19, 2009 - 01:28

Mhen, it's bad form, but I added a simple template fix that solved it for me:

In weather.tpl.php, find

  <?php if (isset($weather['reported_on'])): ?>
    <small>
      <?php print t('Reported on:'); ?><br />
      <?php print $weather['reported_on']; ?>
    </small>
  <?php endif ?>

And replace it with

  <?php if (isset($weather['reported_on']) && strtotime($weather['reported_on']) < time() - 21600): ?>
    <small>
      <?php print t('Reported on:'); ?><br />
      <?php print $weather['reported_on']; ?>
    </small>
  <?php endif ?>

I used 21600 seconds, since I only wanted it to show if the weather data hadn't been updated in 6 hours. Under normal circumstances, it's hourly, so this works for me. Either means the weather station is broken, or I've had some sort of cron-tastrophe.

Hopefully this helps someone else! Cheers all!

 
 

Drupal is a registered trademark of Dries Buytaert.