• 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

Change the "explore" function

Gunz

Chevereto Member
Hello Rodolfo, thank you for your amazing work ;)

1) - Cause on my website is allowed also the post of "adult" images i dont want that they are showed on home page cause the site is used also by <18 years old.

So i was wondering if i could change the query to show the images on home.

I saw that the code looks like
Code:
      global $tabs; // Define it as a global to bind it on the included tab.php
       $tabs = array(
         0 => array(
           "list"     => false,
           "tools"     => true,
           "label"     => _s('Most recent'),
           "id"     => "list-most-recent",
           "params"   => "list=images&sort=date_desc&page=1",
           "current"   => $_REQUEST["sort"] == "date_desc" or !$_REQUEST["sort"] ? true : false,
         ),

I was thinking to host some images with the similar name like HOME1, HOME2, HOME3 etc so the query could be LIKE HOME%.

Do you got any idea?

SOLVED 2) - Is it possible that when an user enter on website the "upload form" is already opened? I mean when you click on top-left in "upload" appear the form. I want that when an user enter in the website the forum is already opened up.


Thank you :)
 
Last edited:
I also would like to have the same feature as 1).
My idea is that admin user will have an album which contain images that will be displayed on the homepage.
Please implement this after you finish with all the bugs. Thank you!
 
I also would like to have the same feature as 1).
My idea is that admin user will have an album which contain images that will be displayed on the homepage.
Please implement this after you finish with all the bugs. Thank you!

Yes this is a think the "final" code. Admin can choose from the Admin panel the images uploaded by users.

But for now i think is more easier my idea. I need it ASAP.

Cheers
 
Bump for point 1, also a TEMP fix is accepted :)

Another simple idea: Show only the images posted by 1 user (in this case i will upload all images with this user account).
 
As you may notice Chevereto comes with an universal listing class. So if you want to pull only the content of certain user you only have to inject that where you call the class (in this case index.php). Just check how is done in user.php and inject the user ID that you want to display.
 
As you may notice Chevereto comes with an universal listing class. So if you want to pull only the content of certain user you only have to inject that where you call the class (in this case index.php). Just check how is done in user.php and inject the user ID that you want to display.

Thank u for the tip, i will let you know ;)
 
Okai i think that the parts that i must modify are these.

This one on index.php
Code:
// Use CHV magic params
     $list_params = CHV\Listing::getParams();
     
     $type = 'images';
     
     try {
       global $list;
       $list = new CHV\Listing;
       $list->setType($type); // images | users | albums
       $list->setOffset($list_params['offset']);
       $list->setLimit($list_params['limit']); // how many results?
       $list->setItemsPerPage($list_params['items_per_page']); // must
       $list->setSortType($list_params['sort'][0]); // date | size | views
       $list->setSortOrder($list_params['sort'][1]); // asc | desc
       $list->setRequester(CHV\Login::getUser());
       $list->exec();
     } catch(Exception $e) {
       G\exception_to_error($e);
     }

With this on user.php
Code:
if(get_user()["image_count"] > 0 or get_user()["album_count"] > 0) {

       // Use CHV magic params
       $list_params = CHV\Listing::getParams();
       
       global $output_tpl;
       $output_tpl = "user/";
       
       if(is_user_images() or get_user()["search"]["type"] == "images") {
         $output_tpl .= "images";
       }
       if(is_user_albums() or get_user()["search"]["type"] == "albums") {
         $output_tpl .= "albums";
       }
       
       $type = is_user_images() ? "images" : "albums";
       $where = is_user_images() ? "WHERE image_user_id=:user_id" : "WHERE album_user_id=:user_id";
       
       if(is_user_search()) {
         $type = get_user()["search"]["type"];
         $where = get_user()["search"]["type"] == "images" ? "WHERE image_user_id=:user_id AND image_name LIKE :q OR image_description LIKE :q" : "WHERE album_user_id=:user_id AND album_name LIKE :q";
       }
       
       try {
         global $list;
         $list = new CHV\Listing;
         $list->setType($type); // images | users | albums
         $list->setOffset($list_params['offset']);
         $list->setLimit($list_params['limit']); // how many results?
         $list->setItemsPerPage($list_params['items_per_page']); // must
         $list->setSortType($list_params['sort'][0]); // date | size | views
         $list->setSortOrder($list_params['sort'][1]); // asc | desc
         $list->setWhere($where);
         $list->set_owner(get_user()["id"]);
         $list->setRequester(CHV\Login::getUser());
         $list->bind(":user_id", get_user()["id"]);
         if(is_user_search() and !empty($_REQUEST["q"])) {
           $list->bind(":q", "%".$_REQUEST["q"]."%");
         }
         $list->output_tpl = $output_tpl;
         $list->exec();
         
       } catch(Exception $e) {
         G\exception_to_error($e);
       }
     }

But sicnerly i dont know how modify. I was wondering if there was a possibility only to do a single check like, if(user_id == "x") then show image.
 
PHP:
try {
    global $list;
    $list = new CHV\Listing;
    $list->setType($type);
    $list->setOffset($list_params['offset']);
    $list->setLimit($list_params['limit']);
    $list->setItemsPerPage($list_params['items_per_page']);
    $list->setSortType($list_params['sort'][0]);
    $list->setSortOrder($list_params['sort'][1]);
    $list->setRequester(CHV\Login::getUser());
    $list->setWhere("WHERE image_user_id=:user_id");
    $list->bind(":user_id", '<injected user id here>');
    $list->exec();
} catch(Exception $e) {
    G\exception_to_error($e);
}

This should do for the initial load and you will need to also bind the tabs (which generates the ajaxed listings params).
 
Oki with this try the first images are from the user "injected user id here", but if i continue to scroll down then i see also the images from other people.

Maybe i must modify this?

Code:
      $tabs = array(
         0 => array(
           "list"     => false,
           "tools"     => true,
           "label"     => _s('Most recent'),
           "id"     => "list-most-recent",
           "params"   => "list=images&sort=date_desc&page=1",
           "current"   => $_REQUEST["sort"] == "date_desc" or !$_REQUEST["sort"] ? true : false,
         ),
 
EDIT: I throught it was solved but it's not. After some upload and refresh, all images are appeared.

On index.php i got like that:
Code:
    try {
  global $list;
  $list = new CHV\Listing;
  $list->setType($type);
  $list->setOffset($list_params['offset']);
  $list->setLimit($list_params['limit']);
  $list->setItemsPerPage($list_params['items_per_page']);
  $list->setSortType($list_params['sort'][0]);
  $list->setSortOrder($list_params['sort'][1]);
  $list->setRequester(CHV\Login::getUser());
  $list->setWhere("WHERE image_user_id=:user_id");
  $list->bind(":user_id", '2');
  $list->exec();
} catch(Exception $e) {
  G\exception_to_error($e);
}

PS: I tried also with your index.php, same problem.
 
Mmm is it possible it's caused by cookie? I think that was the cause of my issue. Deleting the cache of the borwser solved the problem.

Problem persist.
 
But when you click on to another tab like "Most viewed", it still appear pictures from guest.
However, when you refresh that page, those picture will disappear.
 
Back
Top