Needs work
Project:
Subdomain
Version:
6.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Dec 2009 at 10:57 UTC
Updated:
4 Jun 2010 at 08:50 UTC
Jump to comment: Most recent file
If the patch at http://drupal.org/node/362493#comment-1365582 ever gets committed, subdomain will no longer be able to build the [subdomain] token for organic group posts.
This is due to the keys in $object->og_groups no longer starting from 0, thus breaking the following lines in subdomain.module:
if ($groupname = db_result(db_query("SELECT title FROM {node} WHERE nid = %d", $object->og_groups[0]))) {
$values['subdomain'] = subdomain_build_token($groupname, $object->og_groups[0]);I'm no expert but I believe $object->og_groups[0] could be replaced with reset($object->og_groups) to cover that potential problem without breaking current functionality. See attached patch.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | subdomain-pathauto.png | 29.55 KB | ZyanKLee |
| #9 | subdomain-subdomain.png | 52.01 KB | ZyanKLee |
| og_posts_token.patch | 1019 bytes | morbiD |
Comments
Comment #1
rsvelko commentedAfter having read the php.net docs for "reset", I doubt that this would work. "reset" resets only the internal array pointer.
Instead we need to build a second object with normalized keys. There should be some func to do this... When the time comes somebody will give the newer patch ...
cheers
Comment #2
rsvelko commentedI've just found this http://drupal.org/node/483334 - see comment #1 - it has some php code that might be the desired php function...
Comment #3
morbiD commentedSorry if I'm being stupid but I don't follow your comment amount reset(). The php.net docs state that it returns the value of the first element in the array, which is all $object->og_groups[0] was doing when it worked.
Comment #4
rsvelko commentedNo - you are right - I missed the fact that reset RETURNS the value of the 1st element. I thought that it just rewinds the internal pointer...
One way or another your point makes sense. I suggest that it is not a good practice to do anything onto the $object if all we need to read sth from it. So please if this is important to anybody - find a way to take(=read) what we need from $objct without touching it. Maybe with the help of a dummy copy object or with the right php-statement or function..
Personally I think reset will work but it is not the best...
Comment #5
morbiD commentedJust an update - the Organic Groups patch which causes this issue has now been committed which kind of makes it fairly urgent. Anyone using og-6.x-2.x-dev to fix issues with the release version is going to find subdomain no longer works with it.
Changing status to "needs review" to get some attention. Using reset() was a quick fix so if anyone can improve on it, be my guest.
Comment #6
ZyanKLee commentedhi,
any chance getting this bug solved soon?
Sadly I can't help much - not a developer myself.
Comment #7
setvik commentedcommitted. Should be in tomorrow's dev release.
Thanks for the patch!
Comment #8
rsvelko commentedanybody test this? morbiD?
Comment #9
ZyanKLee commentedSorry, can't confirm this working. But please have a look:
http://test2.laender-ohne-ruhe.de/v2/gruppe => "SubdomainGruppe" has been created after I installed the new dev version and configured it.
creating some screenshots of my configuration as attachments. (while creating the screenies I switched to english, but all else is in german, so the website will now be in german again)
Perhaps I did something wrong?
Versions are:
Comment #10
morbiD commented@ZyanKLee: You should really be opening a new support request, since this thread is a bug report relating specifically to posts within a group. Anyway, from what I can see in your test site it looks like the tilde character (~) might be getting stripped from your subdomain token. Have you definately set the behaviour for the tilde character to "No action" under the "Punctuation Settings" in Pathauto, as the Subdomain readme describes?
@rsvelko: Personally, I've only tested it on my dev site, which is why I set the status to needs review. I guess setvik was happy enough with it as a quick fix ;)
Comment #11
Brian@brianpuccio.net commentedJust chiming in, I did test this out and it does fix the problem. Thanks!
Comment #12
progga commentedI am having this problem on 6.x-1.7 that I downloaded only yesterday! That means the stable version is broken :-( Using current() or reset(), as described above, fixes the problem though :-) And yes, I am using the stable version of OG (6.x-2.1).
Comment #13
3rdLOF commentedSo far I have not seen this module build the proper tokens in any of the following combinations:
OG 6.x-2.1 + Subdomain 6.x-1.7 = OG tokens ignored
OG 6.x-2.1 + Subdomain 6.x-1.x-dev = OG tokens ignored
OG 6.x-2.x-dev + Subdomain 6.x-1.x-dev = OG tokens ignored
Subdomain, wildcard, cookies, etc, etc set up right, all system checks in green in the Subdomain panel. Subdomain setting set to OG nodes, using name to generate token.
As for the "Automated Alias Settings" bit I am guessing this was changed in Pathauto to URL aliases >> Patterns >> Node Paths (which probably should be updated on the manual). In this section I add the toke [subdomain] by itself to the OG group node and content node types. No additional trailing dashes or spaces.
I create a Group Node, look at the Alias generated... and the subdomain completely ignored. It simply adds the name of the node as [title-raw] as a path of the domain (the default). Instead of http://subdomain.domain.com I get http://www.domain.com/subdomain where subdomain is the name of the group node with dashes (i.e the-group-name). When I edit the Alias I see the standard "http://www.domain/" + alias input field form - should this not look different?
I installed, reinstalled, checked permissions, flushed caches, edited, added nodes....no dice. I have not actually been able to make this module work once so I am only guessing this is all in connection with and related to this ticket as it appears to be the only thing not working. Unless somebody points to an error from my part...
Comment #14
morbiD commentedThat sounds like exactly the same problem ZyanKLee had. Did you read my suggestion to him in #10 regarding "Punctuation settings"? I don't know if it was helpful since he never reported back, but it's worth checking.
Again though, your token is apparently generating something whereas this issue was to fix a potential bug where the token would not be generated at all. I'd suggest opening a new support request if my previous post doesn't help.
@progga: That stable release is from Dec 2009 while this patch was committed in Feb 2010 so the current dev release should work.
Comment #15
3rdLOF commentedSorry. yes it did solve it. For some reason I thought the tilde issue was specific to his case.