• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.3 Copy "location" data to a custom field

Nudaii

Well-known member
#1
is there a way to copy the contents of the "location" field to a custom profile field?

If so what would be the SQL query?
 

Jake Bunce

XenForo moderator
Staff member
#2
Usually people go the opposite direction:

http://xenforo.com/community/thread...to-xf-stock-location-field.22221/#post-279132

If you want to go location to custom field then use this:

Code:
UPDATE xf_user_field_value AS ufv
SET ufv.field_value = (
	SELECT up.location
	FROM xf_user_profile AS up
	WHERE ufv.user_id = up.user_id
)
WHERE ufv.field_id = 'customfield';
Then rebuild the user cache:

Admin CP -> Tools -> Rebuild Caches -> Rebuild User Caches

Backup to be safe.