vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Change Username Hack (https://vborg.vbsupport.ru/showthread.php?t=24582)

Scott MacVicar 08-04-2001 11:32 PM

I wrote a small modification to allow users to change their usernames, they can change their username ok and post at the forums etc.

BUT when they go to view a forum where only admins and moderators can post they get the standard No Permissions or You need to be registered error.

Dennis Wrenn 08-05-2001 12:16 AM

Well, that's perfectly normal. If the forum is only for Administrators and Moderators, then they shouldn't be allowed to view it.

Do you want them to be able to view - but not post in the forum?

Scott MacVicar 08-05-2001 12:41 AM

sorted now :)

i had it set on private forum =/

Admin 08-06-2001 04:47 AM

Can you release your hack?
It sounds nice, and very useful. :)

Scott MacVicar 08-06-2001 05:48 AM

Instructions are in the file. Isn't too hard to install.

If you need any help just post back here.

Look at http://vbulletin.com/forum/showthrea...threadid=24722 latest verion from there

RobAC 08-06-2001 06:50 AM

If a user has...say....20 posts, and they go and change their username, do all their posts automatically update with the new username? If you have a members only board with a lot of members and you have several members changing their usernames, you're probably going to have problems with posts having invalid usernames, etc., unless you periodically update user info, post counts, etc., via the Admin CP.

Admin 08-06-2001 07:21 AM

The user's ID does not change. Everything the user has posted before is associated with his ID, including his username.
So yes, all of past posts and everything else will have the new username.

Scott MacVicar 08-06-2001 07:25 AM

Nope, only the user ID is stored in the thread table not the Username. So when the username changes, it changes it for all posts made by the user.

Dimitri 08-06-2001 08:14 AM

I get the following error after applying the hack to member.php:
Code:

Parse error: parse error in /---removed---/member.php on line 1298
I am using 2.0.3 so I'm not sure if that's the problem.

Admin 08-06-2001 08:25 AM

Dimitri, this is the code you will need to paste:
PHP Code:

  if ($username != $bbuserinfo[username]) {
    
$username trim($username);
    
$username eregi_replace("( ){2,}"" "$username);
    if (
$checkuser=$DB_site->query_first("SELECT username FROM user WHERE username='".addslashes(htmlspecialchars($username))."' OR username='".addslashes(eregi_replace("[^A-Za-z0-9]","",$username))."'")) {
      eval(
"standarderror(\"".gettemplate("error_usernametaken")."\");");
      exit;
    }
    }
    else {
      
$DB_site->query("UPDATE user SET username='".addslashes(htmlspecialchars($username))."' WHERE userid='$bbuserinfo[userid]'");
      
$bbuserinfo[username] = $username;
    } 

PPN forgot to close one IF statement.

Scott MacVicar 08-06-2001 08:37 AM

my bad :p

updated txt file and reloaded it

i just copied and pasted from my member.txt file, never bothered to check the code i had copied -_-

thanks for pointing it out firefly

Admin 08-06-2001 08:57 AM

No problem. :)

Great hack, you should release it! :D

Dakota 08-06-2001 03:39 PM

Is there a way that you could require a certain post count before a user can change their name?

Scott MacVicar 08-06-2001 07:19 PM

ok updated so you can set a amount of posts needed before they can change username, look at

http://vbulletin.com/forum/showthrea...threadid=24722

for latest version

Wayne Luke 08-06-2001 09:14 PM

Hmmm doesn't leave a whole lot of consistency..

Anyway, you don't need a Hack for this. You should require at least one field (username) to remain constant. You can then give the members a display name which they can change at will. All without hacking needed at all.

Go into the Admin Control Panel and scroll down to the User Profile Field section.

Create a new field called display name and make it required.

Then edit your templates to display this value instead of the username.

Same effect, no hacking, no mess.

It will require hacking to change it based on posts though.

Santa 08-07-2001 05:16 AM

Can u please tell me, which templates I must edit ??? I think this will be not only one or two :) ?

Many Thx


Santa

Admin 08-07-2001 06:03 AM

You need to edit the postbit template.

Santa 08-07-2001 06:06 AM

many thx for this fast answer

Santa


All times are GMT. The time now is 03:51 AM.

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.01143 seconds
  • Memory Usage 1,751KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (18)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete