当前位置: 首页>>代码示例>>PHP>>正文


PHP EM_Object::can_manage方法代码示例

本文整理汇总了PHP中EM_Object::can_manage方法的典型用法代码示例。如果您正苦于以下问题:PHP EM_Object::can_manage方法的具体用法?PHP EM_Object::can_manage怎么用?PHP EM_Object::can_manage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EM_Object的用法示例。


在下文中一共展示了EM_Object::can_manage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bp_em_group_event_can_manage

/**
 * Overrides the default capability of the user for another owner's event if the user is a group admin and the event belongs to a group. 
 * User must have the relevant permissions globally in order to inherit that capability for this event as well.
 * @param boolean $result
 * @param EM_Event $EM_Event
 */
function bp_em_group_event_can_manage($result, $EM_Event, $owner_capability, $admin_capability, $user_to_check)
{
    if (!$result && $EM_Event->event_owner != get_current_user_id() && !empty($EM_Event->group_id) && bp_is_active('groups')) {
        //only override if already false, incase it's true
        //if the user is an admin of this group, and actually has the relevant permissions globally, they can manage this event
        $EM_Object = new EM_Object();
        //create new object to prevent infinite loop should we call $EM_Event->can_manage();
        if (groups_is_user_admin(get_current_user_id(), $EM_Event->group_id) && $EM_Object->can_manage($owner_capability, $admin_capability, $user_to_check)) {
            //This user is an admin of the owner's group, so they can edit this event.
            return true;
        } else {
            $EM_Event->add_error($EM_Object->get_errors());
            //add any applicable errors
        }
    }
    return $result;
}
开发者ID:KhanMaytok,项目名称:events-manager,代码行数:23,代码来源:bp-em-groups.php

示例2:

 /**
  * Can the user manage this? 
  */
 function can_manage($owner_capability = false, $admin_capability = false, $user_to_check = false)
 {
     if ($this->event_id == '' && !is_user_logged_in() && get_option('dbem_events_anonymous_submissions')) {
         $user_to_check = get_option('dbem_events_anonymous_user');
     }
     return apply_filters('em_event_can_manage', parent::can_manage($owner_capability, $admin_capability, $user_to_check), $this, $owner_capability, $admin_capability, $user_to_check);
 }
开发者ID:javipaur,项目名称:TiendaVirtual,代码行数:10,代码来源:em-event.php

示例3:

 /**
  * Can the user manage this coupon? 
  */
 function can_manage($owner_capability = false, $admin_capability = false, $user_to_check = false)
 {
     return apply_filters('em_coupon_can_manage', parent::can_manage($owner_capability, $admin_capability, $user_to_check), $this, $owner_capability, $admin_capability, $user_to_check);
 }
开发者ID:shieldsdesignstudio,项目名称:trilogic,代码行数:7,代码来源:coupon.php

示例4:

 /**
  * Can the user manage this location? 
  */
 function can_manage($owner_capability = false, $admin_capability = false)
 {
     if ($owner_capability == 'edit_locations' && $this->id == '' && !is_user_logged_in() && get_option('dbem_events_anonymous_submissions')) {
         return apply_filters('em_event_can_manage', true);
     }
     return apply_filters('em_location_can_manage', parent::can_manage($owner_capability, $admin_capability), $this);
 }
开发者ID:hypenotic,项目名称:slowfood,代码行数:10,代码来源:em-location.php

示例5:

 /**
  * Can the user manage this location? 
  */
 function can_manage($owner_capability = false, $admin_capability = false, $user_to_check = false)
 {
     if ($this->location_id == '' && !is_user_logged_in() && get_option('dbem_events_anonymous_submissions')) {
         $user_to_check = get_option('dbem_events_anonymous_user');
     }
     if ($admin_capability && EM_MS_GLOBAL && get_site_option('dbem_ms_mainblog_locations')) {
         //if in global mode with locations restricted to main blog, we check capabilities against the main blog
         self::ms_global_switch();
         $return = parent::can_manage($owner_capability, $admin_capability, $user_to_check);
         self::ms_global_switch_back();
     } else {
         $return = parent::can_manage($owner_capability, $admin_capability, $user_to_check);
     }
     return apply_filters('em_location_can_manage', $return, $this, $owner_capability, $admin_capability, $user_to_check);
 }
开发者ID:javipaur,项目名称:TiendaVirtual,代码行数:18,代码来源:em-location.php

示例6:

 /**
  * Can the user manage this? 
  */
 function can_manage($owner_capability = false, $admin_capability = false)
 {
     return apply_filters('em_event_can_manage', parent::can_manage($owner_capability, $admin_capability), $this);
 }
开发者ID:hypenotic,项目名称:slowfood,代码行数:7,代码来源:em-event.php


注:本文中的EM_Object::can_manage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。