[英]Elgg and the utilization of Relationship_created_time_lower
解決了我的最后一個問題后,我遇到了另一個問題,我的elgg插件的完成工作遇到了一些問題。 我顯然是在誤用或誤解了Elgg中Created時間下限和上限函數的使用
使用以下代碼:
$monthSpan = (30 * 24 * 60 * 60);
$startTime = time() - $monthSpan;
$MemberDifference = elgg_get_entities_from_relationship(array(
'relationship' => 'member', //get Members
'relationship_guid' => $group->guid, //get individual guid for use
'inverse_relationship' => true,
'type' => 'user', //users are returned
'limit' => 20,
'joins' => array("JOIN {$db_prefix}users_entity u ON e.guid=u.guid"),
'order_by' => 'u.name ASC',
'relationship_created_time_lower' => $startTime, //the furthest back it will reach
'relationship_created_time_upper' => time(), //possibly unneeded, but ensures the closest date is today
'count' => true,
));
使用此功能,我在獲取關聯組中所有成員的方式上構建了它,從理論上講,它現在應該可以抓住上個月內在該組中注冊的所有成員。 不幸的是,無論他們加入的時間如何,它都繼續抓住該組中的每個成員。
有人知道我哪里出問題了嗎?
原來,我的Elgg版本太低了,否則整個代碼塊都可以工作。 在使用Elgg 1.8時,我需要使用以下代碼:
$MemberDifference = elgg_get_entities_from_relationship_count(array(
'relationship' => 'member',
'relationship_guid' => $Reports->guid,
'inverse_relationship' => true,
'type' => 'user',
'limit' => 20,
'count' => true,
'joins' => array("JOIN {$db_prefix}users_entity u ON e.guid=u.guid"),
'order_by' => 'u.name ASC',
'wheres' => array('r.time_created >=' . $startTime)
));
這完美地工作,並且帶來了我正在尋找的東西。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.