Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Core Edit] Option to Make Reputation Comments Mandatory
#1
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
[Image: logo.svg.svg]
Reply
#2
This user has been denied support. This user has been denied support.
Simple and neat trick bro.
Reply
#3
Thanks bala Big Grin
[Image: logo.svg.svg]
Reply
#4
This user has been denied support. This user has been denied support.
I initially thought that it must be an & there but then I checked the whole line, and I figured it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)