• There appears to be a logic issue that causes a custom template and CSS to be reset to the default every time the plugin is deactivated and then activated. This can happen, for example, if you edit the plugin code within WordPress. If you’ve spent any time building your template to then have it disappear this will probably be why.
    So in classes\staff_settings.php I replaced lines 21 through 35 with the below. It seemed to resolve the issue, BYMMV.

    // ATI This was || below, but that meant that every time the plugin was deactivated and then
    	// reactivated, the custom template and CSS got reset.  Using && makes sure this only happens when
    	// first setting things up and only if staff_directory_custom_templates has not previously been set.
    	// Also moved the cleanup of staff_directory_html_template and staff_directory_css_template
    	// to happen even if the condition below is not met.
        } else if ($current_template_slug == 'custom' &&
    		get_option('staff_directory_html_template', '') != '' &&
    		get_option('staff_directory_custom_templates') == '') {
    
          $templates_array = array();
          $templates_array[] = array(
            'html' => get_option('staff_directory_html_template'),
            'css' => get_option('staff_directory_css_template')
          );
          $staff_settings->updateCustomStaffTemplates($templates_array);
          $staff_settings->updateDefaultStaffTemplateSlug('custom_1');
    	}
    	if (get_option('staff_directory_html_template', '') != '') {
          delete_option('staff_directory_html_template');
          delete_option('staff_directory_css_template');
        }
      }

    https://ww.wp.xz.cn/plugins/staff-directory/

Viewing 2 replies - 1 through 2 (of 2 total)
  • @ashdowntech there was a release today and I believe @adamtootle fixed this issue. Can you update to the latest version to confirm? I didn’t put in the fix for this one, but did submit a PR with other fixes for the 1.0.3 release. Let me know if it still isn’t resolved and I will follow up. Thanks!

    Plugin Author adamtootle

    (@adamtootle)

    @tnolte It was fixed but it was after the 1.0.3 release. It will be in the next one, though. I’m going to try to put some time in on this over the next few days and knock out a couple of issues reported here. If anyone’s interested the Github repo has the fix, just not the ww.wp.xz.cn repo (yet).

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Custom Template/CSS gets arbitrarily reset to default’ is closed to new replies.