• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.
  • Chevereto Support CLST

    Support response

    Support checklist

    • ⚠️ Got a Something went wrong message? Read this guide and provide the actual error. Do not skip this.
    • ✅ Confirm that the server meets the System Requirements
    • 🔥 Check for any available Hotfix - your issue could be already reported/fixed
    • 📚 Read documentation - It will be required to Debug and understand Errors for a faster support response

Lock the images that are currently showing on the home page .... Or prevent it altogether?

AshleyUK

💖 Chevereto Fan
Hi,
Is there any way of either...

1. Locking the current homepage images - and preventing any new uploaded images from showing.
or
2. Preventing these images from showing at all ??

Thanks
 
Home images are set by default to either show the last images of a given user or just show the recent images from anyone. Now, if you look at the code the system is pretty flexible in terms of what you can do with listings and if you look at this code in app/themes/Peafowl/index.php

PHP:
            if($home_user) {
                $list->setWhere('WHERE image_user_id=:user_id');
                $list->bind(":user_id", $home_user['id']);
            }

You will notice that the setWhere condition allows you to inject any mysql where clause. So you can replace that code with this:

PHP:
$list->setWhere('WHERE image_id IN (1,2,3,4)');

And the result will be that the system will only show the images id 1, 2, 3, 4. So if you want to lets say lock a given array of images to the home page you only need to get the real id (you can do it using the info tab on each image, look for the info tab).

You can also go crazy there and set more clauses like show only jpg images and/or show the images from a range of users, anything. With the setWhere function you can truly do anything.
 
Thank you! I'll take a look at this :)

-- Edit --

I managed to achieve what I wanted using your instructions. Thanks
 
Last edited:
Hi,
This method has worked for me up to version 3.5.12, but 3.5.13 has slightly different coding.

Instead of:

PHP:
   if($home_user) {
   $list->setWhere('WHERE image_user_id=:user_id');
   $list->bind(":user_id", $home_user['id']);
   }


It's been changed to:

PHP:
        if(is_array($home_uid_arr)) {
            $where = 'WHERE image_user_id IN('.$home_uid_bind.')';
            if($home_uid_is_null) {
                $where .= ' OR image_user_id IS NULL';
            }
            $list->setWhere($where);
            foreach($home_uid_arr as $k => $v) {
                $list->bind(':user_id_' . $k, $v);
            }
        }

I've tried a couple of things, but I'm not able to implement the previous modifications 'correctly'.
Am I still able to select certain images for the home screen?

For now, I have set up a "dummy user", and used the User ID as the homepage images.
So it's not really a problem, I was just wondering.
No doubt some others will want to know the answer to this too :)
 
Simply change the $where var to $where = 'WHERE image_id IN (1,2,3,4)'; and just comment the other code.
 
Hmm that's one of the things that I tried changing. But it didn't work?
However, I might have done it wrong.

I will try again later (in about 9-10 hours, as I'm at work now).
I'll revert back later :)
Thanks
 
Replace this:
PHP:
        if(is_array($home_uid_arr)) {
            $where = 'WHERE image_user_id IN('.$home_uid_bind.')';
            if($home_uid_is_null) {
                $where .= ' OR image_user_id IS NULL';
            }
            $list->setWhere($where);
            foreach($home_uid_arr as $k => $v) {
                $list->bind(':user_id_' . $k, $v);
            }
        }

For this:
PHP:
        /*if(is_array($home_uid_arr)) {
            $where = 'WHERE image_user_id IN('.$home_uid_bind.')';
            if($home_uid_is_null) {
                $where .= ' OR image_user_id IS NULL';
            }
            $list->setWhere($where);
            foreach($home_uid_arr as $k => $v) {
                $list->bind(':user_id_' . $k, $v);
            }
        }*/
        $list->setWhere('WHERE image_id IN (1,2,3,4)');
 
Back
Top