vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Help with a mysql query - replacing field (https://vborg.vbsupport.ru/showthread.php?t=278466)

nlpc 02-12-2012 01:05 PM

Help with a mysql query - replacing field
 
Can anyone help me? I want to give everyone using my forum a new username, based on their real name. Their real name is stored in the database as two custom fields. So I want to replace all existing usernames with [customfield1]_[customfield2].

That's their firstname_lastname. (e.g. Jane_Doe).

Does that make sense? Anyone know how to do it? :)

kh99 02-12-2012 01:18 PM

You could change the user table with a query, but there are a bunch of other tables that have a username. I think the best thing to do would be to write a script that uses the data manager to change the username. It would basically be

Code:

for each user
  fetch userdata
  create User data manager
  set existing
  set new username
  save


nlpc 02-12-2012 02:17 PM

How would I do that?
I'm not familiar with writing scripts like that

Simon Lloyd 02-12-2012 02:58 PM

Can't you use the replcement variable manager? so say find text "[musername]" and replace with "[customfield1]_[customfield2]"

I've never used it but it's just a thought :)

nlpc 02-12-2012 04:31 PM

That would be really great but I don't think all the vbulletin pages get the customfield data. It's pulled into showthread but I don't think it's pulled into all pages.

I would be even happier to do it that way if I could make the pages get the data.

Anyone know how?


All times are GMT. The time now is 07:18 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.00894 seconds
  • Memory Usage 1,711KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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