I didn't found a option in Gallery2 to allow people to comment only photos. I know that i can set permissions for albums/photos to restrict/allow people to write comments, but that's too much work if you create a lot of albums.
It shouldn't be hard to add an option for the comments module to allow only comments for photos.
Posts: 43
Hello,
You can edit the following file:
/your gallerydirectory/modules/comment/module.inc
And change the function getItemLinks:
function getItemLinks($items, $wantsDetailedLinks, $permissions) {
list ($ret, $showAll) = $this->getParameter('comments.latest');
if ($ret) {
return array($ret->wrap(__FILE__, __LINE__), null);
}
$links = array();
foreach ($items as $item) {
$itemId = $item->getId();
if (isset($wantsDetailedLinks[$itemId])) {
if (isset($permissions[$itemId]['comment.add'])) {
$links[$itemId][] = array(
'text' => $this->translate('Add comment'),
'params' => array('view' => 'comment.AddComment',
'itemId' => $itemId, 'return' => 1));
}
if ($showAll && isset($permissions[$itemId]['comment.view'])) {
$links[$itemId][] = array(
'text' => $this->translate('View last comments'),
'params' => array('view' => 'comment.ShowAllComments',
'itemId' => $itemId, 'return' => 1));
}
}
}
return array(null, $links);
}
like this:
function getItemLinks($items, $wantsDetailedLinks, $permissions) {
list ($ret, $showAll) = $this->getParameter('comments.latest');
if ($ret) {
return array($ret->wrap(__FILE__, __LINE__), null);
}
$links = array();
foreach ($items as $item) {
$itemId = $item->getId();
$isAlbum = $item->getCanContainChildren();
if (!$isAlbum && isset($wantsDetailedLinks[$itemId])) {
if (isset($permissions[$itemId]['comment.add'])) {
$links[$itemId][] = array(
'text' => $this->translate('Add comment'),
'params' => array('view' => 'comment.AddComment',
'itemId' => $itemId, 'return' => 1));
}
if ($showAll && isset($permissions[$itemId]['comment.view'])) {
$links[$itemId][] = array(
'text' => $this->translate('View last comments'),
'params' => array('view' => 'comment.ShowAllComments',
'itemId' => $itemId, 'return' => 1));
}
}
}
return array(null, $links);
}
[ KORPDATA ] Innovando Soluciones Empresariales
Posts: 4
Thanks, it works. But after I published the comment, the page didn't go back to the photo page. How to solve this problem.
Website - http://www.dinictismedia.com
Fotopages - http://dinictis.fotopages.com
Flickr - http://www.flickr.com/photos/dinictis
Posts: 32509
see:
http://sourceforge.net/tracker/index.php?func=detail&aid=1566073&group_id=7130&atid=107130