Deleting Comments Privileges
for Non-Root Users Hack (v0.1)

Code Modifications: This hack requires very minor modifications to two files:

It also requires running four SQL statements to add story.comment and poll.comment to the permission tables.

PhpMyAdmin  For virgin installs where NO PLUGINS have been added: Using PhpMyAdmin (or any other client software that gives direct access to your database), run the following four SQL statements

INSERT INTO gl_features (ft_id, ft_name, ft_descr, ft_gl_core) 
VALUES (23,'story.comment','Ability to delete comments on stories',1);
INSERT INTO gl_access (acc_ft_id, acc_grp_id) VALUES (23,3);
INSERT INTO gl_features (ft_id, ft_name, ft_descr, ft_gl_core)
VALUES (24,'poll.comment','Ability to delete comments on polls',1);
INSERT INTO gl_access (acc_ft_id, acc_grp_id) VALUES (24,8);

PhpMyAdmin  For systems which have installed plugins: Before running the required SQL statements, you must first identify the next ft_id numbers in your table and adjust the statements before running them. Using PhpMyAdmin (or any other client software that gives direct access to your database), open your gl_features table and locate the very last table entry. Take note of its ft_id. The new permissions should be assigned the very next two numbers. For example on a virgin install, the last ft_id is 22. The next two numbers are 23 and 24. The four SQL statements needed for this particular case are located above.

Working example of adjustment: In your table, let's say the last ft_id is 35. This will make the next two numbers 36 and 37. The 23's in the first two statements above should be changed to 36. These add the story.comment permission. The 24's in the last two statements above should be changed to 37. These add the poll.comment permission. The modified four SQL statements would look like this:

INSERT INTO gl_features (ft_id, ft_name, ft_descr, ft_gl_core) 
VALUES (36,'story.comment','Ability to delete comments on stories',1);
INSERT INTO gl_access (acc_ft_id, acc_grp_id) VALUES (36,3);
INSERT INTO gl_features (ft_id, ft_name, ft_descr, ft_gl_core)
VALUES (37,'poll.comment','Ability to delete comments on polls',1);
INSERT INTO gl_access (acc_ft_id, acc_grp_id) VALUES (37,8);

Whatever the next two ft_id numbers are in the gl_features table, adjust the numbers shown here in blue to reflect them. After making this adjustment, run the SQL statements in your database editor client software.

comment.php  In the function deletecomment (located in /public_html/comment.php) find this section of code (starting at or about line 318):

            if (SEC_hasAccess ($A['owner_id'], $A['group_id'], $A['perm_owner'],
                $A['perm_group'], $A['perm_members'], $A['perm_anon']) == 3) {

Replace it with this:

            if ((SEC_hasAccess ($A['owner_id'], $A['group_id'], $A['perm_owner'],
                $A['perm_group'], $A['perm_members'], $A['perm_anon']) == 3) OR
                (($type == 'article') AND SEC_hasrights('story.comment')) OR
                (($type == 'poll') AND SEC_hasrights('poll.comment'))) {

lib-common.php  In the function COM_comment (located in /lib-common.php) find this section of code (starting at or about line 2934):

            if( SEC_hasAccess( $A['owner_id'], $A['group_id'], $A['perm_owner'],
$A['perm_group'], $A['perm_members'], $A['perm_anon'] ) == 3 )

Replace it with this:

            if( SEC_hasAccess( $A['owner_id'], $A['group_id'], $A['perm_owner'],
                $A['perm_group'], $A['perm_members'], $A['perm_anon'] ) == 3 OR
                (($type == 'article') AND SEC_hasrights('story.comment')) OR
                (($type == 'poll') AND SEC_hasrights('poll.comment')))

-- Return to the Readme File Now --