You are here

public function HeartbeatAccess::__construct in Heartbeat 6.3

Same name and namespace in other branches
  1. 6.4 includes/heartbeataccess.inc \HeartbeatAccess::__construct()

File

includes/heartbeataccess.inc, line 24

Class

HeartbeatAccess
Abstract class heartbeataccess This base class has final template methods which are used by the derived concretes. The HeartbeatAccess is a state object that is given to the HeartbeatMessageBuilder to set the access to the current request.

Code

public function __construct() {
  global $user;

  // Assign the who-is-user type
  $this->_whoisuser_type = variable_get('heartbeat_show_user_profile_messages_' . strtolower(get_class($this)), self::TYPE_ACTOR);
  if ($this->_whoisuser_type == self::TYPE_USER_PROFILE) {
    if (arg(0) == 'user' && is_numeric(arg(1)) && arg(1) > 0 && arg(2) != 'edit') {
      $this->_uid = arg(1);
    }
    else {
      $this
        ->setError(t('Error found in heartbeat activity block for user in url. No user id found in url. Make sure this type of block is only active on the user page.'));
    }
  }
  else {
    $this->_uid = $user->uid;
  }

  // Populate the user object with a users relations
  $user->heartbeat_relations = heartbeat_get_related_uids($this->_uid);
}