Based on this plugin:
plugin delete control I created another simple plugin which removes some settings from the modify album page. The plugin code is as follows:
<?php
/**************************************************
Coppermine Plugin - Delete Control
*************************************************
Copyright (c) 2005 Paul Van Rompay
*************************************************
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
***************************************************/
//
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');
// ------------------------------------------------------------------------------------------------
// Add filters - process search album and add to search results page
// ------------------------------------------------------------------------------------------------
$thisplugin->add_filter('page_html','permControl_filterpage');
// ------------------------------------------------------------------------------------------------
// Filter page_html to remove delete buttons
// ------------------------------------------------------------------------------------------------
//
function permControl_filterpage($html) {
if (defined('MODIFYALB_PHP') && !GALLERY_ADMIN_MODE) {
$html = preg_replace('/(?U)(?s)(<tr>\s*<td class="tableh2" colspan="2">\s*<strong>Permissions for this album<\/strong>).*depending on groups settings.*\/td>.*\/tr>/','',$html);
}
return $html;
}
// ------------------------------------------------------------------------------------------------
// End of plugin code
// ------------------------------------------------------------------------------------------------
?>
This code simply removes 4 options from the update album screen (modifyalb.php) for non-admins:
Album can be viewed by
Password protect this album (Tick for yes)
Visitors can post comments * Yes No
Visitors can rate files * Yes No
[and a line which reads * depending on group settings]
The problem comes into play when the user goes to perform an update. A database error is generated due to the fact that the visibility variable is not initialized. see 'visibility = , alb_password = '',' part of the sql query.
While executing query 'UPDATE cpg15x_albums SET title = 'test project', description = 'album description', category = 10084, thumb = 0, comments = 'NO', votes = 'NO', visibility = , alb_password = '', alb_password_hint = '', keyword = '' WHERE aid = 1' in db_input.php on line 433
My question is where should I add the initialization of the variable? I am confused since the plugin is only removing the display from the screen so wouldn't expect it to break things, however it does work fine when the plugin is deactivated so it is definitely the plugin.