Blogs

Patch for profile.module in Drupal 4.7.0 beta 4

Ah. There is another annoying bug in profile.module which gives wrong data in /profile. Data in fields was not cleared so the data will show in next record if fields in the next record are empty. Below is the patch for this problem.

--- profile.module.orig 2006-01-26 20:43:04.000000000 +0700
+++ profile.module 2006-01-27 20:34:54.000000000 +0700
@@ -393,6 +393,8 @@
foreach ($fields as $key => $field) {
if ($value = profile_view_field($account, $field)) {
$fields[$key]->value = $value;
+ } else {
+ $fields[$key]->value = $value;
}
}
return $fields;

ping.module with extendedPing for Drupal

In recent post, I made a patch for configurable ping.module. Anyway, some ping servers don"t accept simple ping, instead they preferred extendedPing. For example, blo.gs.

diff -u ping.module ping.module
--- ping.module.orig 2005-12-31 21:18:22.000000000 +0700
+++ ping.module 2006-01-27 15:00:35.000000000 +0700
@@ -44,6 +44,32 @@
}

/**
+ * Implemetaion of hook_settings
+ */
+function ping_settings() {
+ $form["ping"] = array(
+ "#type" => "fieldset",
+ "#title" => t("Ping settings"),
+ "#collapsible" => TRUE,
+ );
+ $form["ping"]["ping_pinger_list"] = array(
+ "#type" => "textarea",
+ "#title" => t("URLs to ping"),
+ "#default_value" => variable_get("ping_pinger_list", "http://rpc.pingomatic.com"),
+ "#width" => 40,
+ "#height" => 10,
+ );
+ $form["ping"]["ping_extended_pinger_list"] = array(
+ "#type" => "textarea",
+ "#title" => t("URLs to extended ping"),
+ "#default_value" => variable_get("ping_extended_pinger_list", ""),
+ "#width" => 40,
+ "#height" => 10,
+ );
+ return $form;
+}
+
+/**
* Call hook_ping() in all modules to notify remote sites that there is
* new content at this one.
*/
@@ -58,11 +84,32 @@
*/
function ping_ping($name = "", $url = "") {

- $result = xmlrpc("http://rpc.pingomatic.com", "weblogUpdates.ping", $name, $url);
+ $pingers = explode("\n", variable_get("ping_pinger_list", "http://rpc.pingomatic.com"));
+ foreach ($pingers as $pinger) {
+ $pinger = trim($pinger);
+ if (empty($pinger)) {
+ continue;
+ }
+ $result = xmlrpc($pinger, "weblogUpdates.ping", $name, $url);
+
+ if ($result === FALSE) {
+ watchdog("directory ping", t("Failed to notify %pinger (site). %message", array("%pinger" => $pinger, "%message" => xmlrpc_error_msg())), WATCHDOG_WARNING);
+ }
+ }

- if ($result === FALSE) {
- watchdog("directory ping", t("Failed to notify pingomatic.com (site)."), WATCHDOG_WARNING);
+ $pingers = explode("\n", variable_get("ping_extended_pinger_list", ""));
+ foreach ($pingers as $pinger) {
+ $pinger = trim($pinger);
+ if (empty($pinger)) {
+ continue;
+ }
+ $result = xmlrpc($pinger, "weblogUpdates.extendedPing", $name, $url, "", "$url/rss.xml");
+
+ if ($result === FALSE) {
+ watchdog("directory ping", t("Failed to notify %pinger (site). %message", array("%pinger" => $pinger, "%message" => xmlrpc_error_msg())), WATCHDOG_WARNING);
+ }
}
}


+?>

Patch for taxonomy.module in Drupal 4.7.0 beta 4

According to patch of blogapi.module, the second problem is to save category properly. Since the taxonomy.module now support load operation in nodeapi hook, $node->taxonomy is not just a plain array of string anymore. Instead it is a standard class so taxonomy.module must handle the object correct.

--- taxonomy.module.orig  2006-01-26 15:33:20.000000000 +0700
+++ taxonomy.module 2006-01-27 20:55:11.000000000 +0700
@@ -644,6 +644,9 @@
}
}
}
+ else if (is_object($term)) {
+ db_query("INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)", $nid, $term->tid);
+ }
else if ($term) {
db_query("INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)", $nid, $term);
}

Patch for path.module in Drupal 4.7.0 beta 4

You might notice that you are unable to delete url aliases in Drupal. I don"t know the exact version that this problem exists. Anyway, I have patched it right now.

diff -u path.module.orig path.module
--- path.module.orig 2005-12-19 21:51:38.000000000 +0700
+++ path.module 2006-01-27 11:56:01.000000000 +0700
@@ -100,7 +100,7 @@
**/
function path_admin_delete_confirm($pid) {
$path = path_load($pid);
- if (user_access("administer path aliases")) {
+ if (user_access("administer url aliases")) {
$form["pid"] = array("#type" => "value", "#value" => $pid);
$output = confirm_form("path_admin_delete_confirm", $form,
t("Are you sure you want to delete path alias %title?", array("%title" => theme("placeholder", $path["dst"]))),

Patch for blogapi.module in Drupal 4.7.0 beta 4

In Drupal 4.7.0 beta 4, blogapi.module mostly works fine with Post2Blog unless 2 points. The first one occurs when trying to edit post. Categories will not return via XML-RPC. Below is my patch.

diff -u blogapi.module.orig blogapi.module
--- blogapi.module.orig 2006-01-12 17:02:45.000000000 +0700
+++ blogapi.module 2006-01-27 16:02:51.000000000 +0700
@@ -710,6 +710,17 @@
$xmlrpcval["mt_convert_breaks"] = $node->format;
}

+ $terms = module_invoke("taxonomy", "node_get_terms", $node->nid, "tid");
+ $categories = array();
+ foreach ($terms as $term) {
+ $term_name = $term->name;
+ foreach (module_invoke("taxonomy", "get_parents", $term->tid, "tid") as $parent) {
+ $term_name = $parent->name . "/" . $term_name;
+ }
+ $categories[] = $term_name;
+ }
+ $xmlrpcval["categories"] = $categories;
+
return $xmlrpcval;
}

Smooth procedure to upgrade Drupal 4.7.0 beta 3 to beta 4

Since Drupal 4.7.0 beta 4 is available last night, I have just upgraded howforge.com to see the better version. There are many patches was applied to this release. I recommend all you to upgrade as soon as possible. Since I installed lots of modules and themes as well as hot patches during beta 3, the upgrade is not as easily as expect. The most critical problem is I didn"t want to interrupt user by making site off-line for so long. According to the upgrade guide, I have to remove all existing files and extract the new ones. This action is unacceptable for me. That means user might not see the proper message about off-line maintenance or upgrading. Below procedure is what I done today.

« first‹ previous109110111112113114115116117next ›last »