Parent

Class Index [+]

Quicksearch

Comment

This class is used for getting the comments from the wordpress database

Examples:

  User.find(1).comments

The above will find the user with id of 1 and retrieve all of the comments they have ever made

  Post.find(1).comments

The above will find the post with id of 1 and retrieve all of the comments from that post

  Comment.find(1)

The above will find the comment with id of 1

Inherited methods

find id

Retrieves the comment with the sepcified id

all

Retrieves all of the comments in the database

Database Keys

comment_ID alias: id

The comments id

comment_post_ID alias: post.id

The post id where the comment was posted

  Comment.find(1).post

The above returns the Post that the comment belongs to

comment_author

The name of the auther (could be stored in user.name, User#name)

comment_author_email

The email of the author (could be stored in user.email, User#email)

comment_author_url

The url of the author (could be stored in user.url, User#url)

comment_author_IP

The ip of the author

comment_date

The date the comment was posted

comment_date_gmt

The date the comment was posted in gmt/utc time

comment_content alias: Comment#content

The content of the comment

comment_karma

The comment karma

comment_approved

If the comment has been approved or not

comment_agent

The agent of the comment

comment_type

The type of comment

comment_parent

The parent comment id if any

user_id

The user id of the author (0 if not registered user)

  Comment.find(1).user

The above returns the User that posted the comment if user_id isn’t 0

Public Instance Methods

content() click to toggle source

Grab the content of the selected comment

    # File lib/wpb/comment.rb, line 56
56:         def content
57:                 comment_content
58:         end
content=(new_content) click to toggle source

Set the content of the selected comment

    # File lib/wpb/comment.rb, line 63
63:         def content= new_content
64:                 self.comment_content = new_content
65:         end

Private Instance Methods

set_default_values() click to toggle source
    # File lib/wpb/comment.rb, line 68
68:         def set_default_values
69:                 t = Time.now
70:                 self.comment_date = t
71:                 self.comment_date_gmt = t.gmtime
72:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.