內容簡介
WordPress Multisite 網站的外掛,可允許網站管理員在編輯使用者設定檔時設定使用者的主要網誌(即主要網站)。
因為某些原因(通常是使用者節外生枝 - 我在一所學校用 WP Multisite,學生的年級從四年級到十二年級),使用者會沒有連結(或取消連結)到正確的「主要網誌」。
這不是破壞者,但當他們登入並被重新導向到不是他們預期的主要網誌時,這是很煩人的。當我使用其他外掛來列出使用者主要網誌以顯示在會員目錄、會員設定檔等時,它也很煩人。
告訴使用者在他們自己的儀表板 -> 我的網誌中重設他們的主要網誌是解決方法,但是在這個外掛之前,超級管理員(我是老師)可以先解決混淆。在編輯其設定檔案時,沒有其他方法可以讓網站管理員設定使用者的「主要網誌」。
現在,我可以快速瀏覽使用者的網站管理員列表,編輯其設定檔案並正確設定每個使用者的主要網誌。
我也可以使用我的選單外掛,切換「我的網站」選單項目,以便使用者完全無法節外生枝處理主要網站切換器。問題解決了。
註記
原始的主要網站切換器程式碼在 wp-admin-includes/ms.php 中。我基本上複製了它,但將 get_current_user_id() 改為 $edit_user = (int) $_GET['user_id'];,並將其添加到「edit_user_profile」鉤子。
此外掛可用於將使用者新增至「特殊網誌」,方法是取消程式碼中此部分的註解(刪除 /* 和 */),並變更 $special_blog_id:
<optgroup label="Other Blogs"></optgroup>
<optgroup label="Special Blog">
<?php $special_blog_id = '63'; //
$special_blog = get_blog_details( $special_blog_id ); ?>
<option value='<?php echo $special_blog_id ?>'>http://<?php echo $special_blog->domain.$special_blog->path ?></option>
</optgroup>
外掛標籤
開發者團隊
② 後台搜尋「Primary Blog Switcher for SuperAdmins」→ 直接安裝(推薦)
原文外掛簡介
WordPress Multisite network plugin to allow Network Admin to set the “Primary Blog” (aka Primary Site) of a user while editing a user’s profile.
Well, for whatever reasons (usually users fiddling around – I use WP multisite in a school with students grades 4-12), users aren’t attached(or become unattached) to the correct “Primary Blog”.
This isn’t a deal breaker, but annoying when they login and are redirected to a blog that is not their expected primary. It also is annoying when I use other plugins to list user primary blog for display in a member directory, member profiles, etc.
Telling users to reset their primary blog at their own Dashboard->My Blogs is a fix, but the SuperAdmin(Teacher in my case) can head off the confusion first with this plugin. There is no other way(AFAIK) for the Network Admin to set the “Primary Blog” of a user while editing their profile.
Now, I can quickly scan the Network Admin list of users and edit profiles and set primary blogs of any user correctly.
I can also use my Menus plugin to toggle the My Sites menu item so users can no longer fiddle with the Primary Site switcher at all. Problem solved.
Notes
The original code for the Primary Site switcher is in wp-admin-includes/ms.php. I’ve basically copied that, but changed get_current_user_id() to $edit_user = (int) $_GET['user_id']; and added it to the “edit_user_profile” hook.
The plugin can be used to add users to a “Special Blog” by uncomment(remove the /* and */) this section in the plugin code and change the $special_blog_id:
