og_massadd是否可以根据realname而不是 username进行查找?
// If not, try to check for usernames
if (!isset($account) && drupal_strlen($mail)) {
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'user')
->propertyCondition('name', check_plain($mail));
$result = $query->execute();
if (!empty($result)) {
$uids = array_keys($result['user']);
$account = user_load_multiple($uids);
$account = array_shift($account);
}
}
已经试过了
->propertyCondition('realname', check_plain($mail));
我可以看到它正在使用EntityFieldQuery和propertyCondition但我不明白实名是否与实体属性有关,或者是否有任何其他检查方法?
非常感谢任何建议/帮助。
更新
刚刚找到了一种使用 drush 来查看不包含实名的可用“用户”字段的方法:(
还有其他方法可以对实名进行交叉检查吗?
更新2
发现不支持EFQ 内部联接,但阅读了有关使用子查询的解决方法,但无法使其工作并且现在卡住了,有什么想法吗?
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'user')
$rnames_subquery = db_select('realname', 'rn');
$rnames_subquery->fields('rn', array('uid'));
$query->propertyCondition('uid', $rnames_subquery, 'IN');
$result = $query->execute();