Jan Bastiaanssen Posted May 13, 2021 Report Share Posted May 13, 2021 Using admin_media.php, I get the standard report. I would like a extra column Owner/Source between Linked to and Last modified. Is that posssible; if yes how can i realize that. Thanks, Jan Quote Link to comment Share on other sites More sharing options...
Michel KIRSCH Posted May 14, 2021 Report Share Posted May 14, 2021 Jan, to make what you want, you must do 3 things : 1) modify the $query to "import" the owner from the table 2) Add a column and it's title to the table 3) insert the data imported in the new column In admin_media.php : 1) Modifying the $query : modify this block : $query = "SELECT $media_table.mediaID as mediaID, $medialinkID description, notes, path, thumbpath, mediatypeID, abspath, mediakey, usecollfolder, $media_table.gedcom, form, changedby, DATE_FORMAT(changedate,\"%d %b %Y\") as changedatef FROM $media_table $join $wherestr ORDER BY $orderstr LIMIT $newoffset" . $maxsearchresults; in : $query = "SELECT $media_table.mediaID as mediaID, $medialinkID description, notes, owner, path, thumbpath, mediatypeID, abspath, mediakey, usecollfolder, $media_table.gedcom, form, changedby, DATE_FORMAT(changedate,\"%d %b %Y\") as changedatef FROM $media_table $join $wherestr ORDER BY $orderstr LIMIT $newoffset" . $maxsearchresults; 2) Add a column : After this line, <td class="fieldnameback fieldname"><nobr> <b><?php echo $admtext['linkedto']; ?></b> </nobr></td> insert : <td class="fieldnameback fieldname"><nobr> <b><?php echo "Your column name here"; ?></b> </nobr></td> 3) add the data : after this block : $medialinktext = $medialinktext ? "<ul>\n$medialinktext\n</ul>\n" : " "; echo "<td nowrap class=\"lightback normal\" valign=\"top\">$medialinktext</td>\n"; Add this line : echo "<td nowrap class=\"lightback normal\" valign=\"top\">{$row['owner']}</td>\n"; Tested. Don't forget to make it permanent with a Mod ! Michel Quote Link to comment Share on other sites More sharing options...
Jan Bastiaanssen Posted May 14, 2021 Author Report Share Posted May 14, 2021 Thanks a lot Michel, I will try this tonight. Thanks, Jan Quote Link to comment Share on other sites More sharing options...
Jan Bastiaanssen Posted May 14, 2021 Author Report Share Posted May 14, 2021 Michel, I followed your lines and that worked like a charm. THANKS A LOT. For maintenance reasons I tried to make that column selectable bit that is not realy work. Do you have time to look at it ? Attached is the cfg-file. Xtra Media Column.cfg Quote Link to comment Share on other sites More sharing options...
Rob Severijns Posted May 15, 2021 Report Share Posted May 15, 2021 Jan, Michel, Nice modification. I'm interested in the working cfg file too. Rob Quote Link to comment Share on other sites More sharing options...
Michel KIRSCH Posted May 15, 2021 Report Share Posted May 15, 2021 Jan, the mod can not install because your location 1 already contains the ", owner" field ! Quote Link to comment Share on other sites More sharing options...
Michel KIRSCH Posted May 15, 2021 Report Share Posted May 15, 2021 To make the check box functionning, you must 1 - define the $admtext['noowner'] in your customconfig.php file (best is a $text['noowner'] = "Geen eigenaar"; in $text and not in $admtext) 2.- when the box is checked, you have to modify the sql string with if($noowner){ $wherestr .= $wherestr ? " AND owner = \"\"" : "owner = \"\""; } after if( $nothumb ) { $wherestr .= $wherestr ? " AND thumbpath = \"\"" : "thumbpath = \"\""; } Not tested but i think it will works... Michel PS : to have more facility to retrieve your modified code, please indicate it with a string like "// Xtra column Mod " Replacing the entire $query string is not a good practice : if another mod must work on the same part, it cannot install after your mod and vice-versa. The best is to look if your owner field is not already in the $query string and if not, add it. if (!stristr(", owner", $query)) $query = str_replace("notes, ","notes, owner, ",$query); Quote Link to comment Share on other sites More sharing options...
Michel KIRSCH Posted May 15, 2021 Report Share Posted May 15, 2021 When you've finished, compare your mod with this version... Michel Xtra Media Column_v13.0.3.1.cfg Quote Link to comment Share on other sites More sharing options...
Jan Bastiaanssen Posted May 15, 2021 Author Report Share Posted May 15, 2021 Michel, my new version (attached), runs into an error which i can't get away. Your version runs, but selection is not working. Thanks, Jan Xtra Media ColumnJAN.cfg Quote Link to comment Share on other sites More sharing options...
Michel KIRSCH Posted May 15, 2021 Report Share Posted May 15, 2021 What's the error Jan? I've tested my version : it runs fine... Send me your admin_media.php file. I think there are some code snippets staying in it or replace your admin_media.php with a fresh version (be sure that no others mods are modifying it !) Michel Quote Link to comment Share on other sites More sharing options...
Michel KIRSCH Posted May 15, 2021 Report Share Posted May 15, 2021 I find youe error : you will replace the $query striing, but you indicate $query = "SELECT $media_table.mediaID as mediaID, $medialinkID description, notes, path, thumbpath, mediatypeID, abspath, mediakey, usecollfolder, $media_table.gedcom, form, changedby, DATE_FORMAT(changedate,\"%d %b %Y\") as changedatef this is not the entire query... Quote Link to comment Share on other sites More sharing options...
Michel KIRSCH Posted May 15, 2021 Report Share Posted May 15, 2021 and the second error is : if($noowner){ $wherestr .= $wherestr ? " AND noowner = \"\"" : "noowner = \"\""; } but the field noowner doesn't exists in the table. The field name is owner. noowner is the name of your field on the screen(the checkbox) so : if($noowner){ $wherestr .= $wherestr ? " AND owner = \"\"" : "owner = \"\""; } Quote Link to comment Share on other sites More sharing options...
Michel KIRSCH Posted May 15, 2021 Report Share Posted May 15, 2021 8 hours ago, Rob Severijns said: I'm interested in the working cfg file too Rob, do you try my version? Quote Link to comment Share on other sites More sharing options...
Rob Severijns Posted May 15, 2021 Report Share Posted May 15, 2021 Michel, Yes, I have installed it. Seems to work just fine. Rob Quote Link to comment Share on other sites More sharing options...
Michel KIRSCH Posted May 15, 2021 Report Share Posted May 15, 2021 2 minutes ago, Rob Severijns said: Yes, I have installed it. Thx. Michel Quote Link to comment Share on other sites More sharing options...
Rob Severijns Posted May 15, 2021 Report Share Posted May 15, 2021 Quote Link to comment Share on other sites More sharing options...
Jan Bastiaanssen Posted May 15, 2021 Author Report Share Posted May 15, 2021 Michel, I don't know what i did wrong, but your version works like a charme now. Thanks very much. Jan Quote Link to comment Share on other sites More sharing options...
Jan Bastiaanssen Posted May 15, 2021 Author Report Share Posted May 15, 2021 Michel & Rob, For your interest: Xtra Media Column V13.0.3.1.cfg is not working together with admin_media_search V13.0.0.14d.cfg from Robin Richmond. So we have to choose. Jan Quote Link to comment Share on other sites More sharing options...
Michel KIRSCH Posted May 15, 2021 Report Share Posted May 15, 2021 So long Jan ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.