vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   User MOD Rewrite (https://vborg.vbsupport.ru/showthread.php?t=81914)

altsounds 05-22-2005 10:00 PM

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.

Paul_d_g 05-23-2005 08:03 PM

Screenshots?

altsounds 05-23-2005 08:04 PM

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}.

nexialys 05-23-2005 08:10 PM

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...

altsounds 05-23-2005 08:15 PM

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.

Lionel 05-23-2005 09:36 PM

Problem with this hack, everything under is subjected to it, such as /forums/gallery tells you user has not registered

altsounds 05-23-2005 09:43 PM

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.

Lionel 05-23-2005 10:00 PM

ok, thanks. I will put the trailing slash in the links because I like your hack.

nexialys 05-23-2005 10:39 PM

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
RewriteRule (^[-_0-9\ ]*$) member.php?userid=$1


altsounds 05-24-2005 01:49 AM

Quote:

Originally Posted by Lionel
ok, thanks. I will put the trailing slash in the links because I like your hack.

You should always make sure you put the trailing slashes in just to make sure ;). If you installed the hack please click install as this is my first hack and I would love to see how many people actually end up using this hack.

altsounds 05-24-2005 01:52 AM

Quote:

Originally Posted by nexialys
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
RewriteRule (^[-_0-9\ ]*$) member.php?userid=$1


Nexialys thanks again for making sure everyone is happy. I appreciate that. Follow Nexialysis' mod of this hack if you want to do it by userid too.

Lionel 05-24-2005 02:03 AM

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.

ericgtr 05-24-2005 02:11 AM

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

altsounds 05-24-2005 01:02 PM

Eric cool MOD, I will be using this for sure.

Boofo 05-25-2005 01:27 PM

Will they still get the appropriate error message if they are now allowed to view profiles, like Guests, or will this bypass that?

altsounds 05-26-2005 06:10 PM

Quote:

Originally Posted by Boofo
Will they still get the appropriate error message if they are now allowed to view profiles, like Guests, or will this bypass that?

Haven't tested this but you should still get the same message regardless of whether or not you are a guest or a registered visitor. Basically letting you know that the member doesn't exist.

T3MEDIA 05-26-2005 06:48 PM

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
?

altsounds 05-27-2005 05:20 PM

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?

Lizard King 05-27-2005 08:09 PM

Working pretty good thanks :)

Jolten 05-28-2005 12:20 AM

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.

altsounds 05-31-2005 05:13 PM

Quote:

Originally Posted by Jolten
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.

There is a lot of call for people just be able to do sitename/username . You have to understand that most users of websites want to direct link to their profiles but have no idea how. This little hack makes people linking to their profiles and sharing it with friends that much easier.

blueuniverse 06-20-2005 09:24 AM

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 ##############  -->
ABOVE add

Code:

<!-- Start modrewrite usercp add - by ed -->
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tbody id="collapseobj_usercp_proflink" style="$vbcollapse[collapseobj_usercp_proflink]">
<tr>
        <td class="alt1"><strong>Link to profile: </strong><a href="$vboptions[bburl]/$bbuserinfo[username]">$vboptions[bburl]/$bbuserinfo[username]</a></td>
</tr>
</tbody>
</table>
<br />
<!-- End modrewrite usercp add - by ed -->

Note - edited it to add the $vboptions[bburl] suggested by nexialys. Thanks. :)

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.

altsounds 06-21-2005 02:06 PM

Nice add on ed. I have already done this on my site but for those that haven't this is of course beneficial.

nexialys 06-21-2005 02:12 PM

YOURBOARDURLHERE can be replaced by : $vboptions[bburl] ... that's the goal of that variable!

blueuniverse 06-21-2005 06:05 PM

Ok, I edited it to include that. Thanks :D

amykhar 07-10-2005 02:34 PM

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

altsounds 07-15-2005 08:05 PM

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.

Kirk Y 07-20-2005 02:26 AM

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?

KTBleeding 07-20-2005 03:08 AM

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?

Kirk Y 07-20-2005 03:58 AM

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.

KTBleeding 07-20-2005 04:39 AM

Quote:

Originally Posted by acidburn0520
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.

I can't confirm this: The %20 works just fine for me so far.

loftyasianz 07-25-2005 09:49 PM

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.

Q-v-n-s-Q 07-28-2005 05:05 PM

Quote:

Originally Posted by loftyasianz
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.


* BUMP

loftyasianz 07-28-2005 05:17 PM

thanks ricky. lol i guess you're having the same problem too.

poetic 08-08-2005 03:09 PM

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

deathemperor 10-13-2005 02:50 PM

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

altsounds 11-11-2005 05:15 AM

Quote:

Originally Posted by KTBleeding
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?

Yes, it is recommended tha you run another hack on here for no Special Characters in usernames. Add that hack to stop your users being allowed to add special characters to their usernames. This is pretty much an essential addon hack needed to get the full functionality of this and so you get no 404 erros. I will see if I can find it and post the link here. If anyone finds it b4 me feel free to post it here.

altsounds 11-11-2005 05:19 AM

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:

Originally Posted by loftyasianz
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.


vau7 11-11-2005 06:18 AM

Could work for 3.5, or?

Inferno Dragon 12-14-2005 02:55 PM

^ 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
  • Page Generation 0.01325 seconds
  • Memory Usage 1,830KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete