MyBB Community Forums

Full Version: [Core Edit] Option to Make Reputation Comments Mandatory
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Driven by this thread:
http://community.mybb.com/thread-150751.html


When we give reputation to a user from user reputation page it asks for the comment (with atleast 10 characters), but it is not necessary to place a comment while we give the reputation to a user for a post through postbit reputation button.

This modification will add an option to make the commenting mandatory, means if you set yes from ACP settings it will force user to make a comment every time while giving reputation to a user : no matter from where it is ...

Creating Settings:

Method 1 (General Users):

Go to
ACP > Configuration > Settings > Add New Setting (2nd Tab)
and place the values:

Title:
Reputation Comment Mandatory

Description:
Set it yes if you want users to force placing a comment on every given reputation.

Group:
Reputation

Display Order:
9

Identifier:
mandrepcomment

Type:
Yes / No Choice

Value:
0
(Change the 'value' to '1' if you want it to be 'yes' by default)

Now hit the button "Insert New Setting" from below.

[Image: IBGUYlA.png]

Method 2 (Advanced Users):

Advanced users can simply run this following SQL query through database to create the setting:

INSERT INTO `mybb_settings` 
(`sid`, `name`, `title`, `description`, `optionscode`, `value`, `disporder`, `gid`, `isdefault`) 
VALUES ('', 'mandrepcomment', 'Reputation Comment Mandatory', 
'Set it yes if you want users to  force placing a comment on every given reputation.', 
'yesno', '0', 9, 15, 0);

Note:
1. Change the table prefix if it is not default mybb_
2. Change the 'value' to '1' if you want it to be 'yes' by default.

Now we have an additional setting for the reputation:

[Image: s9VZ223.png]

Editing Core:

Now the core edit part.
Open reputations.php in an editor, go to line no 232 and find:

if($mybb->input['pid'] == 0)

Change it to:

if($mybb->settings['mandrepcomment'] || $mybb->input['pid'] == 0)

Save the file and re-upload : replace.

All done. Now if the setting is set to 'yes' its mandatory to provide a comment while giving reputation from anywhere, else it will show the error message:

[Image: DnlG2b1.png]

Happy coding ... Big Grin
Simple and neat trick bro.
Thanks bala Big Grin
I initially thought that it must be an & there but then I checked the whole line, and I figured it.