本文整理汇总了PHP中um_current_user_can函数的典型用法代码示例。如果您正苦于以下问题:PHP um_current_user_can函数的具体用法?PHP um_current_user_can怎么用?PHP um_current_user_can使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了um_current_user_can函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: um_admin_user_actions_hook
function um_admin_user_actions_hook($actions)
{
$actions = null;
if (!um_user('super_admin')) {
if (um_user('account_status') == 'awaiting_admin_review') {
$actions['um_approve_membership'] = array('label' => __('Approve Membership', 'ultimatemember'));
$actions['um_reject_membership'] = array('label' => __('Reject Membership', 'ultimatemember'));
}
if (um_user('account_status') == 'rejected') {
$actions['um_approve_membership'] = array('label' => __('Approve Membership', 'ultimatemember'));
}
if (um_user('account_status') == 'approved') {
$actions['um_put_as_pending'] = array('label' => __('Put as Pending Review', 'ultimatemember'));
}
if (um_user('account_status') == 'awaiting_email_confirmation') {
$actions['um_resend_activation'] = array('label' => __('Resend Activation E-mail', 'ultimatemember'));
}
if (um_user('account_status') != 'inactive') {
$actions['um_deactivate'] = array('label' => __('Deactivate this account', 'ultimatemember'));
}
if (um_user('account_status') == 'inactive') {
$actions['um_reenable'] = array('label' => __('Reactivate this account', 'ultimatemember'));
}
if (um_current_user_can('delete', um_profile_id())) {
$actions['um_delete'] = array('label' => __('Delete this user', 'ultimatemember'));
}
}
if (current_user_can('delete_users')) {
$actions['um_switch_user'] = array('label' => __('Login as this user', 'ultimatemember'));
}
um_fetch_user(um_profile_id());
return $actions;
}
开发者ID:emaxees,项目名称:elpandecadadia,代码行数:33,代码来源:um-filters-user.php
示例2: um_can_view_profile
function um_can_view_profile($user_id)
{
global $ultimatemember;
if (!um_user('can_view_all') && $user_id != get_current_user_id() && is_user_logged_in()) {
return false;
}
if (um_current_user_can('edit', $user_id)) {
return true;
}
if (!is_user_logged_in()) {
if ($ultimatemember->user->is_private_profile($user_id)) {
return false;
} else {
return true;
}
}
if (!um_user('can_access_private_profile') && $ultimatemember->user->is_private_profile($user_id)) {
return false;
}
if (um_user_can('can_view_roles') && $user_id != get_current_user_id()) {
if (!in_array($ultimatemember->query->get_role_by_userid($user_id), um_user_can('can_view_roles'))) {
return false;
}
}
return true;
}
开发者ID:lytranuit,项目名称:wordpress,代码行数:26,代码来源:um-short-functions.php
示例3: um_pre_profile_shortcode
function um_pre_profile_shortcode($args)
{
global $ultimatemember;
extract($args);
if ($mode == 'profile' && $ultimatemember->fields->editing == false) {
$ultimatemember->fields->viewing = 1;
if (um_get_requested_user()) {
if (!um_can_view_profile(um_get_requested_user())) {
um_redirect_home();
}
if (!um_current_user_can('edit', um_get_requested_user())) {
$ultimatemember->user->cannot_edit = 1;
}
um_fetch_user(um_get_requested_user());
} else {
if (!is_user_logged_in()) {
um_redirect_home();
}
if (!um_user('can_edit_profile')) {
$ultimatemember->user->cannot_edit = 1;
}
}
}
if ($mode == 'profile' && $ultimatemember->fields->editing == true) {
$ultimatemember->fields->editing = 1;
if (um_get_requested_user()) {
if (!um_current_user_can('edit', um_get_requested_user())) {
um_redirect_home();
}
um_fetch_user(um_get_requested_user());
}
}
}
开发者ID:TeamSubjectMatter,项目名称:juddfoundation,代码行数:33,代码来源:um-actions-profile.php
示例4: ultimatemember_muted_action
function ultimatemember_muted_action()
{
global $ultimatemember;
extract($_REQUEST);
if (!um_current_user_can('edit', $user_id)) {
die(__('You can not edit this user'));
}
switch ($hook) {
default:
do_action("um_run_ajax_function__{$hook}", $_REQUEST);
break;
}
}
开发者ID:Zurtr,项目名称:ultimatemember,代码行数:13,代码来源:um-actions-ajax.php
示例5: um_action_request_process
function um_action_request_process()
{
global $ultimatemember;
if (is_admin()) {
return false;
}
if (!is_user_logged_in()) {
return false;
}
if (!isset($_REQUEST['um_action'])) {
return false;
}
if (isset($_REQUEST['uid']) && !$ultimatemember->user->user_exists_by_id($_REQUEST['uid'])) {
return false;
}
if (isset($_REQUEST['uid'])) {
if (is_super_admin($_REQUEST['uid'])) {
wp_die('Super administrators can not be modified.');
}
}
if (isset($_REQUEST['um_action']) && $_REQUEST['um_action'] != "edit" && !current_user_can('edit_users')) {
wp_die(__('You do not have enough permissions to do that.', 'ultimatemember'));
}
if (isset($_REQUEST['uid'])) {
$uid = $_REQUEST['uid'];
}
switch ($_REQUEST['um_action']) {
default:
$uid = isset($_REQUEST['uid']) ? $_REQUEST['uid'] : 0;
do_action('um_action_user_request_hook', $_REQUEST['um_action'], $uid);
break;
case 'edit':
$ultimatemember->fields->editing = true;
if (!um_can_edit_my_profile()) {
$url = um_edit_my_profile_cancel_uri();
exit(wp_redirect($url));
}
break;
case 'um_switch_user':
if (!current_user_can('delete_users')) {
return;
}
$ultimatemember->user->auto_login($_REQUEST['uid']);
exit(wp_redirect($ultimatemember->permalinks->get_current_url(true)));
break;
case 'um_reject_membership':
um_fetch_user($uid);
$ultimatemember->user->reject();
exit(wp_redirect($ultimatemember->permalinks->get_current_url(true)));
break;
case 'um_approve_membership':
case 'um_reenable':
um_fetch_user($uid);
$ultimatemember->user->approve();
exit(wp_redirect($ultimatemember->permalinks->get_current_url(true)));
break;
case 'um_put_as_pending':
um_fetch_user($uid);
$ultimatemember->user->pending();
exit(wp_redirect($ultimatemember->permalinks->get_current_url(true)));
break;
case 'um_resend_activation':
um_fetch_user($uid);
$ultimatemember->user->email_pending();
exit(wp_redirect($ultimatemember->permalinks->get_current_url(true)));
break;
case 'um_deactivate':
um_fetch_user($uid);
$ultimatemember->user->deactivate();
exit(wp_redirect($ultimatemember->permalinks->get_current_url(true)));
break;
case 'um_delete':
if (!um_current_user_can('delete', $uid)) {
wp_die(__('You do not have permission to delete this user.', 'ultimatemember'));
}
um_fetch_user($uid);
$ultimatemember->user->delete();
exit(wp_redirect($ultimatemember->permalinks->get_current_url(true)));
break;
}
}
开发者ID:alexpull,项目名称:ultimatemember,代码行数:81,代码来源:um-actions-core.php
注:本文中的um_current_user_can函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论