"; return; }; my $remote = LJ::get_remote(); return $error->($ML{'.label.logoutfirst'}) unless $remote; # get info about the community my $cuserid = $FORM{'cuserid'}+0; my $cu = $FORM{comm} ? LJ::load_user($FORM{comm}) : # they gave us the comm name LJ::load_userid($cuserid); # they gave us the comm id # error check return $error->($ML{'.label.infoerror'}) unless $cu && $cu->{journaltype} =~ /[CS]/; # used in both paths below my $ecname = LJ::ehtml($cu->{'name'}); if ($FORM{confirm}) { # get current list of maintainers to make sure the last one doesn't leave my $maintids = LJ::load_rel_user($cu->{userid}, 'A'); return $error->($ML{'error.nodb'}) unless ref $maintids eq 'ARRAY'; # error if we're a maintainer and there are no others my $ismaint = grep { $_ == $remote->{userid} } @$maintids; my $othermaints = grep { $_ != $remote->{userid} } @$maintids; return $error->($ML{'.label.lastmaintainer'}) if $ismaint && !$othermaints; # remove user from community's friends list LJ::leave_community($remote, $cu, $FORM{removefriend}); # success message $body .= " $cu->{user}, commname => $ecname }) . " p?>"; } else { # show a confirmation form $body .= " $ecname }) . " p?>"; $body .= '
'; $body .= LJ::html_hidden("cuserid", $cu->{userid}, "confirm", 1) . "

"; $body .= LJ::html_check({ name => 'removefriend', selected => 1, value => 1 }) . " "; $body .= BML::ml('.label.removefromfriends', { user => $ecname }); $body .= '

' . LJ::html_submit(undef, $ML{'.button.leave'}) . '

'; } return; } _code?> body=> page?> link: htdocs/login.bml, htdocs/userinfo.bml post: htdocs/community/leave.bml _c?>