1. How easy/hard would it be to add new account types? Could I just do something like:
5' => { # 0x12
'_name' => 'paid user',
'styles' => 40,
'makepoll' => 1,
'userpics' => 1000,
'paid' => 1,
'useremail' => 1,
'textmessaging' => 1,
'directory' => 1,
'synd_create' => 1,
'domainmap' => 1,
'userdomain' => 1,
},
Could it be that easy or will it not be that simple?
I figured it out!
All you have to do is plug this code into the /cgi-bin/ljlib.pl file before the 1;
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);
Any help on either of those questions is much appreciated!