+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 30

Thread: Writing My First Plugin

  1. #1
    Xarzu's Avatar
    Xarzu is offline Hello World
    Join Date
    Oct 2009
    Posts
    45

    Default Writing My First Plugin

    I want to write a plug in.

    I have read some of the documentation about how 'hooks" work but I do not know which hooks to take advantage of.

    I want to write a plugin that launches a separate page when a new user wants to add a new comment.

    In other words, I want the ability to insist that the user add more than just a username and email. I want to require that more information be inputted.

    Maybe such a plug-in already exists or perhaps something simular. Does this sound familiar?

  2. #2
    Ryan's Avatar
    Ryan is offline WPTavern Forum Moderator
    Join Date
    Jan 2009
    Location
    New Zealand
    Posts
    2,418

    Default

    If you just want to the user to input more information, then you wouldn't necessarily need another page, just more options in the regular comments area.

  3. #3
    Xarzu's Avatar
    Xarzu is offline Hello World
    Join Date
    Oct 2009
    Posts
    45

    Default

    Can that include check boxes?

    I think this would be a viable solution if I could have a couple of buttons there. One button would be an "About Us" button.

  4. #4
    Ryan's Avatar
    Ryan is offline WPTavern Forum Moderator
    Join Date
    Jan 2009
    Location
    New Zealand
    Posts
    2,418

    Default

    Yes, you can definitely include check boxes. Quite a few plugins add extra bits of information in there. You could find one of those and have a look under the hood at how it works perhaps.

  5. #5
    Xarzu's Avatar
    Xarzu is offline Hello World
    Join Date
    Oct 2009
    Posts
    45

    Default

    I am sorry if this is a stuid question. How do I get to the regular comments area?

  6. #6
    Xarzu's Avatar
    Xarzu is offline Hello World
    Join Date
    Oct 2009
    Posts
    45

    Default

    Quote Originally Posted by Ryan View Post
    If you just want to the user to input more information, then you wouldn't necessarily need another page, just more options in the regular comments area.
    Do you mean, when I post a comment (aka a blog) I stick at the bottom of my text these things such as buttons and check boxes?

  7. #7
    chipbennett's Avatar
    chipbennett is offline WordPress Legend
    Join Date
    Feb 2009
    Location
    St. Louis, MO
    Posts
    1,717

    Default

    Quote Originally Posted by Xarzu View Post
    Do you mean, when I post a comment (aka a blog) I stick at the bottom of my text these things such as buttons and check boxes?
    No, you would need to modify your theme's comments.php file.
    WP TurnKey - Turn-Key WordPress installation and maintenance services
    WordPress user since 2005 | @chip_bennett | chipbennett.net | cbnet Plugins

  8. #8
    Ryan's Avatar
    Ryan is offline WPTavern Forum Moderator
    Join Date
    Jan 2009
    Location
    New Zealand
    Posts
    2,418

    Default

    Quote Originally Posted by Xarzu View Post
    Do you mean, when I post a comment (aka a blog) I stick at the bottom of my text these things such as buttons and check boxes?
    Yes.

    Quote Originally Posted by chipbennett View Post
    No, you would need to modify your theme's comments.php file.
    There must be a hook down there. The Reply to Comments plugin uses a hook of some sort in the comments section to add an extra checkbox.



    Perhaps try looking at the Reply to Comments plugin or other simple plugins which utilize a hook in the comments area to figure out what hook is most suitable.

  9. #9
    chipbennett's Avatar
    chipbennett is offline WordPress Legend
    Join Date
    Feb 2009
    Location
    St. Louis, MO
    Posts
    1,717

    Default

    Quote Originally Posted by Ryan View Post
    Yes.



    There must be a hook down there. The Reply to Comments plugin uses a hook of some sort in the comments section to add an extra checkbox.



    Perhaps try looking at the Reply to Comments plugin or other simple plugins which utilize a hook in the comments area to figure out what hook is most suitable.
    Oops, good call. I forgot for a moment that we're talking about a plugin.
    WP TurnKey - Turn-Key WordPress installation and maintenance services
    WordPress user since 2005 | @chip_bennett | chipbennett.net | cbnet Plugins

  10. #10
    Otto's Avatar
    Otto is offline Trac Master
    Join Date
    Apr 2009
    Location
    Memphis, TN
    Posts
    770

    Default

    Quote Originally Posted by Ryan View Post
    There must be a hook down there. The Reply to Comments plugin uses a hook of some sort in the comments section to add an extra checkbox.
    "Must" is a bit strong.

    The default theme has this immediately after the comments form:
    PHP Code:
    <?php do_action('comment_form'$post->ID); ?>
    Which is handy if:
    a) your theme has that (many don't), and
    b) you only want to add stuff after the whole comments form.

    Short version is that there's no useful hooks around there. Yet.

    So, for the time being, editing the theme's comments form manually is the only real way to get stuff done.

    That said, 3.0 will have a better way to do this sort of thing. Themes will still need to be modified to use the standard comments form, but once themes are using it, plugins will be able to easily modify them for all sorts of uses.

+ Reply to Thread
Page 1 of 3 1 2 3 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts