After a lot of sweat and tears I've made my first drupal contribution...

the file attached needs to come in the contrib dir as "pathauto_xtracker.inc"
* aliasses for all xtracker type tabs
* alias of the xtracker tab in the profile page

please validate if it works

and also send in comments on the development...
what did I doo wrong, what could be better, does it comply to the standards.

Comments

greggles’s picture

I believe it can be done in the contrib directory as you have supplied or in the xtracker and subscriptions modules - Organic Groups currently implements the hook_pathauto_node and that is probably the best way to go. Currently we lack a pathauto_user hook, but we can certainly add one. That seems like the more modular way to approach this rather than the use of the contrib directory.

If you agree with that approach then we can work on getting your code included into xtracker and then creating the invoke(pathauto_user) that will achieve your desired results.

Take a look at function og_pathauto_node($op, $node=NULL) { at the bottom of http://cvs.drupal.org/viewcvs/drupal/contributions/modules/og/og.module?...

Thanks very much for your work on this - I look forward to getting this implemented.

ednique’s picture

the hook_pathauto_node cannot be used here as xtracker is not a node...
There's definatly a need for hook_pathauto_user...

To be able to do the user part, I had to use hook_user...
but what if one day xtracker itself uses hook_user...

Thus indeed the better location is the xtracker module itself...

Finally, I figured out that the code attached has not taken into account that the user can change the tabs of xtracker to list by taxonomy terms...
And the xtracker module should in the event of that change, alter the current paths...
thus indeed a tighter integration is needed...

greggles’s picture

Title: xtracker contrib » provide a hook_pathauto_user to allow user related modules to interact with pathauto
Status: Needs review » Active

@ednique - thanks for the further investigation. I've updated the title (and status) for this issue to reflect your more recent investigation. I hope that you will continue pursuing a patch to xtracker and perhaps provide a patch for pathauto to add the hook_pathauto_user.

If you don't have the time to provide the patch here in pathauto then just let me know and I will do it. Until then I'm respecting the fact this you've assigned this to yourself.

ednique’s picture

Status: Active » Needs review
StatusFileSize
new1.16 KB

OK... I've cracked the nut...
I can only add 1 file, so I will be posting the files one by one...

What I've done:

1) provide hook_pathauto_user() ==> see hook_pathauto_user.txt
		* modules using these hooks should insert it into their own module (not in contrib)
		
2) The pathauto_user now only deals with user.module, all other core modules that were original inside this feature are seperated in the "contrib" directory.
		* pathauto_blog.inc :: blog.module functionalities
		* pathauto_contact.inc :: contact.module functionalities (the tab)
		* pathauto_tracker.inc :: tracker.module functionalities (the tab)
		
3) Bug fix :: a user changing its user name now updates the aliasses (if allowed in configuration)
		* user tabs aliases are updated
		* blog main aliasses are updated
		* node aliasses of that user are altered if [user] is used (change in pathauto_node.inc)

4) Admin changes
		* default pattern for all user tabs
		* Each user tab can have it's own pattern
		* The default "view" tab is the one that was there before
		* You can select [tab] to display the original URL (edit, track, ...)
		* You can select [tabname] to display the text that is shown in the tab (edit, tracker, ...) and if translated, you'll get the translation (bewerken, opvolgen, ...)

file also attached

ednique’s picture

StatusFileSize
new2.83 KB

hook_pathauto_user()

see attach

ednique’s picture

StatusFileSize
new11.17 KB

Pathauto_user.inc patch

see attach

ednique’s picture

StatusFileSize
new1.36 KB

pathauto_node.inc patch

see attach

ednique’s picture

StatusFileSize
new2.09 KB

new file :: contrib/pathauto_blog.inc

see attach

ednique’s picture

StatusFileSize
new447 bytes

New file :: pathauto_contact.inc

see attach

ednique’s picture

StatusFileSize
new442 bytes

New file :: contrib/pathauto_tracker.inc

see attach

ednique’s picture

All done...

the pathauto_contact.inc also needs to come into the contrib directory...

Please review the code...

greggles’s picture

@ednique - all I can say is WOW! This is great work, thanks for undertaking it.

I haven't had time to review the patches yet, but will do so in the next week or so.

Again, thanks so much for your effort on this. It sounds like some great ideas and some great re-organizing of the code, so I look forward to being able to commit this.

ednique’s picture

StatusFileSize
new4.44 KB

As an example I've made the xtracker (http://drupal.org/project/xtracker) integration.

1) In the admin/settings/pathauto it has its own "Xtracker path settings"; thus uses hook_pathauto and hook_pathauto_bulkupdate

2) In the user pages it adds a tab and uses the hook_pathauto_user()

3) within the xtracker pages there is a tab called "my posts" and thus this can have a pattern containing the username. Therefore hook_pathauto_user() is used to change the link on that tab when a user changes his username, a new user is created or one is deleted.

For now, while testing and untill xtracker adds this code into the module, you can put this file in the contrib directory... So don't commit this file...

ednique’s picture

StatusFileSize
new1.43 KB

while doing node aliasses of that user are altered if [user] is used (change in pathauto_node.inc) I didn't use the hook_pathauto_user as supposed to...

The file attached, supplies the new node patch and the next message supplies the new user patch
both to be executed on the current 4.7.0 code...

ednique’s picture

StatusFileSize
new11.05 KB

Here's the new user patch...

these both files REPLACE the initial patch files listed above in #6 and #7

bluecobalt’s picture

I'm wondering why this work never got committed? This seems like incredible work.

As the 4.7 version of pathauto currently stands, it doesn't update any paths when a user changes their username, which is a major issue.

I was able to use some of the code from comment #15 to get pathauto_user.inc working correctly, but can't get pathauto_node.inc working. I added the code from comment #14, and it doesn't work. Am I missing something?

This is a huge problem for us, because we're using the usernode and nodeprofile modules for user profiles, with the username set in pathauto as the path for the usernode. If someone changes their username, their profile can no longer be accessed until we go in and fix it manually.

Any thoughts on how to fix this?

greggles’s picture

Why didn't it get committed: it's a big change, the patch is in the wrong format, and nobody else has reviewed it. All of those things make it harder for me to review and decide that it should be committed.

In your comment you state that some of it works but some of it doesn't. If you could improve it and get it to a working patch and also do a review of the patch then it would be more likely to be committed.

I know there are problems with Pathauto - there are in fact hundreds of them. But I can't fix them all without help.

ednique’s picture

I have it running ever since...
Maybe you need all the files posted above...
some are patches, some are complete new files...
They alll need to be there...

If I get to it, I'll make a new set of instructions...
I'll use the latest pathauto code and see what differs...

greggles’s picture

Thanks ednique - it would be really helpful if you could re-roll it for the most recent version of 4.7 and/or 5 and also use a diff that puts them all in one file.

ednique’s picture

I will submit all changes that I have done to pathauto.
these include all changes reported here in the issues:
http://drupal.org/node/89906 :: user
http://drupal.org/node/92183 :: node and taxonomy
http://drupal.org/node/73017 :: contact tab
http://drupal.org/node/91748 :: blog feeds

ednique’s picture

StatusFileSize
new2.11 KB

New file pathauto_blog.inc :: add to the contrib directory

ednique’s picture

StatusFileSize
new467 bytes

New file pathauto_contact.inc :: add to the contrib directory

ednique’s picture

StatusFileSize
new465 bytes

New file pathauto_tracker.inc :: add to the contrib directory

ednique’s picture

StatusFileSize
new5.97 KB

New file pathauto_xtracker.inc :: add to the contrib directory

Caution: this is an example file of how another module can use the new functionalities.
This file is for the xtracker module.
Normally that file should be incormporated into the module itself.

ednique’s picture

StatusFileSize
new2.83 KB

New file hook_pathauto_user.txt :: add to the pathauto directory

Proovides usage information on the user hook

ednique’s picture

StatusFileSize
new1.4 KB

Changes for pathauto.module

Fixes the blog feeds aliases when username changes...

ednique’s picture

StatusFileSize
new2.83 KB

Changes for pathauto_node.inc

adds user and taxonomy change triggers

ednique’s picture

StatusFileSize
new2.83 KB

Changes for pathauto_taxonomy.inc

providing a pathauto_taxonomy() hook
+ catpath correction

ednique’s picture

StatusFileSize
new11.33 KB

changes for pathauto_user.inc

* strip out other then user functions and put them intp contrib directory
* make pathauto_user() hook
* change in name bug fix
* default pattern for all user tabs
* Each user tab can have it's own pattern
* The default "view" tab is the one that was there before
* You can select [tab] to display the original URL (edit, track, ...)
* You can select [tabname] to display the text that is shown in the tab (edit, tracker, ...) and if translated, you'll get the translation (bewerken, opvolgen, ...)

ednique’s picture

So that's all folks!

posts 20 untill this one give you a lot of changes.
Please apply all changes and new files in order for them to work.
Then check the new admin interface changes for user...

these are all for 4.7.x ONLY.

Chris Bray’s picture

Are these patches still the right way to add automatic paths for non-standard modules?

I'm running a small site a http://www.vwdrc.com
I've successfully added http://www.vwdrc.com/blog/username and I want to add http://www.vwdrc.com/contact/username

I'm running Drupal 5.1, does anyone know if these patches will apply cleanly?

dave reid’s picture

Status: Needs review » Fixed

4.x is no longer supported and these hooks are in the D5 and D6 versions.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.