brandon_scott (brandon_scott) wrote in lj_perl,
brandon_scott
brandon_scott
lj_perl

Perl and S2

Okay, I guess I'll start with what I'm trying to accomplish. What I want is to have a line automatically inserted into the begining of all the entries displayed on my Recents Page that reads either "Dear exampleusername," or "Dear Reader," if they're not logged in. Now, I'm looking at the viewer_logged_in and viewer_is_owner subroutines to try and figure out how the "viewer" is being determined. Here are those sub's:

sub viewer_logged_in
{
my ($ctx) = @_;
my $remote = LJ::get_remote();
return defined $remote;
}

sub viewer_is_owner
{
my ($ctx) = @_;
my $remote = LJ::get_remote();
return 0 unless $remote;
return $remote->{'userid'} == $LJ::S2::CURR_PAGE->{'_u'}->{'userid'};
}


Unfortuantly I don't know Perl well enough to disect those into purely what's determing the "viewer". Has anyone tried to do this before and if so did you get it to work? Some help would be appreciated. Thank you.

P.S. Don't worry about implementing that text line into the entries in an S2 style, I'll figure that out once I get this.

[Edit for community compliance] I have a Paid Account.

X-Posted to lj_perl, lj_style, ljstyles, pcgeeks, s2styles, s2_for_dummies, and technicalsuport.
Subscribe
  • Post a new comment

    Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 1 comment