After upgrading to Pathauto 2.0 Beta 1, I noticed that the tokens provided by the Event module (version 1.0) for the "Node path settings" patterns no longer show up:
- eventyyyy
- eventmm
- eventmon
- eventdd
- eventday
- eventweek
They were present in Pathauto 1.2, the last version I was using before upgrading to 2.0 Beta 1.
| Comment | File | Size | Author |
|---|---|---|---|
| #39 | event_pathauto_39.patch | 2.2 KB | HorsePunchKid |
| #32 | event_pathauto_32.patch | 2.08 KB | HorsePunchKid |
| #28 | event_pathauto_28.patch | 2.08 KB | HorsePunchKid |
| #27 | pathauto_node_event.inc_.patch | 460 bytes | kenorb |
| #23 | event_pathauto_23.patch | 2.01 KB | HorsePunchKid |
Comments
Comment #1
gregglesThis should be filed against the event module, not pathauto.
Workaround:
if you need the even patterns then use the 5.x-1.2 version of Pathauto.
Comment #2
Wolfey commentedMy fault - the Event module I was using wasn't updated since I went from Pathauto 1.2 to 2.0 Beta 1, and since that was the only module I updated at this time, I assumed the issue was with Pathauto, instead of Event.
I'll keep that in mind about using Pathauto 1.2 if I need the Event tokens when setting up patterns - thanks for mentioning that.
Comment #3
gregglesI committed a fix which renamed the functions. I'd still rather have these in the event module, but will provide the best options I can until then.
Comment #4
Wolfey commentedThank you for adding this to Pathauto, greggles - I really appreciate it =)
Comment #5
gregglesSo, does that mean you can confirm that it works? ;)
I didn't test it...
Comment #6
Wolfey commentedGood thing you mentioned that - I forgot to try it out to ensure it's working properly!
Unfortunately, there is a problem - it shows the same values (all corresponding to the Unix epoch) when testing it out with "Event" nodes, regardless of the starting date:
Comment #7
gregglesWell, now it really is up to the event module (or someone who knows event, rather) to maintain that part.
Comment #8
bluecobalt commentedI can confirm that it doesn't work yet. All dates showing up as Dec 31 1969.
Comment #9
bluecobalt commentedIs anyone working on fixing this?
Comment #10
gregglesI'd say that having the "Assigned" field empty and my response that I'm not working on it gives a clear indication that I'm not and nobody else is so far - feel free to debug and find a solution.
Comment #11
Wolfey commentedI'm not sure if this would help with the issue, but in pathauto_node_event.inc (1.3.4.4), lines 23-33 read:
Out of curiosity, I checked to see if there was anything in "$eventstart":
According to that, it's empty, as the first statement is shown - this also happens with nonexistent variable names as well. To make sure it wasn't a false alarm, I replaced "$eventstart" with a non-empty variable (in this case, "$node"), and got the second statement (that it's not empty)...so it appears there may be something wrong with the "$eventstart" variable.
Could it be empty or nonexistent? It could help explain why the date values are always the same, as I can achieve the same outcome with by replacing all occurrences of "$eventstart" with a nonexistent variable in the file above.
Also, after using the "Devel" module to check out an event I had created, it seems that "$node->event['start']" has all of the necessary information for getting this to work. Would it be possible (even as a temporary hack) to extract the year/month/day values from that and assign them to the "Event" tokens for use with Pathauto?
Comment #12
gerhard killesreiter commentedThis needs a patch.
This is very obviously broken, $eventstart isn't even defined.
If $object is a fully loaded node object, then you are probably lookign for $node->event['start'].
Feed this into event_format_date which has the same syntax as format_date. File patch. Done.
Comment #13
Wolfey commentedI read what you said, but I'm still confused:
I apologize if these are dumb questions - I only have a basic understanding of PHP, so I really have no idea how to implement the changes you mentioned.
Comment #14
HorsePunchKid commentedI upgraded to pathauto 5.x-2.0-beta2, and I'm trying to get my event paths working again, too. I'm having trouble figuring out the execution path, really. It doesn't appear that any of the functions in pathauto/contrib/pathauto_node_event.inc actually get called, which makes me suspect that it's not using the current pathauto API.
If anyone has any suggestions on where to go for API documentation or a relevant code example--given that neither the code in contrib nor pathauto/pathauto_*.inc has helped much so far--I would be very greatful.
I think I'm on an outdated version of the event module, too, but I'll post anything I come up with that appears to work.
Comment #15
HorsePunchKid commentedWolfey, I think Gerhard is suggesting placing something like this at the top of
event_token_values:$eventstart=event_format_date($object->event['start']);I guess I would need to upgrade my install of the event module to test that out for you, though. I'm still concerned that those functions don't even seem to get called.
Gerhard, is there a relatively stable version I should upgrade to? I'm sorry, I haven't kept up with the progress being made on the module.
Comment #16
HorsePunchKid commentedWell, it was not so complicated as I expected. This patch will likely not work for you if you're using the 2.x branch of the event module, but something similar might. The key was that the functions in pathauto_node_event.inc no longer had the correct names, but I also needed to get $eventstart from the $object, and a similar modification will be needed for event 2.x as Gerhard suggested.
Comment #17
gerhard killesreiter commentedyeah, this is in the rigth direction. :)
Comment #18
gregglesThanks HorsePunchKid - committed to the 5.x-2.x branch. Please make your patches against the tip of the branch (i.e. I already fixed the function naming problem...)
@Gerhard - one reason for implementing this in Event rather than in Pathauto is that you could then have control over the data structures on the different branches. I can only do one so I'm staying with the 1.x version (apparently).
Comment #19
bluecobalt commentedOkay, so this probably works with the 1.0 branch of the event module.
What about the 5.x-2.x-dev version?
Comment #20
gregglesActive indeed. Due to this fatal error I've removed the code from pathauto.
If someone wants to provide it as a patch for event module, great. But I don't need fatal errors in pathauto related to some other module :p
Comment #21
HorsePunchKid commentedI have gotten this working again. From what I gather, what really needed to happen is that
event.moduleneeded to get updated to implement the proper hooks, one for pathauto to do the replacing and two for token to get tokens and values. I'm not sure what the relation between the two is or is supposed to be, but I suspect I can simplify this patch.I think I should file an issue for the event module. I'm running a HEAD version of it from sometime in March, so I'm not sure exactly what this will apply to. It should basically work for any 1.x release of event. Getting it working with the 2.x releases should just be a matter of a function call to parse or format the event start date.
Comment #22
HorsePunchKid commentedSorry, I didn't notice that this issue is actually under the event project, not the pathauto project; please disregard that part of my message.
Comment #23
HorsePunchKid commentedHere is a much cleaner patch.
Comment #24
kenorb commentedHorsePunchKid:
Try to patch this patch changing below lines:
you need to use strtotime() function.
That's why some people has problem with 1970 year.
Comment #25
HorsePunchKid commentedIf I do
strtotimethere, then I start to get 1969/12/31 instead. What version of the module are you using? I'm using a dev version of 1.x. Maybe 2.x needs that extra function call?Comment #26
kenorb commentedI think that it depends what version of Event you use.
Before there was datetime format in mysql (event table), in new version (2.x) there is timestamp format.
Second argument of date function must be in timestamp format.
So I think that for compatibility for both of versions this function should check in which format is a $eventstart variable (e.g. using is_string() function) and to make sure that second argument is in timestamp format.
But, whatever, I'll be not investigated that.
Comment #27
kenorb commentedMy proposition is change line from:
to:
Should work in both version of Event.
Before I got:
* Repeat settings updated
* Created new alias course_dates/event+1970+01+01 for node/712
* Your Course Date has been created.
After change:
* Repeat settings updated
* Created new alias course_dates/event+2007+10+10 for node/715
* Your Course Date has been created.
In attachment there is patch for people who using still old version of Pathauto (with contrib/pathauto_node_event.inc file) with new version of Event (2.x).
Comment #28
HorsePunchKid commentedGood idea, kenorb. I have made the change you suggested (the only difference being that
$nodeshould be$object), and it's working fine on my event-5.x-1.x version.Comment #29
bluecobalt commentedHmmm...
None of these patches work for me. Using Events 2.0 and Pathauto 1.0 or 2.0, I still get 1969/12/31 for the date.
Comment #30
HorsePunchKid commentedI'll set up a test site for event-5.x-2.x and see what happens. I'm still on 1.x, and I have been assuming kenorb is on 2.x, so I thought we had all the bases covered. If you want to help debug, you could tell me what the output is after when you add
drupal_set_message(var_export($eventstart,TRUE));after the$eventstart = is_string(...line inevent.module.Comment #31
bluecobalt commentedWoohoo!
HorsePunchKid, your last patch, event_pathauto_28.patch, works but has a typo in it that has to be corrected for it to work.
$eventstart = is_string($object->event_start) ? strtotime($object->event_start) : $object->event_start;;has an extra semicolin at the end and should be
$eventstart = is_string($object->event_start) ? strtotime($object->event_start) : $object->event_start;Event 2.0 then works fine with Pathauto 2.0, and gives the correct date.
Comment #32
HorsePunchKid commentedInteresting! I'm scratching my head trying to figure out why an extra semicolon would cause it to misbehave, but thank you for spotting the typo, in any case. Here's the same patch but with the extra semicolon obliterated.
Comment #33
bluecobalt commentedThe plot thickens.
It works if you create a new event node, or update an existing one, but the bulk generation of url aliases byt Pathauto still gives 1969/12/31.
Comment #34
HorsePunchKid commentedCan you file a new bug report for that problem? I'd really like to see this issue get closed out, because with this patch, it's at least better than having
%5Beventweek%5Dshowing up in your URLs.:)Comment #35
gregglesThe "only works during insert/edit" is a common problem. The new node has a particular data structure that is determined mostly by the FAPI code for the node submission form.
The bulk generation is based on a "node_load" of the node which may put data into other places. The solution is to check for the element in a specific location (i.e. where it is during node creation/edit) and if it's not found there then test the location of the data after a "node_load" and try to use that.
If neither exists, well, we end up with 1969 but that is usually a misconfiguration on the part of the admin.
Comment #36
HorsePunchKid commentedTo clarify, is the problem that when calling
event_token_values(), the$typeof the$objectis something other than'node', or is it still a'node'but just with a slightly different structure?Comment #37
Wolfey commentedJust got around to trying out your patch, HorsePunchKid - after it was applied, I changed the Pathauto pattern for events back to what it was before (to use the tokens I mentioned in the start of this topic).
After doing that, followed by editing event nodes and resubmitting them (to force their paths to be updated), my event URLs now show the correct date =D
Comment #38
greggles@horsepunchkid - it's still a node object, but it has a different data structure.
Comment #39
HorsePunchKid commentedHere's a patch that works during add/edit and during bulk updates for event-5.x-1.0. Can interested parties test against other versions?
It turns out we were getting the Unix timestamp as a string, so we needed to check for
is_numeric().Comment #40
HorsePunchKid commentedI've just tested this against event-5.x-2.x-dev during add/edit and bulk update, and it appears to be working fine.
Comment #41
ksenzeeI've successfully tested against event-5.x-1.0. Thanks for the patch.
Comment #42
killes@www.drop.org commentedcommitted to 5.2. Is this needed for 5.1 as well?
Comment #43
HorsePunchKid commentedYes, this is needed for 5.1, too. I'm not sure if the patch will apply properly, but it's just those two functions that need to end up in event.module somewhere, presumably at the bottom.
Comment #44
rmiddle commentedI just tried this patch in Current Pathauto/token/Events/Repeats Events. It works well. I would Sugest a backport to 5.x-1.x as well.
Thanks
Robert
Comment #45
gregglesMarked http://drupal.org/node/219515 as a duplicate of this.
Comment #46
csc4 commentedConfirm patch works well for me too.
A backport to 5.1 would be very gratefully received.
Comment #47
rmiddle commentedWhat is the status of this Patch?
Thanks
Robert
Comment #48
csc4 commentedI've just realised that this could also do with the complementary event ends tokens...
Something like
Perhaps?
Also has this been backported to 5.1?
Comment #49
karunadave commentedI have been sitting with pathauto 1.2 hoping this will be resolved someday.
Look what I just found that will help with this: a module called Event Token http://drupal.org/node/233769/release.
Comment #50
csc4 commentedThat's a good find. Wonder which this 'ought' to go in?
Also been thinking we need the time ones too as well as the date.
Comment #51
nasi commentedConfirm patch works for me on event-5.x-1.0
Is that enough testing for this to be committed yet?
Comment #52
vkr11 commentedsubscribe
http://drupalsearch.org
http://jobs.drupalsearch.org
Comment #53
karunadave commentedIt may be more fruitful to use CCK date which does produce tokens that do this.
Comment #54
rmiddle commented#53 Karunadave,
Part of the reason to use Events is to avoid using CCK. Why make CCK a requirement of a module. It doesn't make any since.
Thanks
Robert
Comment #55
konsumer commentedI never saw this issue, and made my own module, with the hope that it would eventually be integrated into Event:
http://drupal.org/project/event_tokens
It adds quite a few more tokens, but otherwise is pretty similar to what is in here.
I'd be super-psyched to integrate this.
Comment #56
kenorb commentedComment #57
japerryEvent for Drupal 8 is unrelated to older versions. If an issue similar to this one exists, please open a new issue with the 8.x branch.