Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: search by username is missing  (Read 4665 times)

0 Members and 1 Guest are viewing this topic.

angelsfire

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
search by username is missing
« on: January 09, 2023, 12:03:17 am »

my gallery version: Coppermine Photo Gallery 1.6.09 (stable)
https://www.thefantasiesattic.net/attic/cpg/index.php

I have not needed to search by name in such a long time that I did not notice it missing. But as you can see from the image it is not listed anymore. Now I did get it to show up but the rest of the files that needed the code changed just made it not search and I got an error.

Code: [Select]

1. Open search.php

FIND:

$customs
$ip

and above, ADD:


                                        <tr>
                                                <td><input type="checkbox" name="owner_name" id="owner_name" class="checkbox" /><label for="owner_name" class="clickable_option">Owner name</label></td>
                                                <td>&nbsp;</td>
                                        </tr>




adding the above code made it appear in the list but no more the following is the rest of the code that was all for version 1.5.48 (I loved that version). I have not updated any farther since it took someone coming in to  make it behave (mainly a hosting issue it much later came out).

Code: [Select]
2. Open thumbnails.php

FIND

$allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4', 'type');

REPLACE WITH
$allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4', 'type', 'owner_name');


3. Open include/search.inc.php

FIND

$allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4');


ADD BELOW

global $cpg_udb;
// Use actual column name for search by owner name
if ($USER['search']['params']['owner_name']) {
    $USER['search']['params'][$cpg_udb->field['username']] = true;
    $allowed[] = $cpg_udb->field['username'];
}


FIND

            $query = "SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} AS p
                WHERE $sql
                AND ($sort_order)";

REPLACE

            $query = "SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} AS p
                LEFT JOIN {$cpg_udb->usertable} AS u ON p.owner_id = u.{$cpg_udb->field['user_id']}
                WHERE $sql
                AND ($sort_order)";


FIND

            $query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE " . $sql;

            $temp = str_replace('SELECT *', 'SELECT COUNT(*)', $query);

REPLACE

            $query = "SELECT p.*, u.{$cpg_udb->field['username']} AS owner_name FROM {$CONFIG['TABLE_PICTURES']} AS p
            LEFT JOIN {$cpg_udb->usertable} AS u ON p.owner_id = u.{$cpg_udb->field['user_id']}
            WHERE " . $sql;

            $temp = str_replace("SELECT p.*, u.{$cpg_udb->field['username']} AS owner_name", 'SELECT COUNT(*)', $query);



Can someone please give me the proper code to allow the username to show and be searched for?  It is bridged but will not let me return to bridging to reset the password or anything else since the upgrade. If an admin password is needed then let me know.
Logged

Joe Carver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1545
  • aka 'i-imagine'
    • Home Page
Re: search by username is missing
« Reply #1 on: January 09, 2023, 03:26:28 am »

Try an update to Coppermine 1.6.2 and run Check Versions (versioncheck.php) after completing the update.

What you are looking for is working out of the box for me on 1.6.2.

Dark_Angel

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: search by username is missing
« Reply #2 on: January 09, 2023, 05:48:50 am »

I have avoided updating further than the version I had since it was so hard to update the gallery to it. I will see if I can do it withut killing my gallery.
Logged

Dark_Angel

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: search by username is missing
« Reply #3 on: January 09, 2023, 05:59:53 am »

I forgot to mention that my PHP version is 7.1 and the version you said to update to updates for v8.1+ will that mess things up?
Logged

Joe Carver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1545
  • aka 'i-imagine'
    • Home Page
Re: search by username is missing
« Reply #4 on: January 09, 2023, 11:55:12 pm »

I have avoided updating further than the version I had since it was so hard to update the gallery to it. I will see if I can do it withut killing my gallery.

Follow the instructions (links above), make your backups first, and take your time.

I forgot to mention that my PHP version is 7.1 and the version you said to update to updates for v8.1+ will that mess things up?
No, it will not.

Dark_Angel

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: search by username is missing
« Reply #5 on: January 10, 2023, 02:29:36 am »

will try and see what it does and let you know, am getting ready for surgery on Friday so it may be a bit. Thanks
Logged

angelsfire

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: search by username is missing
« Reply #6 on: April 17, 2023, 12:47:20 am »

still trying to get caught up to attempt this. hopefully, it won't want me to log into the bridge cause lost that info quite a while ago.
Logged

Dark_Angel

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: search by username is missing
« Reply #7 on: September 03, 2023, 09:56:22 pm »

Well with sickness and net issues and sheer fright of losing the gallery, I still have not gotten this taken care of. I also have no way of knowing my bridge username/password with the hard drive eating everything I had saved on it.

I don't suppose there is a way to install the prior to these [1.5.48 one not the 1.6+] then importing the database? We all l iked that version, it never gave me problems.
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 20 queries.