teraßyte Posted January 29, 2023 Posted January 29, 2023 (edited) @Adriano Faria In case you want to add it in a future version, here's the code I added right before the code to uninstall the plugin in order to convert old background data: # Plugin column available? Convert the background data if ( \IPS\Db::i()->checkForColumn( 'core_members', 'ProfileBackgroundImage' ) ) { \IPS\Db::i()->insert( 'profilebackgrounds_data', \IPS\Db::i()->select( 'member_id, ProfileBackgroundImage', 'core_members', 'ProfileBackgroundImage IS NOT NULL' ) ); } Also, I had problems getting the image to display in the profile. I was receiving this error: Unknown column '' in 'where clause' After debugging, the problem is in the file /applications/profilebackgrounds/hooks/memberModel.php. The profileBackgroundImage() function currently uses this code to load the background data: return \IPS\Db::i()->select( 'pb_location', 'profilebackgrounds_data', array( 'pb_location!="" AND pb_member_id=?', $this->member_id ) )->first(); Unfortunately, some MySQL versions are picky and don't like double quotes in queries. Once I swapped around single and double quotes in the WHERE parameter it started working properly: array( "pb_location!='' AND pb_member_id=?", $this->member_id ) Edited January 29, 2023 by teraßyte Adriano Faria and SJ77 1 1
Adriano Faria Posted January 30, 2023 Posted January 30, 2023 On 1/29/2023 at 1:25 AM, teraßyte said: some MySQL versions are picky and don't like double quotes in queries. I will use IS NOT NULL instead, as NULL is used to save when the user removes the image. 👍 SJ77 1
Recommended Posts