Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Biology Forums on September 02, 2016, 12:27:06 AM

Title: updateMemberData question
Post by: Biology Forums on September 02, 2016, 12:27:06 AM
Can we do the following:

updateMemberData($ID_MEMBER, array('posts' => '+30'))

To add 30 more posts instead of single increments like +.
Title: Re: updateMemberData question
Post by: vbgamer45 on September 02, 2016, 01:08:53 AM
try it and see what happens
Title: Re: updateMemberData question
Post by: Biology Forums on September 02, 2016, 01:50:57 PM
What it does is replace your posts with that number :(

Can we do a foreach statement based on the number you want to add to the user?

OR, perhaps change updateMemberData the function itself to recognize +#
Title: Re: updateMemberData question
Post by: vbgamer45 on September 02, 2016, 02:01:49 PM
in smf 2.0 i see code like this
updateMemberData($id_member, array('posts' => 'posts + ' . $posts));
Title: Re: updateMemberData question
Post by: Matthew K. on September 02, 2016, 02:04:54 PM
What that's doing is using the database column "post" and adding the value of the variable $posts to the column value, in that case, you're letting SQL do the math.
Title: Re: updateMemberData question
Post by: Biology Forums on September 02, 2016, 03:41:01 PM
Quote from: vbgamer45 on September 02, 2016, 02:01:49 PM
in smf 2.0 i see code like this
updateMemberData($id_member, array('posts' => 'posts + ' . $posts));

That works on 1.x too, thanks
Title: Re: updateMemberData question
Post by: vbgamer45 on September 02, 2016, 04:11:36 PM
Glad to help