Would love to customize that profile url when its not included in the user profile but on a separate page. Might even be rather useful with some tokens thanks.

Comments

fago’s picture

Title: Set profile url when not including it in the user profile. » Custom paths for profile pages

there is already an hidden option that allows you to do that, but no UI. The hidden option can be activated by exporting, adding it and re-importing though ;)

e.g. see the page-path in this export:

{
  "userCategory" : false,
  "userView" : false,
  "type" : "resume",
  "label" : "Resume",
  "weight" : "0",
  "data" : { "use_page" : 1, "page_path" : "resume" },
  "rdf_mapping" : []
}

I'd be fine with adding UI for that, but we need to properly validate that the input-ed path is not taken yet.

roam2345’s picture

awesomeness that suits me down to a T.

Lurdk’s picture

Could you guys ellaborare on this... i need this function too.

What to export? where to add? how to re-import...

also is their some kind of implementation to pathauto?

m4olivei’s picture

Been looking for support for aliasing profile2 pages. The most promising solution at this point seems to be to build in support for aliasing any entity into the pathauto module. It's only a concept for now though, but this will be the eventual solution I'm sure:

#1330546: Pathauto should work with all entity types

tinto’s picture

Thanks fago!

I'd love to see a more elaborate explanation or tutorial on how to implement this though.

Not sure what you mean by exporting and re-importing.

olafkarsten’s picture

  • goto "admin/structure/profiles" and setup your profile type.
  • click the link "export" (last link on right side)
  • you get something like
    {
        "userCategory" : false,
        "userView" : false,
        "type" : "your_profile_type",
        "label" : "YOUR PROFILE TYPE",
        "weight" : "0",
        "data" : { "registration" : 0, "use_page" : 1},
        "rdf_mapping" : []
      }
  • Add your path to the data row
    "data" : { "registration" : 0, "use_page" : 1, "page_path" : "YOUR/PATH" },
  • Copy the hold thing
  • goto "admin/structure/profiles/import" and paste in
  • don't forget to check "Overwrite"
  • done
Ale.bcn’s picture

Hi olafkarsten

that was exactly what I was looking for!

thank you!!

sslider999’s picture

Hello,

Thanks for the solution, worked gr8.

I was wandering if is possible to use PLACEHOLDER TOKENS in the path:

"data" : { "registration" : 0, "use_page" : 1, "page_path" : "contact/[random:hash:sha256]" },

I tried, but don`t generate the hash.

Thanks

aufumy’s picture

use Damien Tournaud's pathauto entities sandbox module to expose profile2 as configurable on the pathauto page.

also enable entity tokens module to expose profile fields as tokens.

thalism’s picture

+1

I need to change the path to something like members/[username]
the #6 seem to work, but how can i use tokens in the "page_path"?

chaseontheweb’s picture

This is the sandbox referenced in #10, in case anyone is looking: http://drupal.org/sandbox/damz/1332096 (related: #1330546: Pathauto should work with all entity types)

sk8erboi’s picture

@olafkarsten #6 i tried doing the same thing

Exported and added the following and imported

{
"userCategory" : false,
"userView" : false,
"type" : "resume",
"label" : "Resume",
"weight" : "0",
"data" : { "use_page" : 1, "page_path" : "resume", "page_path" : "user-profile" },
"rdf_mapping" : []
}

But i am not successful, i want a contextual filter to be added so that the current user can see the visiting user's profile!

How do i achieve this?

vinoth.3v’s picture

how to get it work for

view path: user/%uid/[profile_type]
edit path: user/%uid/[profile_type]/edit

possible ?

bisonbleu’s picture

Sorry if this is a stupid/obvious question, but can i perform the actions in #6 (export-modify-import) after the fact?

I already have some 60 profiles created on a production site. Will the 'export-import' trick break the existing profiles?

nickbumgarner’s picture

Issue summary: View changes

+1 to vinoth.3v

Solution #6 works mostly. The problem I'm currently facing is that the following path is no longer valid:

/user/123/profile/edit

The only way I can edit my profile now is through custom path I set for the re-import

/custom_path/123/edit

I want to utilize the back end of the site for editing the Profiles, but that path is now broken. Any suggestions?

portulaca’s picture

I changed the path setting as in #6, the menu item that uses [current-user:profile-alumni:url] token that worked under default settings, is still working and pointing to the new path.

I had to clear cache to get the new path to work, instead of the old one, to show the profile.

Here is what I used:

{
  "userCategory" : false,
  "userView" : false,
  "type" : "alumni",
  "label" : "Alumni",
  "weight" : "0",
  "data" : { "registration" : 0, "use_page" : 1, "page_path" : "alumni/profile" },
  "rdf_mapping" : []
}
portulaca’s picture

In combination with Menu token module the menu items that use profile2 tokens for URLs after changing the path to profiles don't follow role permissions ([current-user:profile-name]). Only user 1 can see those links, even though permissions are set correctly for viewing and editing own profiles for other roles.

Similar to #16, I can't "build" the path myself by using [current-user:uid] token, because Drupal complains:

The path 'Name' is either invalid or you do not have access to it.

gateway69’s picture

Which tokens can be used?

we have a path like this

/profile-business/48 with 48 being the profile.. however it would be great to list this as

/[uid]/business/[title of business field]

Also will this break all existing view/edit paths for anyone?