PDA

View Full Version : How to Update Custom Profile Fields (solved)


shlomot
06-26-2008, 01:18 PM
Hi. After completing a set of calculations in a PHP file (as a CMPS module), I'm trying to commit the results into a few custom profile fields for the current user.

I've read all posts and articles, but still without success. My last code is:

$query = "UPDATE vbulletin_prefix_userfield
SET field75 = $intimacy_score, field73 = $intimacy_level, field76 = $intimacy_status
WHERE userid = $vbulletin->userinfo['userid']";


Please help. Thank you.

--------------- Added 1214541980 at 1214541980 ---------------

I was helped by Ideal Web Technologies who reminded me to add the following statement after the query definition:

$vbulletin->db->query($query);

Thank you, Tim, so very much.

Unfortunately, I couldn't make do with vbulletin_prefix_userfield, vbulletin_prefixuserfield, or .table_prefix.
Maybe CMPS cannot read these globals.
So the final script looks like this:

$query = "UPDATE userfield
SET field75 = $intimacy_score, field73 = $intimacy_level, field76 = $intimacy_status
WHERE userid = $user_id";
$vbulletin->db->query($query);

Ideal Web Tech
06-27-2008, 03:48 AM
No problem glad we got it fixed for you. :)

Dismounted
06-27-2008, 10:03 AM
The User datamanager should be used when dealing with user data.

shlomot
06-28-2008, 03:27 AM
Can you please explain.

The User datamanager should be used when dealing with user data.

Dismounted
06-28-2008, 04:56 AM
<a href="http://www.vbulletin.com/docs/html/data_managers" target="_blank">Data Managers</a>

shlomot
06-28-2008, 05:18 AM
Many thanks, but as a non-technical, doing-the-best-I-can-to-get-by type of a person, I beg you to translate the above statements to appropriate data_manager ones. I'll take it from there to be implemented all around, and so will so many other vBs who recognize the importance of using these classes.

The Data Managers manual is overwhelming at best:)

Data Managers (http://www.vbulletin.com/docs/html/data_managers)