coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 permissions => Topic started by: Zajda on March 04, 2006, 12:54:34 PM

Title: How to disable editing and deleting comments for users? (edit - another problem)
Post by: Zajda on March 04, 2006, 12:54:34 PM
Im using 1.4.x version. Can anyone help me? I want to disable editng and deleting comments for users... That means normal users wouldnt edit or delete their own posts... Thanks.
Title: Re: How to disable editing and deleting comments for users?
Post by: Joachim Müller on March 05, 2006, 01:23:42 AM
edit themes/yourtheme/theme.php, find                                        <a href="javascript:;" onclick="blocking('cbody{MSG_ID}','', 'block'); blocking('cedit{MSG_ID}','', 'block'); return false;" title="{EDIT_TITLE}"><img src="images/edit.gif" border="0px" align="middle" alt="" /></a>
                                        <a href="delete.php?msg_id={MSG_ID}&amp;what=comment"  onclick="return confirm('{CONFIRM_DELETE}');"><img src="images/delete.gif" border="0px" align="middle" /></a>
and comment it out, or add a switch that only allows admin access.
Title: Re: How to disable editing and deleting comments for users?
Post by: Zajda on March 05, 2006, 11:40:14 AM
Thank you a lot. I love coppermine...  ;D
Title: Re: How to disable editing and deleting comments for users?
Post by: Zajda on March 05, 2006, 01:03:53 PM
I tried to add a switch that allows use only for admin, but everytime i get some error/s. Please can you give me another advice? How to do it?
Title: Re: How to disable editing and deleting comments for users? (edit - another prob
Post by: Joachim Müller on March 05, 2006, 01:11:36 PM
post your code and I may be able to tell you what if wrong with it. A switch in PHP looks like this:<?php
if (GALLERY_ADMIN_MODE == TRUE) {
    
// do something the admin only is suppossed to do
} else {
    
//do something the non-admin is suppossed to do/see/have
}
Title: Re: How to disable editing and deleting comments for users? (edit - another prob
Post by: seppo on March 26, 2006, 08:38:19 PM
I have similar problem, I want to disable editing / deleting of comments for unregistered users (still, they should be able to view / add them). Trying to find solution, I found this thread. I am using rainyday -theme that comes along with coppermine, but I didn't find those lines from there from any files it icludes in its themes directory.. is there any other way to do this?

Title: Re: How to disable editing and deleting comments for users? (edit - another prob
Post by: bitcloud on November 17, 2006, 10:24:39 PM
I'm struggling a little with this one...

I've basically got:

if (GALLERY_ADMIN_MODE == TRUE) {
  <a href="javascript:;" onclick="blocking('cbody{MSG_ID}','', 'block'); blocking('cedit{MSG_ID}','', 'block'); return false;" title="{EDIT_TITLE}"><img src="images/edit.gif" border="0px" align="middle" alt="" /></a>
                                        <a href="delete.php?msg_id={MSG_ID}&amp;what=comment"  onclick="return confirm('{CONFIRM_DELETE}');"><img src="images/delete.gif" border="0px" align="middle" /></a>
}


but of course that's parsing the "if" command through as html and echoing it out... (along with the edit buttons)
I don't really understand how to call the switch (how to put it in as PHP and not as HTML)

cheers
Title: Re: How to disable editing and deleting comments for users? (edit - another prob
Post by: Joachim Müller on November 17, 2006, 11:10:34 PM
if (GALLERY_ADMIN_MODE == TRUE) {
print <<< EOT
<a href="javascript:;" onclick="blocking('cbody{MSG_ID}','', 'block'); blocking('cedit{MSG_ID}','', 'block'); return false;" title="{EDIT_TITLE}"><img src="images/edit.gif" border="0px" align="middle" alt="" /></a>
                                        <a href="delete.php?msg_id={MSG_ID}&amp;what=comment"  onclick="return confirm('{CONFIRM_DELETE}');"><img src="images/delete.gif" border="0px" align="middle" /></a>
EOT;
}
Title: Re: How to disable editing and deleting comments for users? (edit - another prob
Post by: bitcloud on November 18, 2006, 03:12:32 AM
Thanks, that one's still not working for me... I get an "Unexpected <" error on the "<!-- END buttons --> line

I tried fixing up for the quote marks:

if (GALLERY_ADMIN_MODE == TRUE) {
print <<< EOT "
<a href=\"javascript:;\" onclick=\"blocking('cbody{MSG_ID}','', 'block'); blocking('cedit{MSG_ID}','', 'block'); return false;\" title=\"{EDIT_TITLE}\"><img src=\"images/edit.gif\" border=\"0px\" align=\"middle\" alt=\"\" /></a>

<a href=\"delete.php?msg_id={MSG_ID}&amp;what=comment\"  onclick=\"return confirm('{CONFIRM_DELETE}');\"><img src=\"images/delete.gif\" border=\"0px\" align=\"middle\" /></a> "

EOT;
}

thinking that might resolve something, but it doesn't... I guess I'm not really understanding whether I'm writing in PHP or HTML in each part, and whether i'm 'breaking into' HTML to print the part, or 'breaking out of' PHP to print it...  ???

cheers
Title: Re: How to disable editing and deleting comments for users? (edit - another problem)
Post by: Sami on November 18, 2006, 06:50:34 AM
You shouldn't put those quote marks !
It didn't work this way

if you already have $template_image_comments variable on your theme.php delete it then copy this code instead to themes/your theme/theme.php


if (GALLERY_ADMIN_MODE == TRUE) {
// HTML template for the display of comments to Admins
$template_image_comments = <<<EOT
<table align="center" width="{WIDTH}" cellspacing="1" cellpadding="0" class="maintable">

        <tr>
                <td>
                        <table width="100%" cellpadding="0" cellspacing="0">
                           <tr>
                                <td class="tableh2_compact" nowrap="nowrap">
                                        <b>{MSG_AUTHOR}</b><a name="comment{MSG_ID}"></a>&nbsp;
<!-- BEGIN ipinfo -->
                                                                                 ({IP})
<!-- END ipinfo -->
</td>


                                <td class="tableh2_compact" align="right" width="100%">
<!-- BEGIN report_comment_button -->
     <a href="report_file.php?pid={PID}&amp;msg_id={MSG_ID}&amp;what=comment" title="{REPORT_COMMENT_TITLE}"><img src="images/report.gif" width="16" height="16" border="0" align="middle" alt="{REPORT_COMMENT_TITLE}" /></a>
<!-- END report_comment_button -->


<!-- BEGIN buttons -->
                                        <a href="javascript:;" onclick="blocking('cbody{MSG_ID}','', 'block'); blocking('cedit{MSG_ID}','', 'block'); return false;" title="{EDIT_TITLE}"><img src="images/edit.gif" border="0" align="middle" /></a>
                                        <a href="delete.php?msg_id={MSG_ID}&what=comment"  onclick="return confirm('{CONFIRM_DELETE}');"><img src="images/delete.gif" border="0" align="middle" /></a>
<!-- END buttons -->
                                </td>
                                <td class="tableh2_compact" align="right" nowrap="nowrap">
                                        <span class="comment_date">[{MSG_DATE}]</span>
                                </td></tr>
                        </table>
                </td>
        </tr>
        <tr>
                <td class="tableb_compact">
                        <div id="cbody{MSG_ID}" style="display:block">
                                {MSG_BODY}
                        </div>
                        <div id="cedit{MSG_ID}" style="display:none">
<!-- BEGIN edit_box_smilies -->
                                <table width="100%" cellpadding="0" cellspacing="0">

                                                <form name="f{MSG_ID}" method="POST" action="db_input.php">
                                                <input type="hidden" name="event" value="comment_update" />
                                                <input type="hidden" name="msg_id" value="{MSG_ID}" />
                                                <tr>
                                                <td>
                                                   <input type="text" name="msg_author" value="{MSG_AUTHOR}" class="textinput" size="25" />
                                                </td><td>
                                                </tr>
                                                <tr>
                                                <td width="80%">
                                                        <textarea cols="40" rows="2" class="textinput" name="msg_body" onselect="storeCaret_f{MSG_ID}(this);" onclick="storeCaret_f{MSG_ID}(this);" onkeyup="storeCaret_f{MSG_ID}(this);" style="width: 100%;">{MSG_BODY_RAW}</textarea>
                                                </td>
                                                <td class="tableb_compact">
                                                </td>
                                                <td>
                                                        <input type="submit" class="comment_button" name="submit" value="{OK}" />
                                                </td>
                                                </form>
                                        </tr>
                                        <tr>
                                                <td colspan="3"><img src="images/spacer.gif" width="1" height="2" /><br /></td>
                                        </tr>
                                </table>
                                {SMILIES}
<!-- END edit_box_smilies -->
<!-- BEGIN edit_box_no_smilies -->
                                <table width="100%" cellpadding="0" cellspacing="0">
                                        <tr>
                                                <form name="f{MSG_ID}" method="POST" action="db_input.php">
                                                <input type="hidden" name="event" value="comment_update" />
                                                <input type="hidden" name="msg_id" value="{MSG_ID}" />
                                                <td>
                                                <input type="text" name="msg_author" value="{MSG_AUTHOR}" class="textinput" size="25" />
                                                </td>
                                        </tr>
                                        <tr>
                                                <td width="100%">
                                                        <textarea cols="40" rows="2" class="textinput" name="msg_body" style="width: 100%;">{MSG_BODY_RAW}</textarea>
                                                </td>
                                                <td class="tableb_compact">
                                                </td>
                                                <td>
                                                        <input type="submit" class="comment_button" name="submit" value="{OK}" />
                                                </td>
                                                </form>
                                        </tr>
                                        <tr>
                                                <td colspan="3"><img src="images/spacer.gif" width="1" height="2" /><br /></td>
                                        </tr>
                                </table>
<!-- END edit_box_no_smilies -->
                        </div>
                </td>
        </tr>
</table>
EOT;
} else {
// HTML template for the display of comments to regular users
$template_image_comments = <<<EOT
<table align="center" width="{WIDTH}" cellspacing="1" cellpadding="0" class="maintable">

        <tr>
                <td>
                        <table width="100%" cellpadding="0" cellspacing="0">
                           <tr>
                                <td class="tableh2_compact" nowrap="nowrap">
                                        <b>{MSG_AUTHOR}</b><a name="comment{MSG_ID}"></a>&nbsp;
<!-- BEGIN ipinfo -->
                                                                                 ({IP})
<!-- END ipinfo -->
</td>


                                <td class="tableh2_compact" align="right" width="100%">
<!-- BEGIN report_comment_button -->
     <a href="report_file.php?pid={PID}&amp;msg_id={MSG_ID}&amp;what=comment" title="{REPORT_COMMENT_TITLE}"><img src="images/report.gif" width="16" height="16" border="0" align="middle" alt="{REPORT_COMMENT_TITLE}" /></a>
<!-- END report_comment_button -->


<!-- BEGIN buttons -->

<!-- END buttons -->
                                </td>
                                <td class="tableh2_compact" align="right" nowrap="nowrap">
                                        <span class="comment_date">[{MSG_DATE}]</span>
                                </td></tr>
                        </table>
                </td>
        </tr>
        <tr>
                <td class="tableb_compact">
                        <div id="cbody{MSG_ID}" style="display:block">
                                {MSG_BODY}
                        </div>
                        <div id="cedit{MSG_ID}" style="display:none">
<!-- BEGIN edit_box_smilies -->
                                <table width="100%" cellpadding="0" cellspacing="0">

                                                <form name="f{MSG_ID}" method="POST" action="db_input.php">
                                                <input type="hidden" name="event" value="comment_update" />
                                                <input type="hidden" name="msg_id" value="{MSG_ID}" />
                                                <tr>
                                                <td>
                                                   <input type="text" name="msg_author" value="{MSG_AUTHOR}" class="textinput" size="25" />
                                                </td><td>
                                                </tr>
                                                <tr>
                                                <td width="80%">
                                                        <textarea cols="40" rows="2" class="textinput" name="msg_body" onselect="storeCaret_f{MSG_ID}(this);" onclick="storeCaret_f{MSG_ID}(this);" onkeyup="storeCaret_f{MSG_ID}(this);" style="width: 100%;">{MSG_BODY_RAW}</textarea>
                                                </td>
                                                <td class="tableb_compact">
                                                </td>
                                                <td>
                                                        <input type="submit" class="comment_button" name="submit" value="{OK}" />
                                                </td>
                                                </form>
                                        </tr>
                                        <tr>
                                                <td colspan="3"><img src="images/spacer.gif" width="1" height="2" /><br /></td>
                                        </tr>
                                </table>
                                {SMILIES}
<!-- END edit_box_smilies -->
<!-- BEGIN edit_box_no_smilies -->
                                <table width="100%" cellpadding="0" cellspacing="0">
                                        <tr>
                                                <form name="f{MSG_ID}" method="POST" action="db_input.php">
                                                <input type="hidden" name="event" value="comment_update" />
                                                <input type="hidden" name="msg_id" value="{MSG_ID}" />
                                                <td>
                                                <input type="text" name="msg_author" value="{MSG_AUTHOR}" class="textinput" size="25" />
                                                </td>
                                        </tr>
                                        <tr>
                                                <td width="100%">
                                                        <textarea cols="40" rows="2" class="textinput" name="msg_body" style="width: 100%;">{MSG_BODY_RAW}</textarea>
                                                </td>
                                                <td class="tableb_compact">
                                                </td>
                                                <td>
                                                        <input type="submit" class="comment_button" name="submit" value="{OK}" />
                                                </td>
                                                </form>
                                        </tr>
                                        <tr>
                                                <td colspan="3"><img src="images/spacer.gif" width="1" height="2" /><br /></td>
                                        </tr>
                                </table>
<!-- END edit_box_no_smilies -->
                        </div>
                </td>
        </tr>
</table>
EOT;
}
Title: Re: How to disable editing and deleting comments for users? (edit - another problem)
Post by: All4yu on November 19, 2006, 03:59:48 AM
How can I able users to delete or to edit all comments on their own albums ?
Title: Re: How to disable editing and deleting comments for users? (edit - another problem)
Post by: Sami on November 19, 2006, 06:48:21 AM
Already owner can delete all comment by editing her/his files

Editing others user's comment is not right IMO
But deleteing single comment is good

That needs a MOD
- Adding admin button for owner under theme.php
- preparing delete.php to do that
Title: Re: How to disable editing and deleting comments for users? (edit - another prob
Post by: bitcloud on November 22, 2006, 10:54:31 AM
Thanks a heap sami!

that worked perfectly.. I'd say it's closed for me..
Title: Re: How to disable editing and deleting comments for users? (edit - another prob
Post by: Joachim Müller on November 22, 2006, 12:57:15 PM
Locking thread to avoid more cross-posts and hijacking attempts.