(BTW, I love my the WSN software more and more! Thanks.)
I've added a new numeric member field called MEMBERCREDITS.
Two simple things I'd like to automate with this field.
1. Set it to X when the user registers.
2. Have it decrement by 1 on each link submission.
I figure there will be some new code in member.php addlink(), but it depends on predefined member field globals and I'm not sure how to correctly make the modifications for this custom field.
function addlink() { global $plurallinks, $db, $newid; // incriment counter $this->$plurallinks = $db->rowitem($db->select($plurallinks, 'memberstable', $newid .'='. $this->id, '', '')); // I have absolutely no idea how this can be needed, but it is $this->$plurallinks += 1; $this->update($plurallinks); return true; }
Do I need to add another global $plurallinkcredits and a similar object member? If so, where?
Can I get away with just changing the DB value and not the member value, so I don't have to add it? I guess the first arg to the db->select is the field name?
Comments on Paul, simple customization
Member
Usergroup: Customer
Joined: Oct 25, 2004
Total Topics: 8
Total Comments: 28
(BTW, I love my the WSN software more and more! Thanks.)
I've added a new numeric member field called MEMBERCREDITS.
Two simple things I'd like to automate with this field.
1. Set it to X when the user registers.
2. Have it decrement by 1 on each link submission.
I figure there will be some new code in member.php addlink(), but it depends on predefined member field globals and I'm not sure how to correctly make the modifications for this custom field.
function addlink()
{
global $plurallinks, $db, $newid;
// incriment counter
$this->$plurallinks = $db->rowitem($db->select($plurallinks, 'memberstable', $newid .'='. $this->id, '', '')); // I have absolutely no idea how this can be needed, but it is
$this->$plurallinks += 1;
$this->update($plurallinks);
return true;
}
Do I need to add another global $plurallinkcredits and a similar object member? If so, where?
Can I get away with just changing the DB value and not the member value, so I don't have to add it? I guess the first arg to the db->select is the field name?
And how would I setup a default value?
Thanks so much!
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
I guess your mysql field name is credits.
1. Use in your registration template.
2. Doesn't depend on any such thing. Simply
$this->credits += 1;
$this->update('credits');
just put it above the " return true; "
Member
Usergroup: Customer
Joined: Oct 25, 2004
Total Topics: 8
Total Comments: 28
Thank you Paul that info was very useful!