When somebody in the edev group does some coding goodness, nate blesses them with devpoints. This is stored per-user, and is stored in $$VARS{'devpoints'} while that user's information is in memory. Currently (AFAIK), this doesn't do anything for you, although if you have the edev nodelet turned on, at the bottom is will say: "Devpoints accrued: x", where x is the number of devpoints you have.

Here is the code for the edev usergroup (since displaytype=viewcode doesn't work there). Note how a would-be devpoint getter user is "lucky". :) (# comments are added by me for this writeup)


#[{ indicates one should call htmlcode; }] indicates the end of that call
[{weblog}]    #standard weblog thingy: list of things that were weblogified - this is the basic contents of all weblogs/usergroups here

[%    #indicates the start of Perl code
return unless $$USER{title} eq 'nate';    #only nate can give these things out; anybody else just won't see anything

my $str;
$str.=htmlcode('openform')    #standard way to start forms on E2
   . 'bestow devpoints on '
   . $query->textfield('luckyuser')    #text field to enter user's name
   . htmlcode('closeform');    #standard way to end forms on E2; this includes a submit button

if ($query->param('luckyuser')) {    #this is only run if a name was entered, and the submit button was pressed
my $U = getNode($query->param('luckyuser'), 'user');    #get the user object
 return $str unless $U;    #don't do anything if we can't find a valid user
 my $V = getVars $U;    #get that user's variables, which keeps track of many random things
 $$V{devpoints}++;    #increate their devpoints
 setVars($U, $V);    #update the database
  updateNode($U, -1);    #force the update now
 $str.=linkNode($U)." now has $$V{devpoints} devpoints";    #shows the new amount of devpoints that user has
}

$str;    #returns the devpoints HTML
%]    #indicate the end of Perl code

Log in or register to write something here or to contact authors.