Standing on the Shoulder of Linus

Home / 2011 / 8月 / 04 / Preset Admin Email for MultiSite

Preset Admin Email for MultiSite

In a multisite, you can create child sites. When you create a new child site, you fill in the title and the slug. And, you have to fill in your e-mail address, even if you are the network administrator.

If you enter an e-mail by hand, you may mistype. But, you can avoid such a risk. This code, shown below, automatically fill your e-mail address into the corresponding box, with an aid of jquery.

add_action( 'admin_footer-site-new.php', 'add_admin_email', 10);
function add_admin_email() {
    $mail = get_the_author_meta( 'user_email', 1 );
    if ( is_email($mail)) : ?>
<script language="javascript">
//<![CDATA[
jQuery(document).ready(function($){
$("input[name=blog[email]]").val("<?php esc_attr_e($mail); ?>");
});
//]]>
</script>
<?php endif;
}

NOTE: should not be activated on a single wordpress install.

関連

Posted in myplugin | Tagged jquery, WordPress, 管理画面カスタマイズ
← EasyShare C123 の使い方一日目 名古屋駅から国際センターまでの道のり(徒歩) →

アーカイブ

人気の投稿とページ

  • キンドル本を印刷する(PDFに変換する)方法
  • 名古屋駅から国際センターまでの道のり(徒歩)
  • AGPL ライセンス(GPLとは似ているが違いもある)
  • 問い合わせフォーム改善: 選択肢により条件分岐し、項目の表示非表示を変更する
  • JP-Secure SiteGuard WP Pluginは不正ログイン防止に役立つか

プロフィール

水野史土:月70万PVホームページ制作会社のレスキューワーク株式会社で、PHPソフトウェアのサポートを行っている。concrete5コミュニティリーダー、Novius OSコアコード貢献者でもある。 詳しくは管理者詳細参照。
大好評WordPress書籍「WordPressユーザーのためのPHP入門 はじめから、ていねいに。」サポートページ

Copyright © 2015 Standing on the Shoulder of Linus.