3

What's the best solution to let Members choose their own url-segment to display its profile?

I'm already using Solspaces «User» and «Zoo Visitor» as well as custom builded templates for profiles (like: domain.com/profile/1 … therefore no ee-templates like /member or /forum/member).

I would like to provide a text-field, where the members can define a url-segment like «macsteve» instead of the User-ID -> domain.com/profile/macsteve instead of domain.com/profile/6547

EDIT: If I use the native user_name-field as the url-segment for the profile-page I can edit mod.channel.php to update the {profile_path}-tag to display the username instead of the member_id … but I'm struggling with profile_path in the forum-module… does someone already did these edits and may share where to edit the forum-files/-paths to get the username instead of author_id into the profile-paths?

EDIT 2: Found it: mod.forum_core.php line ~4090 change:

'path:member_profile' => $this->profile_path($row['author_id']),

… to:

'path:member_profile' => $this->profile_path($this->EE->db->query("SELECT username FROM exp_members WHERE member_id = ".$row['author_id'])->row('username')),

… you may need to change some other profile-path-variables in mod.forum_core.php — since we've wrote a KISS-and-table-less forum template we need to change only this one declaration.

1
  • instead of an extra query to SELECT username by id, you could var_dump user-data or member-data and maybe session-data to look around a bit. i'm guestimating that the username might already be set in there.
    – GDmac
    Feb 7, 2013 at 10:43

3 Answers 3

2

i would go for the "username", and use that for the url-segment. All member add-ons including the 'official' one (as well as free_member) support changing the user_name

The main benefit is that the user_name field already has validation in place to check that the entered name is unique and that it is a valid url (characters).

1
  • thx @GDmac, I'm going with the 'native' username-field and use it as the url-segment — thats seams logical ;-) … but I'm now struggling with forum-pathes -> have a look at my edit
    – albuvee
    Feb 1, 2013 at 12:50
2

We do this on devot:ee with some PHP, which we could (and probably should) turn into a plugin. You can read more about it in this devot:ee news article from August 2009: New Feature: Custom Member Profile URLs. We let the user store info in one of the native member profile fields. We have a check in place to make sure they can only edit it once, and have an AJAX lookup on it to make sure they don't select something already taken.

We are not currently using any other member management-related add-ons other than User, and we don't even use that much.

I can't speak to your forum paths questions, because we're not using the forum profile page at all. We've hacked the forum to pieces and stripped out a bunch of things that were unnecessary for us in how we were using it. We're running the support "forums" through a normal template so we can do more with them.

1
  • I see, thank you Ryan for your insights! If I use the username-field, the «already taken»-process is already given (as @GDmac pointed it out). I've edited the forum templates heavily too, but still use the forum template system (analogue to EEs template system) … I've now got the problem that there is no «username» available where the profile_path is created. Well, somehow I will find a way around this too ;-) … alright, thank you for your insights again …
    – albuvee
    Feb 1, 2013 at 15:35
1

If you are using Zoo Visitor, their username becomes their url_title. This normally happens automatically, behind the scenes when the user registers, but unless the Documentation says elsewise, than the user should be able to modify the url_title after the fact.

Update: There maybe some parity required between username in the Zoo Visitor channel to work with the EE Member Registration. So to allow editing, you should probably use the Zoo Member update form, rather than say, just SafeCracker.

1
  • thx @nonprofit_tech, I'm going with the 'native' username-field and use it as the url-segment … but I'm struggling with forum-pathes -> have a look at my edit
    – albuvee
    Feb 1, 2013 at 12:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.