Support » Plugins and Hacks » [Plugin: Magic Fields] Image Upload conflict with WP 3.5 upgrade

  • Resolved databell96


    Just upgraded one client to WordPress 3.5 and immediately could no longer use Image/Media Upload. I would receive an error if I tried uploading something. Turned off all plugins and then turned them back on one by one and found the culprit. It’s Magic Field 2.0.1. Is anyone from the team working on a fix for this?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Same problem here, really hoping there will be a fix. I love Magic fields.

    UPDATE – I hit them up on twitter, and one of the guys said they hope to have a new release sometime this week.

    I installed the fix but all I got was this error in my dashboard:

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, class ‘mf_menu’ not found in /home/socal41/public_html/wp-includes/plugin.php on line 406

    Deskboard and all of wp-admin is still usable. However, just try going further into a post and you get the white screen of death and this:

    Fatal error: Call to undefined method mf_post::set_categories() in /home/socal41/public_html/wp-content/plugins/magic-fields-2/main.php on line 243

    Hmmm, did you replace the whole main.php code?
    Seems like I got an error like that when I copy/pasted their entire new main.php file.
    But when I only replaced the small section that they show, it worked just fine.

    Yea, I copied it all. I didn’t see anywhere where I was supposed to just copy/paste a small section.

    Here’s my main.php code, try this:

    Plugin Name: Magic Fields
    Plugin URI:
    Description: Create custom fields for your post types
    Version: 2.0.1
    Author:  Hunk and Gnuget
    Author URI:
    License: GPL2
    /*  Copyright 2011 Magic Fields Team 
        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License, version 2, as
        published by the Free Software Foundation.
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        GNU General Public License for more details.
        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     * i18n
    global $mf_domain,$mf_pt_register;
    $mf_domain = 'magic_fields';
    $mf_pt_register = array();
     * Constants
    require_once( 'mf_extra.php' );
    require_once( 'mf_constants.php' );
    //auto loading files
    function mf_autoload( $name ) {
      //main files
      if( file_exists( MF_PATH.'/'.$name.'.php' ) ) {
        require_once( MF_PATH.'/'.$name.'.php' );
      //admin files
      if( file_exists( MF_PATH.'/admin/'.$name.'.php' ) ) {
        require_once( MF_PATH.'/admin/'.$name.'.php' );
      //field types
      if( file_exists( MF_PATH.'/field_types/'.$name.'/'.$name.'.php' ) ) {
        require_once( MF_PATH.'/field_types/'.$name.'/'.$name.'.php');
    if (function_exists("__autoload")) {
     * Activation and Deactivation
    register_activation_hook( __FILE__, array('mf_install', 'install' ) ); 
    //In wp 3.1 and newer the register_activation_hook is not called
    //when the plugin is updated so we need call the upgrade
    //function by hand
    function mf_update_db_check() {
      if ( get_option(MF_DB_VERSION_KEY) != MF_DB_VERSION ) {
    //MF in mode plusing multinetwork
    if( mf_mu2() ){
    //Register Post Types and Custom Taxonomies
    $mf_register = new mf_register();
    //Adding metaboxes, and hooks for save the data when is created a new post
    $mf_post = new mf_post();
    if( is_admin() ) {
      //load_plugin_textdomain($mf_domain    , '/'.PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)).'/lang', basename(dirname(__FILE__)).'/lang');
    load_plugin_textdomain('magic_fields', '/'.PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)).'/lang', basename(dirname(__FILE__)).'/lang');
      //check folders
      add_action('admin_notices', array('mf_install', 'folders'));  
      //add common function
      add_action( 'admin_enqueue_scripts', 'mf_enqueue_scripts' );
      function mf_enqueue_scripts() {
        // CSS Files
        wp_register_style( 'mf_admin_css',MF_BASENAME.'css/mf_admin.css' );
        wp_enqueue_style( 'mf_admin_css' );
      // Settings Page
      add_action( 'admin_menu', 'mf_menu' );
      function mf_menu( ) {
          global $mf_domain;
          add_options_page(__('Magic Fields Settings', $mf_domain ), 'Magic Fields', 'manage_options', 'mf_settings', array('mf_settings','main') );
      //Administration page
      function mf_admin() {
        global $mf_domain;
        add_menu_page('Magic Fields','Magic Fields','activate_plugins','mf_dispatcher','mf_dispatcher',MF_BASENAME.'/images/wand-hat.png');
        add_submenu_page('mf_dispatcher', __('import',$mf_domain), __('Import',$mf_domain), 'edit_pages','mf_dispatcher&mf_section=mf_posttype&mf_action=import_form_post_type', 'mf_dispatcher');
      add_action( 'admin_menu', 'hide_panels' );
      function hide_panels() {
        //hidding the post or page panel
        //accord with the settings
        if( mf_settings::get('hide_post_panel') ) {
        if( mf_settings::get('hide_page_panel') ) {
      //Adding metaboxes into the  pages for create posts
      //Also adding code for save this data
      add_action( 'add_meta_boxes', 'mf_add_meta_boxes');
      function mf_add_meta_boxes() {
       * Magic Fields dispatcher
      function mf_dispatcher() {
        $section = "mf_dashboard";
        $action = "main";
        if( !empty( $_GET['mf_section'] ) ) {
          $section = urlencode($_GET['mf_section']);
        if( !empty( $_GET['mf_action'] ) ) {
          $action = urlencode( $_GET['mf_action'] );
        $tmp = new $section();
        //call_user_func( array( $section, $action ) );
       * Init Hook
      add_action( 'init', 'mf_init' );
      function mf_init() {
        //Sometimes is neccesary execute the mf_dispatcher function in the init hook
        //because we want use a custom headers or a redirect (wp_safe_redirect for eg)
        if(!empty($_GET['init']) &&  $_GET['init'] == "true" ) {
      //Including javascripts files
      add_action( 'init', 'mf_add_js');
      function mf_add_js() {
        global $mf_domain;
        if( is_admin() ) { //this scripts only will be added on the admin area
          wp_enqueue_script( 'jquery.validate',MF_BASENAME.'js/third_party/jquery.validate.min.js', array( 'jquery' ) );
          wp_enqueue_script( 'jquery.metadata',MF_BASENAME.'js/third_party/jquery.metadata.js', array( 'jquery' ) );
          wp_enqueue_script( 'mf_admin',MF_BASENAME.'js/mf_admin.js', array( 'jquery.validate', 'jquery.metadata', 'jquery' ) );
          if( isset($_GET['mf_action']) && in_array($_GET['mf_action'],array('add_field','edit_field') )  ){
            wp_enqueue_script( 'jquery.stringToSlug', MF_BASENAME.'js/third_party/jquery.stringToSlug.min.js', array('mf_admin') );
          //and this scripts only will be added on the post types section
          if( !empty( $_GET['mf_section'] ) && $_GET['mf_section'] == "mf_posttype" ) {
            wp_enqueue_script( 'mf_posttype', MF_BASENAME.'js/mf_posttypes.js', array('mf_admin') );
          //and this scripts only will be added on the post types section
          if( !empty( $_GET['mf_section'] ) && $_GET['mf_section'] == "mf_custom_taxonomy" ) {
            wp_enqueue_script( 'mf_taxonomy', MF_BASENAME.'js/mf_taxonomy.js', array('mf_admin') );
          //Adding the files for the sort feature of the custom fields
          if( ( !empty( $_GET['mf_section'] ) && $_GET['mf_section'] == 'mf_custom_fields' ) &&
              ( !empty( $_GET['mf_action'] ) && $_GET['mf_action'] == 'fields_list' ) ) {
            wp_enqueue_script( 'mf_sortable_fields', MF_BASENAME.'js/mf_posttypes_sortable.js', array( 'jquery-ui-sortable' ) );
          //Adding Css files for the post-new.php section (where is created a new post in wp)
          if( strstr( $_SERVER['REQUEST_URI'], 'post-new.php' ) !== FALSE  || strstr( $_SERVER['REQUEST_URI'],  'wp-admin/post.php') !== FALSE ) {
            /* Load JS and CSS for post page */
            $css_js = new mf_post();
      /* estara sera la funcion principal de llamadas js de MF*/
      function mf_ajax_call(){
        $call = new mf_ajax_call();
      add_filter('attachment_fields_to_edit', 'charge_link_after_upload_image', 10, 2);
      function charge_link_after_upload_image($fields){
            ( isset($_REQUEST['fetch']) && $_REQUEST['fetch'] ) ||
            ( isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'library' )
    <script type=\"text/javascript\">
          return $fields;
      /* load front-end functions */
      require_once( 'mf_front_end.php' );

    OK, I think we got it! Thanks for assisting! Definitely better than waiting for the actual update notification in my wp-admin.

    No problem, glad it worked!

    Awesome, thanks eastbank and databell96… Ran into the same problem today and thanks to you I had it fixed in a minute.

    tks man! worked!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: Magic Fields] Image Upload conflict with WP 3.5 upgrade’ is closed to new replies.