create alias for content profile automatically

speersd's picture

I am trying to figure out how to get an alias to be automatically created for a user's content_profile (6.x-1.0-beta4) when they create or edit the profile, but without giving them the option.

Right now, if I set their user role to have permission to create a path alias, then they get a fieldset where they can choose to either have an automatically created alias, or type in one of their own. If I take away their "create url aliases" permission then they do not get this fieldset, and no path is created for them when they create or edit their profile.

Is there a way to automatically create their alias without them having the option, when they create or edit their content profile?

I am using pathauto 6.x-1.2 and Drupal 6.14.

Comments

marshallexcavating's picture

Have you found out how to do this ? I am also trying to get this to work. I'm using the content_profile-6.x-1.0-beta4 and pathauto-6.x-1.2 module with Drupal 6.13.

The only way I can currently get a new users node (profile) assigned a alias is to administrate a "Bulk generate aliases for users that are not aliased" after thy create there account, not a practical solution.

Thank you for any help.

Count me in.

jjarvis98's picture

I'm trying to do a similar thing. I have the email_register module and content_profile. Part of the custom profile is First and Last names. I use the email_registration_name hook to set the username to 'first.last' and then with increasing numbers if it exists.

My problem is, the user alias is created before all of this so the user page is something that the drupal password generator created

'/user/r5l7bzsefm' etc

Since I can't seem to find a simple hook to do it. I even tried inserting this at the end of the 'insert' op of email_registration

<?php
      db_query
("UPDATE {users} SET name = '%s' WHERE uid = '%s'", $namenew, $account->uid);
     
$account->name = $namenew;
     
#
     
$placeholders = pathauto_get_placeholders('user', $pathauto_user);
      
$placeholders["values"][33]=$placeholders["values"][34]=$newname;
     
$src = 'user/'. $user->uid;
      
$alias = pathauto_create_alias('user', 'update', $placeholders, $src, $account->uid);
      
#
?>

But it hasn't had any affect. Both Anon and Auth users have permission to create nodes.

It'd be great if i could also regenerate their /content/ page.

How i got it to work in my set up

marshallexcavating's picture

I had to given permission to anonymous users to the fields that i have set up in the profile module; now when thy sign in the pathauto module is assigning the set aliases to that user. I did have to clear the cash for this to start working for my setup.

Hope this is help full

You can hide that setting from them

ITMonkey's picture

I know that I'm a bit late on the scene, but if you still want to do this, if you install the formfilter module and enable the UI you can very simply grant them permission to create url aliases but hide the url alias settings.

Once you enable Formfilter and Formfilter UI there will be a 'filter this form' link at the bottom of each page you visit with fields, use this to hide the settings you don't want them to see.

Thanks ITMonkey, that's just

speersd's picture

Thanks ITMonkey, that's just what I needed!

Paths

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: