Admin SSL のWordPress 3.1 対応版を作りました

WordPressの管理画面、並びに入力フォームなど任意のページをSSL化してくれる便利なプラグイン、Admin SSLというのがあります。
非常に便利だったんですが…。
WordPress3.1になって、使えなくなってしまいました。有効化すると真っ白に飛んでしまい、PHPエラーを表示させると次のようなメッセージが出ています。

Fatal error: Cannot redeclare user_can() (previously declared in /home/dacelo/public_html/wp-includes/capabilities.php:1099) in /home/dacelo/public_html/wp-content/plugins/admin-ssl-secure-admin/admin-ssl.php on line 113

うわー、Fatal Errorか…。これはどうしようもないな。かといって他のプラグインを探そうにも、「管理画面をSSLにする」というプラグインはあっても、指定した通常ページをSSL化するようなプラグインはこれしかないんですよね。

エラーメッセージから原因を探ってみると、3.1から本体で使われているuser_canという関数が、Admin SSLで使われているものと被ってしまっているようです。
そこで、WordPress3.1用の修正版を暫定的に作ってみました。

こちらからダウンロードしてお使いください。

作者のサイトを見てみると、3月8日に「近日中に対処したい」という旨のメッセージがありましたので、いずれ最新版が出たときには直っているかと思います。それまではこちらを配布しておきます。

修正箇所

ちなみに、修正した箇所はこの辺です。

admin-ssl.php #113~#114

             function user_can($what){ # checks if function exists before calling it
                 return(function_exists("current_user_can") ? current_user_can($what) : false); }

includes/options.php #45~#51

     //
     //  when updating ensure that the user has enough privileges to do so
     //
 
         elseif($action === "update" && user_can("manage_options"))
             return(is_wpmu() ? update_site_option($name,$value) : update_option($name,$value));
     }endif;

includes/config.php #11~#22、#41~#42

 //
 //  add Admin SSL config page
 //
 
     function as_admin_menu()
     {
         global $config_parent,$config_page_ref;
         if(function_exists("add_submenu_page") && user_can("level_10"))
             add_submenu_page($config_parent,"Admin SSL","Admin SSL",
                 "manage_options",$config_page_ref,"as_conf");
     }
             if(!user_can("manage_options")) exit("You don't have permission to change these options!");
             check_admin_referer();

広告

About: dacelo


3 thoughts on “Admin SSL のWordPress 3.1 対応版を作りました”

    1. You have clicked “updated automatically” and get the latest version of original plugin “1.4.1”.
      It’s not a new version.
      You should not delete “1.4.1a” that is the error fixed version by me.

Leave a Reply to adminuser Cancel reply

Your email address will not be published. Required fields are marked *