Miome (miome) wrote in lj_dev,
Miome
miome
lj_dev

  • Mood:

Deleting comments + viewer_is_owner()

I (and originally, Jaq in lj_style) am trying to duplicate the old functionality of EntryPage - specifically, making it so that a delete button appears only on those comments that the viewer actually has the ability to delete. Naturally, the owner of the entry can delete any comments, and we can detect if the viewer is that person with viewer_is_owner().

However, the person who posted the comment also has the ability to delete it - the question is, how do we find out if the viewer is that person? Should viewer_is_owner() really be checking the owner of the entry, or the owner of the comment? (Since this is happening in the comment.print function.)

viewer_is_owner() : bool Returns true if the user viewing the page is both logged in, and is the owner of the content in question. Useful for returning links to manage information, or edit entries.
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 6 comments