Torin/Darren WhoEver (wolfieboy) wrote in lj_dev,
Torin/Darren WhoEver

getinterests mode

So, why isn't there a mode to get the interests for a user.
I figure that it should be that difficult to put the following into cgi-bin/
# Note - this is untested code - but the code is trivial
sub getinterests
my ($dbs, $req, $err, $flags) = @_;
return undef unless authenticate($dbs, $req, $err, $flags);

my $res = [];
my $dbr = $dbs->{'reader'};

my $sth = $dbr->prepare("SELECT i.interest, i.intcount, i.intid " .
"FROM interests i, userinterests ui " .
"WHERE i.intid=ui.intid AND ui.userid=$u->{'userid'}"
my %interests = ();
while ($_ = $sth->fetchrow_hashref) {
push @$res, { interest => $_->{'interest'},
return $res;

As I said, this code is untested but would be trivial to check. If this is something that would be desired, I can make sure this works and update protocol.dat once someone tells me how.

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded