小编kin*_*sch的帖子

Wordpress角色自定义功能设置为true但返回false

我尝试使用一些自定义功能创建用户角色.这到目前为止工作.但是如果我想用函数检查一个特定功能的用户权限,current_user_can()则返回false.但是在新创建的角色的capabilities数组中,特定功能设置为true.

所以给我的话多一点编码背景:

角色对象

WP_Role {
  ["name"]=> "organizer"
  ["capabilities"]=> {
       ["edit_posts"]              => bool(false)
       ["delete_posts"]            => bool(false)
       ["publish_posts"]           => bool(false)
       ["upload_files"]            => bool(true)
       ["edit_event"]              => bool(true)
       ["read_event"]              => bool(true)
       ["delete_event"]            => bool(true)
       ["edit_events"]             => bool(true)
       ["edit_others_events"]      => bool(false)
       ["publish_events"]          => bool(false)
       ["read_private_events"]     => bool(true)
       ["read"]                    => bool(true)
       ["delete_events"]           => bool(true)
       ["delete_private_events"]   => bool(false)
       ["delete_published_events"] => bool(true)
       ["delete_others_events"]    => bool(false)
       ["edit_private_events"]     => bool(false)
       ["edit_published_events"]   => bool(true)
       ["manage_event_terms"]      => bool(true)
       ["edit_event_terms"]        => bool(true)
       ["delete_event_terms"]      => bool(true)
       ["assign_event_terms"]      => bool(true)
  }
Run Code Online (Sandbox Code Playgroud)


我的角色扮演功能

add_role( …
Run Code Online (Sandbox Code Playgroud)

wordpress user-roles

14
推荐指数
1
解决办法
1184
查看次数

触发iOS/android上的触摸标注

我想知道是否有可能使用Javascript在iOS和Android上触发"保存图像"触摸标注.标注是由长按触发的,但即使我尝试模拟它,它也不起作用.

我想实现这样的事情:

jQuery('img').openCallout();
Run Code Online (Sandbox Code Playgroud)

到目前为止我试过这个:

jQuery: jQuery('img').contextmenu();
jQuery Mobile: jQuery('img').taphold();

在此输入图像描述

javascript android ios web callout

7
推荐指数
1
解决办法
459
查看次数

动态导入的vue组件无法解析

当我尝试使用import()函数导入动态组件时,我收到以下错误:

[Vue warn]: Failed to resolve async component: function () {
    return __webpack_require__("./src/components/types lazy recursive ^\\.\\/field\\-.*$")("./field-" + _this.type);
}
Reason: Error: Loading chunk 0 failed.
Run Code Online (Sandbox Code Playgroud)

不幸的是我不知道是什么导致了这个错误.由于发行说明,我已经尝试在vue-loader配置中将esModule设置为false .

我使用vue-cli 2.9.2和webpack模板来设置这个项目,这是实际组件的代码:

<template>
    <div>
        <component :is="fieldType">
            <children/>
        </component>
    </div>
</template>

<script>
export default {
    name: 'DynamicComponent',
    props: {
        type: String,
    },
    computed: {
        fieldType () {
            return () => import(`./types/type-${this.type}`)
        }
    }
}
</script>
Run Code Online (Sandbox Code Playgroud)


[已解决]
上面的代码有效.问题是基于Loading chunk 0 failed边缘情况.使用webpack设置,output: {publicPath: '/'}它提供相对于根而不是其原点的块.当我在我的外部服务器中嵌入http:// localhost:8080/app.js并从那里调用导入函数时,链接的块URL是http://myserver.com/0.js而不是http:// …

javascript vue.js vue-component

6
推荐指数
1
解决办法
4377
查看次数

Nuxt.js 中的无限动态级别嵌套

我希望 nuxt.js 的路由完全动态,因为我无法预测用户及其对他想要的级别数量的偏好。

因此,一个用户将创建一个如下所示的页面:
http://localhost/parent/level-1/level-2/

其他一些人会这样做:
http://localhost/parent/level-1/level-2/level-3/level-4/level-5/level-6/level-7/

nuxt.js 有没有办法处理这种无限嵌套路由?

routes vue.js nuxt.js

2
推荐指数
1
解决办法
2497
查看次数

通过网络搜索获取 Instagram 公开个人资料数据

我尝试在不使用 API 的情况下从 Instagram 检索一些公开的个人资料数据。我已经使用file_get_contents并提取了_sharedData. 但是这种方法会极大地降低性能(加载 5 秒),因此对于生产来说是无意义的。

我在一个stackoverflow 问题中看到,他们调用http://instagram.com/web/search/topsearch/?query=user_id来访问至少关注者的数量。但没有进一步的细节。

是否有关于此网络搜索的任何文档或使用 Instagram 网络搜索访问公共资料数据的一些解决方案?我至少需要媒体、追随者和追随者的计数。

php web-search instagram

0
推荐指数
1
解决办法
3267
查看次数