Jimmy (scenejournal) wrote in lj_everywhere,
Jimmy
scenejournal
lj_everywhere

  • Mood:

Displaying Account Type

Well I dug through some posts and I found one of my posts where I was asking about how to display the Account type on the User Info page and the code that I used was:

LJ::register_hook("userinfo_rows", sub {
my $args = shift;
my $u = $args->{'u'};
my $dbr = $args->{'dbr'};
my $remote = $args->{'remote'};
my @ret;
$ret[0] = "(a href='/support/faqbrowse.bml?faqid=16' style='white-space: nowrap'>Account type(/a)";
$ret[1] = LJ::LJcom::acct_name($u->{'caps'});


my $paid = $u->{'caps'} & 8;
my $perm = $u->{'caps'} & 16;
if ($remote && $paid && ! $perm &&
($remote->{'userid'} == $u->{'userid'} ||
$u->{'journaltype'} ne 'P' &&
LJ::check_rel($u->{'userid'}, $remote->{'userid'}, 'A')))
{
my $paiduntil = $dbr->selectrow_array("SELECT paiduntil FROM paiduser ".
"WHERE userid=$u->{'userid'}");
$paiduntil = substr($paiduntil, 0, 10);
$ret[1] .= ", expiring $paiduntil" if $paiduntil;
}
return @ret;
});

package LJ::LJcom;
sub acct_name {
my $caps = shift;
my $v;
if ($caps & 0x10) {
$v = "Permanent Account";
} elsif ($caps & 0x08) {
$v = "Paid Account";
}
if ($caps & 0x04) {
$v && ($v .= ", previously an ");
$v .= "Early Adopter";
}
return $v if $v;


if ($caps & 0x02) {
$v = "Early Free User";
} elsif ($caps & 0x01) {
$v = "Free User";
}
return $v;
}

LJ::register_hook("name_caps", \&acct_name);

Unfortunately it doesn't look like that code works anymore because when I put into my ljconfig.pl file I can no longer start up Apache, it'll return:

[error] Undefined subroutine &LJ::register_hook called at /home/lj/cgi-bin/ljconfig.pl line 37.

Thanks for any help on getting this to work :)
Subscribe
  • Post a new comment

    Error

    Comments allowed for members only

    Anonymous comments are disabled in this journal

    default userpic

    Your IP address will be recorded 

  • 3 comments