Notifications
Clear all

Rating Form & Customized Saving.

4 Posts
2 Users
0 Reactions
1,986 Views
(@eliddon)
Active Member
Joined: 6 years ago
Posts: 5
Topic starter  

I'm wanting to move to wpdiscuz but I'm having issues with importing some code from a previous plugin. I have ratings enables on posts. I can use a custom field to add the comment metadata I need for a rating field (with the 5 stars).

I have 3 problems:

1) I want to limit it so a user can only rate the post once. By default they can do it as many times as they like and there isn't an option for me to change it.

2) I had some custom code fire on "comment_post" that requires additional information in the post. Is there a way to use a filter to insert a hidden form field?

3) There is no way to delete the users custom_field in the edit comment. I can change it, but not delete the rating.


   
Quote
(@eliddon)
Active Member
Joined: 6 years ago
Posts: 5
Topic starter  

I'm still looking for some help with 1 & 3, but I found the solution for my issue #2. I was able to add some custom HTML code into the form by hooking by using the following:

add_action('wpdiscuz_submit_button_before', 'add_custom_html');

function add_custom_html() {
// echo HTML code here.
}

Hopefully that helps someone else.


   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 7 years ago
Posts: 6147
 

Thank you @eliddon,

I'm sorry, but there is no such a feature. We'll take into consideration to add a hook for this purpose. For now, I suggest you check the solution provided in this support topic, it may help you. 

https://wordpress.org/support/topic/one-comment-per-user-per-post-2/

 There is no way to delete the users custom_field in the edit comment. I can change it, but not delete the rating.

I'm really sorry, but wpDiscuz doesn't allow deleting it.  


   
ReplyQuote
(@eliddon)
Active Member
Joined: 6 years ago
Posts: 5
Topic starter  

Thanks for the reply. That's unfortunate. For now I've hacked a solution together by injecting some javascript in the 'wpdiscuz_submit_button_before' hook to hide the rating field if there was a previous rating by their email or ipaddress. Seems to do the trick. 

For being able to delete the rating I've used the 'add_meta_box' action to add my own code in the admin backend, again not ideal but works for now. At least this way I haven't modified any of the wpdiscuz code.

Now to see if there is a solution to add my own sort button to filter to only show rating comments...


   
ReplyQuote
Share:
Scroll to top