It looks to me like render_map.php is calling drupal_get_path() on lines 78 and 101 in spite of the fact that no such function is ever loaded. This will prevent the map from displaying correctly (or at all, for that matter).

(I'm running whatever version came from the SourceForge download. It's marked as 1.1-beta. That seemed to be the latest.)

Comments

egfrith’s picture

Status: Active » Postponed (maintainer needs more info)

Thanks for your report.

The official version of the drupal module code (with the bawstats code from sourceforge included) is now on the drupal website. I don't maintain the code that is on sourceforge, just the code on the drupal website. I do try to keep it in sync with the bawstats code.

render_map.php should work when the code is used as a drupal module, as drupal_get_path() is a core function:
http://api.drupal.org/api/function/drupal_get_path/6

Could you check that this is a problem with the most recent version of the 6.x code downloaded from the drupal website please?

juanjo_vlc’s picture

I can confirm it's happening on 6.x-1.1 (downloaded using drush)

[Fri Jan 21 12:02:22 2011] [error] [client X.X.X.X] PHP Fatal error:  Call to undefined function drupal_get_path() in /var/www/html/sites/all/modules/bawstats/modules/render_map.inc.php on line 100, referer: http://www.domain.tld/admin/reports/bawstats/userinfo/01/2011
juanjo_vlc’s picture

StatusFileSize
new3.52 KB

I noticed you skip the bootstraping on the file map_render.inc.php, so drupal calls doesn't work.

I made some little changes to include map rendering as a drupal callback, so it's not necessary to bootstrap again, and change the generation of images to the icons directory inside the module folder. This works for the map generation, if you use any other calls to drupal functions you must do the same or include bootstraping.

Here is my patch.

egfrith’s picture

Thanks very much for this juanjo_dv. I will try to look at the patch soon.

rezboom’s picture

patch in #3 works for me! thanks!

egfrith’s picture

Assigned: Unassigned » egfrith
Status: Postponed (maintainer needs more info) » Active

I've had a look at the patch now. There seem to be a number of bits to it, and I can only see that the last bit is relevant to the bug, which I still can't replicate.

I think the best solution is to try to implement the map as a drupal callback menu. I will try to look at this soon.

I have however committed the part of the patch that deals with the path the empty.png icon. See http://drupalcode.org/project/bawstats.git/commit/2486319

egfrith’s picture

Status: Active » Fixed
StatusFileSize
new5.04 KB

The attached patch creates a callback to call bawstats_render_map_image(). This function is a drupalised version of the previous baw_render_map_image(). I have factored out the code that actually creates the image (as oppose to deliver it) bawstats_create_map_image().

I have committed this patch. Hopefully this fixes the problem - please let me know if not.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.