|
|
|||||||
| Website Design / Website Development Website Design & Website Development Forums |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
I want to write a WordPress Plugin.
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? The Plugin I want to make is a page that comes up after a new user clicks on the “Submit Content” button when posting a reply to a blog. What sort of Filters or Hooks to I need to use? I have been told that I wouldn't necessarily need another page. I could just more options in the regular comments area if I just want to the user to input more information. If so, could I include a couple of buttons that would launch the "about us" page in a separate browser? |
|
|||
|
You could do this by hooking into the comment form and adding additional fields to the form using:
add_action('comment_form', 'my_function_name'); Replace my_function_name with the name of your function that will output the html for your additional fields. Then you would need to add another hook to capture the values that were entered in your new fileds using: add_action('comment_post', 'my_function_name_2'); In my_function_name_2 function you would grab the $_POST data for your fields. If you want to store them in the database you'll need to either create a table in the plugin install or store the data as usermeta data. To make the fields required you'd need to use javascript to validate them when the form is submitted. You could also use javascript to open a new window when the form is submitted and just have another form in the new window for your custom fields but the user could just close the window and not fill in your fields. Hope this helps |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|