![]() |
User MOD Rewrite
This is a pretty simple hack but is designed so that you can access members profiles quickly and / or your members can have an easy link to pass around for their user profile.
STEP 1: If you don't have one already create a file named .htaccess in your forums root directory. STEP 2: Paste the following code within that file: ## Altsounds.com Member re-write Hack Version1 ## All music fans should check out altsounds.com for lots of free music to listen to!! # turn the Apache MOD_REWRITE engine on RewriteEngine On # this first rule will catch the "blank" entry into the # Forums directory, taking the user to the main forum page - change as appropriate RewriteRule ^$ hangout.php # this next entry will catch everything else and pass # it to the member.php engine for processing in # the "member" section RewriteRule (^[-_A-Za-z0-9\ ]*$) member.php?&username=$1 That's it! My main forum page is hangout.php. So you should change that within the code above to whatever your forum main page is (usually index.php). Now all your members links to their profile is {link to forum}/{username} or {link to forum}/{userid} e.g. in my websites case http://hangout.altsounds.com/altsounds or will take you directly to the username "altsounds" user profile. If no profile is available (i.e. a member is not registered) you will get the appropriate error message. Simple but cool. Hope you all enjoy. |
Screenshots?
|
Well there aren't really any because all this is doing is allowing you to type in username after your forum address to go directly to a users profile making it easy to link to and lookup users profiles.
Rather than having to type in {forumaddress}/member.php?username={username}. Now you can just type {forumname}/{username}. |
NOTA: you need MOD_REWRITE to be activated in your Apache installation... not all Hosts permit this... verify before making any complain here that it's not working properly...
|
Yeah thanks nexialys for that good point. If this hack doesn't work for you it means that you don't have MOD_REWRITE activated in your Apache installation and the hack won't work period.
|
Problem with this hack, everything under is subjected to it, such as /forums/gallery tells you user has not registered
|
Not if you place the trailing slash at the end of the directory e.g. /forums/gallery/ will still take you to gallery. No slash takes you to the user profile trailing slash takes you to the driectory you want and, if you link directly to a PHP file that works fine too.
|
ok, thanks. I will put the trailing slash in the links because I like your hack.
|
a little modif here, so everyone is happy...:
ifyou want your users to be located also by their userid instead of just their username, change the last line with: Code:
RewriteRule (^[-_A-Za-z\ ]*$) member.php?username=$1 |
Quote:
|
Quote:
|
I have the guestbook/homepage hack installed, the modified version that displays it on a separate page; so what I did was a htaccess from root to display members webpage and another one at forum root to display the profile.
I learn something today and I started to change all my directory links to reflect the trailing slash. |
altsounds, nice mod! I also really dig your site, it looks like you are using jamroom? I wrote up a little something so your vb members can add their jamroom album to under their avatar in the postbit, here's the link to it on the jamroom site http://www.jamroom.net/phpBB2/viewtopic.php?t=2910
|
Eric cool MOD, I will be using this for sure.
|
Will they still get the appropriate error message if they are now allowed to view profiles, like Guests, or will this bypass that?
|
Quote:
|
They get the error I just wish this worked more smoothly. A lot of links come up dead after doing this.
isnt there a wildcard version to this that makes your site a subdomain? username.yoursite.com ? |
As discussed earlier, if your directory links have a trailing / you should have no problem, you should be putting / into links that are directories anyway.
Hope that helped? |
Working pretty good thanks :)
|
This is sort of overkill. There are two ways to access user profiles built in, ID and username.
the parameter for id is member.php?u=Userid the parameter for username is member.php?getinfo&username=username You do not need to mod rewrite it. |
Quote:
|
Just to make things even easier for the members (something that is needed on my boards, you can add a link to their profile on the main usercp page). This is what suited me best, but I thought it might be wortwhile posting it here so some of you guys could possibly make use of it.
Anyway, it's just a simple template edit. Go to the template USERCP. Then do the following. Find Code:
<!-- ############## SUBSCRIBED THREADS ############## --> Code:
<!-- Start modrewrite usercp add - by ed --> Also, it should be noted that the bit of code there only works when you do the username mod_rewrite. If you did the userid mod_rewrite then replace $bbuserinfo[username] with $bbuserinfo[userid]. I haven't tested that, but I'm pretty sure it should work. |
Nice add on ed. I have already done this on my site but for those that haven't this is of course beneficial.
|
YOURBOARDURLHERE can be replaced by : $vboptions[bburl] ... that's the goal of that variable!
|
Ok, I edited it to include that. Thanks :D
|
There's a bug, gang. The username is working. The userid isn't. It's going to a user not found page because it can't find a user with a number name.
Amy |
Thanks for letting me know Amy. The userid thing was added by another user, not me. My original was specifically so that you could do username.
|
The UserID works for me, as does the member name. This is very neat.. the only thing I didn't like was the trailing slash, but I'll just get used to it!
@Amy: Could it be something with your mod_rewrite? |
Pretty cool mod..
I did notice a problem though. If a user has a "." in their name, it will not work. I'm pretty sure this is an obvious error.. Would there happen to be a fix for this at all? |
I also noticed that if the user has a space in their name, it doesn't work. A %20 is added in its place... and won't work.
|
Quote:
|
this hack is very usefule thank you. it will work PERFECTLY when vBSpace comes out. where the users can have a http://www.yoursite.com/username. awesome!
vbspace here -> https://vborg.vbsupport.ru/showthread.php?t=82930 edit: one of my members noticed something after i installed. i have vba cmps installed on my forum so i put the .htaccess file in the root directory, edited hangout.php to forums/index.php and members.php to forums/members.php so users can have www.mysite.com/username. but when one of my members was playing around with it he noticed that if you do so it goes to the user's profile but then all of the images that are comming from image.php are comming up broken. does anyone know how to get around this? thanks in advance. |
Quote:
* BUMP |
thanks ricky. lol i guess you're having the same problem too.
|
what if they have different characters than "(^[-_A-Za-z0-9\ ]*$)"
how can we make it so people with all different characters can use it |
great hack.
how about if the link site.com/usernamewhatever doesn't return a match username it will then check if there is a folder with the name usernamewhatever ? well I think it's ok without that /me clicks install |
Quote:
|
This would not be due to the hack. MOD rewrite does nothign to your code it meerly takes a string and based on the criteria (or lack thereof) returns a users profile or appropriate error message.
You might want to try (don't know if this will do anything) to put the links as full URLs e.g. http://blahblahblah/forums/member.php. Other than that I'm not sure why this may have happened and as I said above this hack does not change your vbulletin setup or configuration at all. Quote:
|
Could work for 3.5, or?
|
^ yes..It will work! I am sure about it :D
|
All times are GMT. The time now is 04:54 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|