I was worried about idiots spamming my site with bogus comments, so I wanted to limit comments to logged in users. The following change to line 86 of util.php does the trick. (I realize that there is a way to hack around this if you know galley well enought to construct the add_comment url on you own. If you're really worried abot that, you could do something similar in the add_comment.php file)
Change line 86 of util.php from:
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE> echo "<tr align=center><td colspan=3>$buf<br><br></td></tr>"; </TD></TR></TABLE><!-- BBCode End -->
to:
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>// HACK - prevent non-users from leaving comments
if( $gallery->user->isLoggedIn() )
{
echo "<tr align=center><td colspan=3>$buf<br><br></td></tr>";
}</TD></TR></TABLE><!-- BBCode End -->
MAKE SURE to back up the original file first!!!!
have fun,
Dave
Posts: 42
I am going to try this hack with the new registering users hack. This is the comnbination that i have been looking for!
Posts: 172
I tried this hack
It doesnt work, it gives me error
maybe you give me the files and I can overwrite them?
Thanks!
Posts: 42
What files do you need?
What is givng you an error?
http://linton.tk/v1/gallery is the link to my gallery if you want a demo
Posts: 172
It just give me error
the gallery wont run at all and it says $ error something
Posts: 42
Posts: 42
Here is some code from util.php you can see what i have changed
$url = "add_comment.php?set_albumName={$gallery->album->fields[name]}&index=$index";
$buf = "<span class=editlink>";
$buf .= '<a href="#" onClick="' . popup($url) . '">[add comment]</a>';
$buf .= "</span>";
//echo "<tr align=center><td colspan=3>$buf<br><br></td></tr>";
// HACK - prevent non-users from leaving comments
if( $gallery->user->isLoggedIn() )
{
echo "<tr align=center><td colspan=3>$buf<br><br></td></tr>";
}
//End Of Hack
}
Posts: 2
sorry you're having troble with this, it's worked for me and several other folk i know. I should have said that this is based upon the source for 1.3.1 I haven't played with any of the earlier releases, so I don't know how different they are. If you can post your mod'ed code, along with the error you're getting or a url, maybe we can help.
Posts: 8
This works wonderfully for my Postnuke site!
I have altered it slightly allowing a message to be shown under the photo/picture if not logged in to remind that person to register/login if they wish to leave comments. The code I am using is:
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE> // HACK - prevent non-users from leaving comments
if( $gallery->user->isLoggedIn() )
{
echo "<tr align=center><td colspan=3>$buf<br><br></td></tr>";
}
else {
print "<b>TO LEAVE COMMENTS ON THIS PHOTO, YOU NEED TO LOGIN/REGISTER!</b>";
}
// END OF HACK
</TD></TR></TABLE><!-- BBCode End -->
Posts: 25
Just to let you guys know, this hack works perfectly on 1.5, WOOHOOO!