1
Poslanik
Adding points to users
  • 2005/10/30 10:11

  • Poslanik

  • Just popping in

  • Posts: 95

  • Since: 2005/2/11


Hello there,

I'm in need of a module that would make it possible for me to add points to users I want and then they'll be able to see it in their account info. Why do I need this? Well I need it for my site in which I plan to give points to users who write stories, post a lot, come to events, etc.

How should it work?

In the administration section I should be able to open the module control panel. There should be a listing of all members of my site, and I should be able to add points to them via some form.

When I add points users should be able to see them in their account info.

I'm not a php expert but I take it the control panel should not be hard to code, but making the users see their points in their acc info will be a bit more complicated. But in any case it does sound easy enough from what I can tell.

I can't offer some big rewards for this, but what I can do is link your site on my site with a 88x31 image or bigger once the site goes online. I have big plans for it and it will be highly visited, but I don't know the exact date when it goes public.

I hope someone helps me.

2
DCrussader
Re: Adding points to users

There is allready such module, called userpoints, works with XOOPS up to 2.0.13, not confirmed compatibility with 2.0.13.2 and 2.2.3a
May The Source Be With You!

3
Poslanik
Re: Adding points to users
  • 2005/11/15 8:42

  • Poslanik

  • Just popping in

  • Posts: 95

  • Since: 2005/2/11


No there isn't. That module gives you points for posting etc, I need to be able to add points to users via some interface, not automatically for every post they make.

4
fo-fo
Re: Adding points to users
  • 2005/11/16 19:39

  • fo-fo

  • Just popping in

  • Posts: 34

  • Since: 2005/4/13


you can do it in .php coding. look up 'mysql' and you'll find a lot of snippets you can use.

1. you'll need to set up a database row 'userpoints' manually (e.g. in phpAdmin) or by php code

2. then list your users

Quote:

$result = mysql_query("SELECT * FROM ".$xoopsDB->prefix("users")." ");
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$user = mysql_result($result, $i, "user");
echo "<tr><td>";
echo "<a href=\"addpoints.php\">$user";
echo "</td>";
$i++;
}


3. add points on 'addpoints.php' (this adds 100 points to MikeJones)

Quote:

$addpoint = 100;
mysql_query("UPDATE ".$xoopsDB->prefix("userpoints")." SET points='$addpoint' WHERE username='MikeJones'");


there are many ways to do it, you know how you need them
these examples might contain syntax errors and are only approximately correct

5
Poslanik
Re: Adding points to users
  • 2005/11/18 7:25

  • Poslanik

  • Just popping in

  • Posts: 95

  • Since: 2005/2/11


Can I print the points this way too? Because I need them to show in the "view account" section.

Also, if I write another line like you did which adds 100 pts to MikeJones, will MikeJones have 200 points then? What I mean is, do points sum up?

6
fo-fo
Re: Adding points to users
  • 2005/11/27 15:55

  • fo-fo

  • Just popping in

  • Posts: 34

  • Since: 2005/4/13


you probably know by now...

echo "$points";
will print the value of $points on a .php page.
if you want it to show in the member account section, that'd need some hacking I guess.

adding plus points>
1. first you query the row 'points' associated with MikeJones
2. +100 to $result
3. update row

Quote:

$points = mysql_query("SELECT points FROM ".$xoopsDB->prefix("userpoints")." WHERE username="MikeJones");
$result = mysql_fetch_array( $points );

$pointsnew = $result + 100 ;

mysql_query("UPDATE ".$xoopsDB->prefix("userpoints")." SET points='$pointsnew' WHERE username='MikeJones'");

Login

Who's Online

210 user(s) are online (152 user(s) are browsing Support Forums)


Members: 0


Guests: 210


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits