You are here

function _heartbeat_activity_get_access in Heartbeat 7

Returns the permission to log a Message based on the access of the Template or the User setting.

2 calls to _heartbeat_activity_get_access()
heartbeat_api_log in ./heartbeat.module
API function to log a message from custom code
rules_action_heartbeat_activity_log in modules/heartbeat_rules/heartbeat_rules.module
Rules action to log activity.

File

./heartbeat.module, line 1696
Module file for heartbeat activity. Basic hook implementations and helper functions will be found here.

Code

function _heartbeat_activity_get_access($uid, $template) {
  $templates = heartbeat_user_templates_load($uid);

  // If the user has configured access to this type, use it.
  if (isset($templates[$template->message_id])) {
    $access = $templates[$template->message_id]->status;
  }
  else {

    // If the user configured general access.
    if (isset($templates['0'])) {
      $access = $templates['0']->status;
    }
    else {
      $access = $template->perms;
    }
  }
  return $access;
}