Committer: henrylyneAdd hook that takes in a list of the users communities.
The hook can modify the original list and also generate a new list with a label.
U trunk/htdocs/userinfo.bml
Modified: trunk/htdocs/userinfo.bml
===================================================================
--- trunk/htdocs/userinfo.bml 2006-10-02 23:51:30 UTC (rev 9093)
+++ trunk/htdocs/userinfo.bml 2006-10-02 23:57:16 UTC (rev 9094)
@@ -915,15 +915,28 @@
$frlink = "$frlink" if $remote_friendid{$f->{'userid'}} && $remote->{'userid'} != $u->{'userid'};
return $frlink;
};
+
foreach my $f (@friends) {
- push @pfriends, $friend_link->($f) if $f->{'journaltype'} eq 'P' or $f->{'journaltype'} eq 'S' or $f->{'journaltype'} eq 'I';
- push @cfriends, $friend_link->($f) if $f->{'journaltype'} eq 'C' or $f->{'journaltype'} eq 'N';
- push @yfriends, $friend_link->($f) if $f->{'journaltype'} eq 'Y';
+ push @pfriends, $f if $f->is_person or $f->is_shared or $f->is_identity;
+ push @cfriends, $f if $f->is_community or $f->is_news;
+ push @yfriends, $f if $f->is_syndicated;
}
- my ($pcount, $ccount, $ycount) = (scalar @pfriends, scalar @cfriends, scalar @yfriends);
+
+ my @alt_cfriends;
+ my $alt_clabel;
+ # Run hook for xtra special community category
+ LJ::run_hook("userinfo_alt_cfriends", \@cfriends, \@alt_cfriends, \$alt_clabel);
+
+ # Make into friend links
+ foreach my $list (\@pfriends, \@cfriends, \@yfriends, \@alt_cfriends) {
+ $list = [] unless ref $list;
+ @$list = map { $friend_link->($_) } @$list;
+ }
+
my $pfriends = join ', ', @pfriends;
my $yfriends = join ', ', @yfriends;
my $cfriends = join ', ', @cfriends;
+ my $alt_cfriends = join ', ', @alt_cfriends;
# now spit out the HTML
$body .= "";
@@ -931,23 +944,34 @@
my $text = LJ::ehtml($ML{'.label.frpeople'});
$body .= "" .
"
" .
- "$pcount:".
+ "" .
+ scalar @pfriends . ":".
"$pfriends";
}
if ($cfriends) {
my $text = LJ::ehtml($ML{'.label.frcommunity'});
$body .= "" .
"
" .
- "$ccount:" .
+ "" .
+ scalar @cfriends . ":" .
"$cfriends";
}
if ($yfriends) {
my $text = LJ::ehtml($ML{'.label.frsyndication2'});
$body .= "" .
"
" .
- "$ycount:" .
+ "" .
+ scalar @yfriends . ":" .
"$yfriends";
}
+ if ($alt_cfriends) {
+ $body .= "" .
+ $alt_clabel . "" .
+ "" .
+ scalar @alt_cfriends . ":" .
+ "$alt_cfriends";
+ }
+
$body .= "";
} else {
$body .= "" . $friends{'count'} . ": ";