User login

Drupal Development

Parsing XML with PHP for Drupal

Thanks to walkah for pointing out the exciting possibilities of Drupal and PHP 5's SimpleXML extension. (And before you ask, yes, we're taking medication to deal with this too-easy excitability issue.)

http://us3.php.net/simplexml

JSON (JavaScript Object Nugget) to PHP array

I am shocked, shocked that Drupal is not already fully buzzword compliant. I expected lots of material on making, sending, getting, reading, and mangling JSON. (I made up the part about the N standing for Nugget by the way. I'm pretty sure it's JavaScript Object something though.)

Instead, Agaric was forced to fall back on the PHP manual: only in PHP 5.2 and above the function json_decode will turn a JSON string into a PHP object (or, optionally, an array).

End of a Saga: the locale_refresh_cache bug was in location_views

Here's the patch.

Removal of three characters.

Took Agaric longer than it should have to find. But we were observing the legitimate spike in caching caused by locale being enabled with a bunch of languages, and didn't realize (as we went through the whole module disabling thing) that the super-magnifier of triggering all the caching was in fact turned off with the location_views module being removed from the Drupal bootstrap process.

Event views module calls views_invalidate_cache too often

I don't think this should be called on what seemed like most every page load. This is a significant problem with a lot of locale/i18n languages.

Fix organic groups e-mails to subscribers to come from actual poster (commenter not original node author)

Filed issue: http://drupal.org/node/193348

Currently under "E-mail settings" in organic groups the options for "Format of From: field:" the tokens available include:

@user_name
@user_mail

This is great for the initial post, but replies to that post have the initial node author's name in e-mail rather than the commenter's name.

What's updating Drupal's cache all the time on this crazy i18n, og, custom site?

Step by step to finding what's wrong.

So after catching a few of the other caches (views, locale) that were running too much for different reasons, we still have a MySQL frenzy on our hands.

The query I see over and over again in Agaric's logs on the WSF2008 site is "INSERT INTO cache (cid, data, created, expire, headers) VALUES ('locale:pt-br', 'a:3757:{s:2\"MB\".....

And "UPDATE cache SET data = 'a:4334:{s:2\"MB\"

By the way, in vi to go to the previous occurrence of a search, to search backwards, it's capital N (shift+N) instead of just n.

JavaScript and Google Maps: notes on resources

The APress book on google maps and AJAX looks like the best reference.

"Hacking Google Maps and Google Earth" is out of date.

http://googlemapsapi.blogspot.com/2007/11/calling-all-phpmysql-developers-come.html

JavaScript Debugger 0.9.87 Homepage
by James Ross, Robert Ginda

Getting latitude and longitude for countries, provinces, or cities

Stolen from Dwees in this comment:

  $city = $node->location['city'];
  $province = $node->location['province'];
  $country = $node->location['country'];

  $address = str_replace(" ", "+", $city .",". $province .",". $country);
  $google_key = variable_get('googlemap_api_key', '');

Yahoo Geocoding - doesn't provide lat-lon for country

Can't use Yahoo. No way to ask for the country (it replies with the country, but you can't ask for it) so no way to get lat-lon for country.

Woulda been cool though.

http://developer.yahoo.com/maps/rest/V1/geocode.html

http://jeremy.zawodny.com/blog/archives/005626.html

Agaric moves on...

Resolution

Removing the view tab from embedded profiles on user pages

Solution:

How to remove view/edit tabs?

http://drupal.org/node/83090

nodeprofile remove embedded view and edit links from profile
http://api.drupal.org/api/function/theme_menu_local_tasks/5

Note the approach:

Syndicate content