php 授予编辑者角色对Gravity Forms的完全访问权限

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 授予编辑者角色对Gravity Forms的完全访问权限相关的知识,希望对你有一定的参考价值。

/* These functions are set to run on init and can be removed after they've run once. There is no need to keep them in the functions file */
/* Credit goes to https://ryanbenhase.com/giving-editors-access-to-gravity-forms/ */
//////////////////
// GRANT ACCESS //
//////////////////
function grant_gforms_editor_access() {
  $role = get_role( 'editor' );
  $role->add_cap( 'gform_full_access' );
}
add_action( 'init', 'grant_gforms_editor_access' );

///////////////////
// REVOKE ACCESS //
///////////////////
function revoke_gforms_editor_access() {
  $role = get_role( 'editor' );
  $role->remove_cap( 'gform_full_access' );
}
add_action( 'init', 'revoke_gforms_editor_access' );

以上是关于php 授予编辑者角色对Gravity Forms的完全访问权限的主要内容,如果未能解决你的问题,请参考以下文章