Webmastersite.net
Register Log In

Paul, simple customization
Member Link Credit field

Comments on Paul, simple customization

Thermit
Member

Usergroup: Customer
Joined: Oct 25, 2004

Total Topics: 8
Total Comments: 28
Thermit
Posted Dec 14, 2004 - 9:30 PM:

(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!
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Dec 17, 2004 - 4:31 PM:

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; "
Thermit
Member

Usergroup: Customer
Joined: Oct 25, 2004

Total Topics: 8
Total Comments: 28
Thermit
Posted Dec 19, 2004 - 8:37 PM:

Thank you Paul that info was very useful!
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.