Contact module support for pathauto.
seec77 - July 10, 2006 - 14:29
| Project: | Pathauto |
| Version: | 5.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | duplicate |
Description
This patch for "pathauto_user.inc" was made in approx. 30 minutes, and seems to work on my installation. Just copied almost line-by-line the code for the tracker module integration and modified it to support the contact module. I didn't have pathauto check to see whether a user has the contact form enabled, for the main reason that admins can also contact users who disabled the contact form. This code follows Drupal guidelines, as far as I can tell, and is really quite simple, but I don't have the arrogance to set it to "patch (ready to be commited)", partially because this is my first Drupal patch. Enjoy!
| Attachment | Size |
|---|---|
| pathauto_contact.patch | 2.4 KB |

#1
I'm very sorry, but as I said before this is my first Drupal patch of any kind. I missed the other feature request for this (here: http://drupal.org/node/59277), and opened a new issue for it. Sorry!
#2
Hello seec77 - this seems to be missing the delete functions. In the latest versions I have updated pathauto_user to delete the tracker aliases if they are enabled. Can you add that in to the code?
Thanks!
#3
Changing the status to reflect the last comment.
#4
Sorry for the late reply... I'll check it out right now! :)
#5
I have made a patch for 4.7.0 (pathauto_user.inc,v 1.12.2.1 2006/08/30 20:29:16) which allows to automatically create, update and delete aliases for the user settings pages, user contact and tracker pages if these modules are turned on. These patch delete tracker form from pathauto settings because tracker, contact and edit aliases will be created automatically from pattern of user path settings.
For example:
We have pattern for user account page paths:
user/[user]
When the new user will be created or pattern will be updated these four aliases will be created automaticaly:
user[uid] -> user/[user]
user[uid]/edit -> user/[user]/edit
user[uid]/contact -> user/[user]/contact
user[uid]/track -> user/[user]/track
#6
Is this going to be included?
I'm missing one more...
user/[user]/xtrack
#7
one more:
user/[user]/subscriptions
#8
@ednique - thanks for noticing those omissions. Perhaps you can amend this patch to include them or provide a test and review on the current code.
#9
@ednique - actually, both of those aliases are for non-core modules. They would need to be implemented via pathauto hooks in the xtracker module or via an include in the pathauto/contrib - but that's not something that belongs in this patch.
All the same - if you could test/review the patch that would be great!
#10
I'm pretty new here...
finding my way around...
learning a big deal about how this development is done...
and me like a lot... Those hook mechanisms are supurb...
As for the patch...
I dont have any patching setup ready for now...
but I manually applied the patch...
It works super!
all paths are created, no errors...
New users receive their paths...
Tracker is disabled as I use xtracker... and no tracker alias created... so that's also good...
One remark to make it even beter:
I translate all in dutch so "edit" is "bewerken" and "tracker" is "opvolgen"...
Also all paths to modules are translated like "search" is "zoeken"
It would be great if you could use that translated text...
isn't this done by simply
t("edit")??I hope it is...
maybe it isn't that simple... what if one language translates "edit" as "be wer ken"?
then I guess that would be /be-wer-ken...
#11
for the xtrack and submissions...
I saw the contrib directory...
Is it their that it has to come?
currently event and i18n is in there...
Or does it need to be coded inside the xtracker and subscriptions module?
#12
Why isn't this topic inserted in "my recent posts"???
#13
@tundrageek - your patch file is in the wrong format - please use the instructions at http://drupal.org/diffandpatch to create patches
That said, thanks very much for the contribution. Unfortunately this seems like it breaks with the way that pathauto works. Your patch removes the ability to define the path and instead hard-codes the exact path. In the current tracker area we are able to set user/[user]/observe or whatever other localization/personalization we desire. In your patch we lose that configurability for tracker and for the other paths - someone may want to do a user/[user]/modify for the edit tab which gets lost in this patch.
@tundrageek and @seec77 - please followup with your intentions to continue working on this issue.
@ednique - it could be in the contrib directory (as you have provided, I'll review that soon). As to why these issues don't show up in your tracker - it's a deficiency in the Drupal Project module and dww is working on it. Should be fixed shortly, I believe, which is very exciting. It's been a long time coming.
#14
My remark indeed proves the need of flexibility as I wanted [user]/bewerken instead of [user]/edit
You say: someone may want to do a user/[user]/modify for the edit tab which gets lost in this patch...
Do you mean that this is currently possible?
If so, where? How?
#15
It's possible in this patch if you edit the code, but the ability to change those settings is not exposed to the admin through the UI. In my opinion it should be exposed to the admin - hence the "code needs work" status.
#16
Ok I see...
And yes, I did change the code in the patch to
path_set_alias($src.'/edit', $alias.'/'.pathauto_cleanstring(t('edit')));But as you stated, an admin interface would be better to let any user have their own choice of naming...
#17
The user tabs are dealed with in th solution you can find here:
http://drupal.org/node/89906
#18
I came across this on Google as the first result for "drupal pathauto contact." I needed a way to alias individual contact pages and this seemed the closest way to do it. However, this is for Drupal 4.7, and I have 5.2 installed. I worked through it and updated some code so that it works with 5.2 (attached). I also corrected a few lines that were still in relation to the tracker code. Anyway, just add the two blocks of code included to your pathauto_user.inc and you're all set.
I hope someone else finds this useful!
#19
I'm marking this as a duplicate of http://drupal.org/node/183625 only because it has a slightly better patch i.e. it's a patch, not just a text file ;)