Creating a CUSTOM URL for users/members

18 years 3 months ago #2517 by nbarfoot101
Creating a CUSTOM URL for users/members was created by nbarfoot101
Hey everyone,

Im looking to do something pretty specific here, and i just want to know if its possible, and if it is, how i can do it.

I want members of my site to get a custom URL that is assigned when they register to become a member (i am using community builder RC2), and it would entale creating something such as:

(after they sign up they get)

www.mydomain.com/USERNAME

where username would be the one they sign up with, and it would take the browser to that users page in community builder, their profile with thier picture, blog etc.

I HAVE the PHP code to do it, so that it writes to the htaccess and creates a new rule.

My only problem is, where do i put it?

I would have to put the code right where they sign up, and there member data gets inserted?

Any ideas.


thanks.

Please Log in to join the conversation.

18 years 3 months ago #2519 by mikko
Replied by mikko on topic Re:Creating a CUSTOM URL for users/members
You could either make a custom plugin with your code (see the plugin docs), or use SEF and alias component (search for alias niin mamboforge), or make custom redirection by making a directory for each user and having that directory to redirect to the profile at index.php

Making the plugin would be the most elegant way to do this.

mikko

Please Log in to join the conversation.

18 years 2 months ago #3100 by nbarfoot101
Replied by nbarfoot101 on topic Re:Creating a CUSTOM URL for users/members
How exactly do you make a plugin?

I have the code done, but i have NO idea how to make a plugin?



Also, wouldnt it be easier, just to find the part of the code where member data is stored in the database, and execute the code right there?

Please Log in to join the conversation.

18 years 2 months ago #3102 by trail
Replied by trail on topic Re:Creating a CUSTOM URL for users/members
Ehm.. this idea has been suggested and developped by me in RC1, after wich it was perfected by the core dev and incorporated in RC2.

To enable this you just have to use MOD_REWRITE (if you can do sef you can do this to) and add this line to your htaccess

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ /index.php?option=com_comprofiler&task=userProfile&user='$1' [L]

RC2 is expecting you to do this and will pick up your userprofile...

Post edited by: Trail, at: 2006/01/03 11:52

DJ Trail.
CB Co-Founder & Test-Lead.
Plugins: My Age , Starsign Matchmaking Horoscope , My Visitor , My Highscores , My ProfileID ,
My Components: Import & Invite Karma Casino (Use Test / Test)
My Modules: Many :)

Please Log in to join the conversation.

18 years 2 months ago #3127 by nbarfoot101
Replied by nbarfoot101 on topic Re:Creating a CUSTOM URL for users/members
WOW.


thank you. you are the man.
It works perfectly.

Please Log in to join the conversation.

18 years 2 months ago #3149 by rembrandt
Replied by rembrandt on topic Re:Creating a CUSTOM URL for users/members
In my htaccess file I already have the rule below. Do I just add your rule below the existing one, or replace part of it?

# Rules
#

RewriteCond %{REQUEST_FILENAME} !\.(jpg|jpeg|gif|png|css|js|pl|txt)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.231 seconds

Facebook Twitter LinkedIn