Download & Extend

Bulk generate and custom subdomain issues

Project:Subdomain
Version:6.x-1.5
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active

Issue Summary

Hi!
I'm reporting both issues here, let me know if you prefer that I create an issue for each.
I have set Subdomain to create subdomains for "organic groups and group content" using "the name of the organic group"

Issue #1: custom subdomain
If I choose a custom subdomain from the list and use the suggested %name% token, I get the following error message when I try to save the configuration:
"Apart from the %name% and %id tokens, the custom rewrite can only contain letters and spaces"

Issue #2: Bulk generate
This was reported before with the D5 version. I'm experiencing the same problem.
When I create new nodes, the [subdomain] token is properly replaced by the group name but when I use Pathauto's bulk generate feature, the token is ignored everywhere except the group names.
So, for example, instead of "~mygroup/blog/postname" I get "blog/postname"

I'm using the latest drupal (6.12) with Pathauto 6.x-2.x-dev (2009-May-22), Subdomain 6.x-1.5, Token 6.x-1.x-dev (2009-Jun-02) and Organic groups 6.x-2.x-dev (2009-May-29)
All Subdomain Prerequisites passed and working.

Thanks! =)
Ricardo

Comments

#1

I got the same issue with a similar configuration

But I was able to fix it (see code below, sorry no patch yet), I think the problem came from how the node load and specifically with nodeapi load. When you do a bulk update the node doesn't fully load - hook_nodeapi - and at result the $node->og_groups is not in the right format.

elseif (isset($object->og_groups)) {
$first_og = @array_slice($object->og_groups, 0, 1); //we get the first element regardless of the key

// 1st Group in og_groups array is used for subdomain
if ($groupname = db_result(db_query("SELECT title FROM {node} WHERE nid = %d", $first_og))) {
$values['subdomain'] = subdomain_build_token($groupname, $first_og);
};
}