Random User IDs

外掛說明

這個外掛會將在 WordPress 安裝設定時建立的使用者的 user_id 隨機化,進而移除網站的潛在攻擊因素之一。

外掛運作方式

Once activated, the plugin will immediately replace the ID for the default admin user (with user ID 1). By default, the plugin will use random user IDs between 1 and 4503599627370495 (to ensure compatibility with Javascript code using the user ID).

All newly created users from that moment will be generated with a random user ID in the defined range.

How to customize the range for new user IDs

You can customize the range used by the plugin for the random generated user IDs by using the WordPress filters dfx_random_user_id_max_id and dfx_random_user_id_min_id.

For example, if you want to have all your user IDs between 1000 and 9999 you can add the following lines to your theme’s functions.php file:

function set_dfx_max_user_id( $default_max_id ) {
    return 9999;
}
add_filter( 'dfx_random_user_id_max_id', 'set_dfx_max_user_id' );

function set_dfx_min_user_id( $default_max_id ) {
    return 1000;
}
add_filter( 'dfx_random_user_id_min_id', 'set_dfx_min_user_id' );

Probably, you’ll want to add these lines to your code before activating the plugin, so your new random main admin user ID is inside your desired range.

使用者評論

2024 年 1 月 1 日
Very useful plugin, but would be much better if setting the desired ID number range was integrated into plugin as a setting rather than relying on a code snippet.
2022 年 7 月 29 日
I love this plugin. It easily solved a couple problems I was grappling with. It seems like such a simple concept that I’m pretty surprised more developers haven’t come up with something similar. Would very much appreciate seeing confirmation that this plugin is up to date for the latest Wordpress versions.
2019 年 1 月 25 日 1 則留言
Well built and does its job. Easy to customize for shorter ID’s (16 digits was too much for my use, lol). Really a great addition to the WP repo, top-notch, my thanks to the dev! Saved me a nice chunk of time finishing this project 🙂
閱讀全部 5 則使用者評論

參與者及開發者

以下人員參與了開源軟體〈Random User IDs〉的開發相關工作。

參與者

〈Random User IDs〉外掛目前已有 5 個本地化語言版本。 感謝全部譯者為這個外掛做出的貢獻。

將〈Random User IDs〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

20201115

  • Adding new filter dfx_random_user_id_min_id to customize the minimum allowed user ID number

20190125

  • Adding new filter dfx_random_user_id_max_id to customize the maximum allowed user ID number

20170720

  • Updating documentation to reflect changes incoming with WordPress version 4.9.

20170526

  • Now the maximum generated ID is Javascript’s MAX_SAFE_INTEGER / 2, so we shouldn’t generate problems with the Javascript layer.