Skip to main content

Software Development

When DID you load that page?

Page rendered on Sat, 12/21/2024 - 7:25pm
(0 seconds ago)

When I'm viewing Drupal administration pages, like referrer logs or other time-sensitive pages, I like to know the time of the last 'refresh' (and therefore how stale the page content is).

So, here's a quick and dirty Drupal block definition. (The javascript is not very idiomatic, but it'll do for now until I can update it. In fact, I plan on making it a pure client-side javascript widget, but that's another post for another day.)

It will display the date and time the page was last loaded, and the 'age' of the page in seconds - it uses a javascript interval timer to update this every second.

Insert AdSense Ads Automatically in Drupal Nodes and Teaser Lists

Here's a useful Drupal module that tweaks a node's body or teaser to insert an inline AdSense ad, when a node is rendered on a full page or teaser list.

This allows site administrators to enable automatic insertion of an AdSense ad into the page without the content editor having to insert inline [adense] filter tags, or having to edit a site's template.php (or other template files.) This offers a big advantage, as you can change the ad format, group, and channel on the fly without hand-editing each node (which is the only way I can think of doing it if you are using inline filters). Another advantage is that you can enable/disable the inserted AdSense with just a click of the mouse - no need to edit each node.

User profile spam attack

On Christmas Eve day, several of my sites were 'visited' by what I presume to be a bot, all from the same source IP address.

The attack consisted of attempts to register many new user accounts, each having a username containing the term 'DVD':

Soccer DVD, DVD Immature, Underworld DVD, Adult DVD, Enigma DVD, DVD shrink, Blues DVD, Trick DVD, Portable DVD Player, DVD Decryptor, Federation DVD

The email addresses were all unique of course - since the bot attempted to register multiple user names on each site. The sites were configured to include a text field user profile, so that users can share interests, etc.

The spam bots were stuffing URLs and text ads for DVDs into the profile fields, in an attempt to generate search engine "link love", or so it appears.

Drupal adsense_injector.module download (and source code)

News flash:

Now hosted on Drupal.org CVS/Project repository.
Please visit the Drupal.org project page for latest releases, bug/issue reports, etc.

Now hosted on Drupal.org CVS/Project repository.
Please visit the Drupal.org project page for latest releases, bug/issue reports, etc.

User notification module

I've been working on a user notifications module (and underlying API module) for Drupal.

This is initially needed for for use with my classified ads module but it can be used by any module that needs a well-defined method of alerting users to various events.

Interesting spammer pattern - how they find sites

Some our our sites that feature free classified ads (amadorable.com, goatseeker.com, and bunnytrade.com) have been hit with a few recurring spammers trying to plant ads for various off-topic products (like cell phones, etc.) I guess this is a good sign; our sites are visible and spammers feel it is worth their time and trouble to post an ad (and no, as far as I can tell, these are not bots - they're human-generated spam.)

In reviewing the referrer logs, I've noticed that in nearly every case, spammers use search engines to find sites that have been spammed previously using known keywords - or just sites that offer free classified ads or open posting capability. For example, I find these google searches in my logs, just prior to the spammer creating an account and attempting to deposit the spam content.

Using Event module with jscalendar (jstools)

When using event.module with JSCalendar (part of jstools module), you might experience problems with event times being stored incorrectly. This appears to be due to an obscure configuration requirement when using JSCalendar - apparently, the event module must be configured to use 12 hour format. (This one bit me in the behind today, so I thought I'd jot this down somewhere...)

Be sure to set event.module time notation to 12 hour format:
administer >> settings >> event >> "Time Notation Preference" = 12h

Related info:

Placing "read more" inline with teaser - AngryDonuts.com

This posting on angrydonuts.com (merlinofchaos' excellent site) shows how to customize the placement of the 'read more' link on your site. Most excellent!

Why can't A Drupal user edit a node they created?

Why can't a Drupal user edit a node they created?

Symptoms: An authorized Drupal user loses "edit" access to nodes they've created, even if they have appropriate node (or other module) access permissions. Or, user cannot edit a node that should be editable by them, based on access control or node access settings. No errors or warnings are presented to the user. Nothing in the Drupal watchdog log.

Possible Cause: The user does not have permission to use the input filter currently assigned to the node. (An administrator or other privileged user may have changed the input filter settings, or, input filter permissions may have been changed to exclude the node author since the node was created. As a result, the user never had, or no longer has permission to use the input filter associated with the node.)

This excerpt from Drupal node.module node_access() function tells the tale:

Location, gmap, and gmap_location module interactions

If you want nodes to appear on a google map provided by the gmap_location module, you need to set up your system correctly.

from gmap_location function gmap_location_node_page() :

  $result=db_query("SELECT oid, longitude, latitude FROM {location} WHERE (longitude!=0 OR latitude !=0) AND type='node'");

So, the only nodes that will appear in a gmap_location-provided map are those where the type is 'node' and the longitude or latitude are non-zero in the location table. Ok, how do we get a lat/long value in that table?

Syndicate content