我正在 PHP 中开发一个自定义插件,因此现有插件不可用。我想要实现的是我想在帖子中为某些用户显示不同的网址。对于在 WordPress 中注册的用户,请联系我并获得“批准”。我想设置这个额外的用户配置文件字段,以便我可以在条件中使用该字段。因此,没有此字段或此字段中没有正确值的客人和用户将获得 url1,但其他人将获得 url2。
要求
- 只有具有管理员角色的用户
- 创建/编辑额外的用户配置文件字段
- 才能为所有其他用户
我知道如何在 WordPress 中添加额外的用户配置文件字段(请参阅下面的链接),但我不知道如何限制编辑该字段给定角色中的用户以及具有管理员角色的用户如何为所有用户创建/编辑此字段。在我看来,我必须在 WordPress 仪表板/用户/新用户和/或仪表板/用户/作者和/或仪表板/用户/作者下添加新代码。用户。
我做了一些谷歌搜索,发现很少有关于如何添加额外用户配置文件字段的网站
在我看来,添加和使用自定义用户配置文件字段几乎是我想做的,但我仍然不知道如何管理“只有管理员”可以做到这一点。
I'm developing a custom plugin in PHP so existing plugins are not usable. What I want to achieve is that I want to display different url within a post for some users . For users that are registered in wordpress, contacted me and are 'approved'. I want to set up this extra user profile field so I can use this field in a condition. So guests and users without this field or without the right value in this field will get url1 but the other ones url2.
requirements
- only users with admin role
- can create/edit extra user profile field
- for all other users
I know how I can add extra user profile field in Wordpress (see the links below), but I don't know how to restrict editing that field to users in a given role and how user with admin role can create/edit this filed for all users. It seems to me that I have to add new code under wordpress dashboard/users/new user and/or dashboard/users/authors & users.
I did some google search and found few sites on how to add extra user profile field
It seems to me that Adding and using custom user profile fields is almost what I want to do but I still do not know how to manage the "only admin' can do that.
发布评论
评论(1)
怎么样:
请参阅此链接,了解 wordpress 的用户功能
上面的内容以及该链接你给了,也许是这样的:
How about this:
see this link about user capabilities for wordpress
So with the above, and that link you gave, maybe something like this: