?

Log in

No account? Create an account
August 5th, 2007 - LiveJournal Everywhere [entries|archive|friends|userinfo]
LiveJournal Everywhere

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

August 5th, 2007

Displaying Account Type [Aug. 5th, 2007|11:20 am]
LiveJournal Everywhere

lj_everywhere

[scenejournal]
[mood |contentcontent]

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 :)
link3 comments|post comment

navigation
[ viewing | August 5th, 2007 ]
[ go | Previous Day|Next Day ]