Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Drupal 7 更改Privatemsg未读邮件_Drupal 7 - Fatal编程技术网

Drupal 7 更改Privatemsg未读邮件

Drupal 7 更改Privatemsg未读邮件,drupal-7,Drupal 7,我运行一个完整的服务站点,为多个客户端管理不同的用户帐户。我已经修改了privatemsg,以便管理员用户能够访问任何消息。我有一个关于如何为每个用户显示未读消息的问题。我现在的代码只显示登录用户的未读消息。代码如下: $count=privatemg_unread_count(); 若有($count){ 打印l('('(int)privatemsg_unread_count().“new”),“消息”,数组('title'=>“查看收件箱”); } 如果不将任何参数传递给,它将返回当前登录用

我运行一个完整的服务站点,为多个客户端管理不同的用户帐户。我已经修改了privatemsg,以便管理员用户能够访问任何消息。我有一个关于如何为每个用户显示未读消息的问题。我现在的代码只显示登录用户的未读消息。代码如下:

$count=privatemg_unread_count();
若有($count){
打印l('('(int)privatemsg_unread_count().“new”),“消息”,数组('title'=>“查看收件箱”);
}

如果不将任何参数传递给,它将返回当前登录用户的未读消息数。该函数接受一个参数,即用户对象

如果您有一个用户ID列表,则可以使用以下代码获取每个用户的未读邮件数

foreach($uid作为$uid){
$account=用户加载($uid);
$count=privatemg\u未读\u计数($account);
// ...
}
如果您没有用户ID列表,并且对获取每个用户的未读消息数量感兴趣,那么可以使用以下代码

$query=newentityfieldquery();
$query->entityCondition('entity\u type','user')
->entityCondition('entity_id',0',>')
->属性条件(“状态”,1)
->addTag(“危险访问检查选择退出”);
$result=$query->execute();
if(isset($result['user'])){
$accounts=user_load_multiple(数组_键($result['user']);
foreach($accounts作为$account){
$count=privatemg\u未读\u计数($account);
// ...
}
}