我使用WordPress的付費主題。主題是關於汽車交易。在這個主題中有一個Role => Dealer
。如何在wordpress中添加上傳文件的功能
當我作爲經銷商登錄時,我可以編輯我的配置文件(但沒有圖像選項)。我的客戶需要經銷商公司徽標的上傳字段。我創建了一個media up loader
及其工作,但並不完美。當我點擊upload logo
按鈕,媒體最多裝載彈出,然後我選擇一個圖像,現在媒體最多裝載機開始處理和一些小型秒就說明我這個錯誤:
我搜索有關的角色代碼,我發現這個代碼在父主題:
add_role('tdp_dealer', 'Vehicle Dealer', array(
'read' => true, // True allows that capability
'edit_dealer_fields' => true
));
然後我搜索上傳能力,發現upload_files。我在代碼中寫了這個上限,但它不起作用。
add_role('tdp_dealer', 'Vehicle Dealer', array(
'read' => true, // True allows that capability
'edit_dealer_fields' => true,
'upload_files' => true,
'edit_posts' => true
));
然後我也試試這個代碼,但它也沒有工作:
function tdp_add_dealer_caps() {
// gets the author role
$role = get_role('tdp_dealer');
// This only works, because it accesses the class instance.
// would allow the author to edit others' posts for current theme only
//$role->add_cap('edit_dealer_fields', true);
$role->add_cap('upload_files', true);
}
add_action('init', 'tdp_add_dealer_caps');
所以,球員指導我,我怎麼可以上傳文件,圖像爲dealer user
。希望你能理解我的問題。
你問這個插件開發者,對吧?他們是最好的信息來源。 –