1. In my gallery I'm using Zenpage to show the latest albums on the home page. Is there any way to have the news be sorted by the upload date (or even last modified date)? As it is now, images with an older date are transposed lower in the news list even when I have sorting set to ID or mtime. I've even tried using getLatestNews() instead of a next_news() loop but it still sorts the same.
2. Is it possible to make it so that an admin cannot delete the top-level album they administer? I'm trying to find out the best way to do this without modifying the back-end and needing to keep up with each update.
3. I understand that certain images can be overridden by a theme, but does this only apply to certain images? For instance, I'm trying to replace the default RSS icon with a custom rss.png.
Thanks,
kagutsuchi
Comments
NOTE: If you experience unexpected results, this refers only to the images that are fetched from the database. Even if they are fetched by id or mtime they will be sorted by date with the articles afterwards since articles only have a date.
So, bascially no, since articles are always sorted by date (anything else does not make sense) and since it is one big db query/array it is not possible to sort parts of it differently. (latestnews() uses the same internals so it is the same).
Maybe you are better suited by using the image_album_statistics plugin.
2. Possible is everything...:-) It is currently not without hacking though.
3. Well, you could just replace the one that is there. Or you don't use it and place your own before/after the link or use one as a CSS background or just make your own rss link function. Look at the rss function's code.
2. I'll submit a feature request for that and hack it in for now.
The image_album_statistics is of course for images and albums, not for new. get/printlatestnews is a Zenpage function for articles (our documentation would have told that btw).
Meanwhile you probably could use the printLatestImages() function instead.
2. Alright.
Also, I gave up on trying to stop users from deleting their own albums. sbillard was right in his reply and I was overthinking it way too much.
However, I still have a few more questions:
1. What would be the easiest option for keeping users from renaming their own albums? In trying to give each user their own album, I've made it so that on registration an album is created with the user's ID. To keep things organized, I would prefer that the album stays named as the user's ID. Is there an easy way to do this without modifying the back-end? I have no problem hacking it in but, yet again, I would prefer not having to add it back in every update.
2. I seem to be having a problem with the Flash uploader. Sometimes the Upload button does not appear, namely when trying to upload to the root of /albums/ directly (I assume this is intentional?) and when a user registers and attempts to upload to the album assigned to them. I get this error in Firefox's Error Console:
`
Error: document.getElementById(a(this).attr("id") + "Uploader").updateSettings is not a function
Source File: /zenphoto/zp-core/admin-uploadify/jquery.uploadify.js
Line: 20
`
2. There is a comment in admin-upload.php circa line 395. I'm not sure why this causes a problem, specially since it seems to be fine if the user is a full admin. Anyway, deleting this comment seems to fix the problem.
However, I have one more question now: What do I have to do to get a user group template working? I have a template and all new users are assigned to it automatically on user registration. However, the rights aren't properly set for me. I'm using a slightly modified version of the register_user plugin which seems to be working fine except for that one nuance.
For reference, the modified version can be found here: http://www.archlinuxgallery.com/register_user.txt
If any insight could be given it would be greatly appreciated.
Thanks,
kagutsuchi
I know that you're probably sick of answering my questions by now, but I can't figure out how to get the save_album_utilities_data filter to prevent renaming. I've registered the filter and I'm using this code:
`
function personalAlbumPreventRename($object, $prefix) {
if ($object->getTitle() === $_zp_current_admin['user'] && !$object->getParent() && getOption('register_user_personal_album")) {
unset($_POST['a-'.$prefix.'MoveCopyRename']);
}
}
`
There must be something simple I'm missing here but for some reason this doesn't stop a user from renaming his/her personal album.
Anyway, make sure that the code is actually being executed, testing the correct things, and unseting the $_POST key. If the proper key is unset there should be no move/copy/rename done.
BTW.I would have assumed that you would want to test the folder name of the album rather than the title. Couldn't the user change the title?
`$plugin_is_filter = -5;`
`if (getOption('register_user_personal_album')) zp_register_filter('save_album_utilities_data', 'personalAlbumPreventRename');`
`
function personalAlbumPreventRename($object, $prefix) {
debugLog("\$object->getFolder()");
debugLog("\$_zp_current_admin['user']");
debugLog("\$object->getParent()");
debugLog("isset(\$_POST['a-'.$prefix.'MoveCopyRename'])");
if ($object->getFolder() === $_zp_current_admin['user'] && !$object->getParent()) {
unset($_POST['a-'.$prefix.'MoveCopyRename']);
debugLog("isset(\$_POST['a-'.$prefix.'MoveCopyRename'])");
}
debugLog("isset(\$_POST['a-'.$prefix.'MoveCopyRename'])");
}
`
The full code is at the link I posted before if you're interested. Any help at all would be appreciated.
Also check error logs to be sure there is not a PHP error. Your debugLog statements may not actually be correct. Certainly there is no need for the quotation marks unless you are actually passing some text. Something like `debugLog("folder=".$object->getFolder());` is probably what you really want.