2017-01-02 59 views
1

我使用WordPress的付费主题。主题是关于汽车交易。在这个主题中有一个Role => Dealer如何在wordpress中添加上传文件的功能

当我作为经销商登录时,我可以编辑我的配置文件(但没有图像选项)。我的客户需要经销商公司徽标的上传字段。我创建了一个media up loader及其工作,但并不完美。当我点击upload logo按钮,媒体最多装载弹出,然后我选择一个图像,现在媒体最多装载机开始处理和一些小型秒就说明我这个错误:

enter image description here

我搜索有关的角色代码,我发现这个代码在父主题:

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。希望你能理解我的问题。

+0

你问这个插件开发者,对吧?他们是最好的信息来源。 –

回答

1

尝试Word新闻插件,您可以在其中分配权限FR上传到自定义用户角色:

Members

+0

我已经使用这个,但它不工作 – deemi

+0

thanx ...我完全读了它......现在它的工作 – deemi

相关问题