simplify interactions with the get_features hook by calling it before any filtering takes place
This commit is contained in:
parent
eb86ffefbf
commit
0fba1bb868
@ -71,6 +71,8 @@ class Forums {
|
|||||||
if($r)
|
if($r)
|
||||||
$r1[$x]['unseen'] = $r[0]['unseen'];
|
$r1[$x]['unseen'] = $r[0]['unseen'];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @FIXME
|
* @FIXME
|
||||||
* This SQL makes the counts correct when you get forum posts arriving from different routes/sources
|
* This SQL makes the counts correct when you get forum posts arriving from different routes/sources
|
||||||
@ -79,21 +81,19 @@ class Forums {
|
|||||||
* It may make more sense in that query to look for the mention in the body rather than another join,
|
* It may make more sense in that query to look for the mention in the body rather than another join,
|
||||||
* but that makes it very inefficient.
|
* but that makes it very inefficient.
|
||||||
*
|
*
|
||||||
$r = q("select sum(item_unseen) as unseen from item left join term on oid = id where otype = %d and owner_xchan != '%s' and item.uid = %d and url = '%s' and ttype = %d $perms_sql ",
|
* $r = q("select sum(item_unseen) as unseen from item left join term on oid = id where otype = %d and owner_xchan != '%s' and item.uid = %d and url = '%s' and ttype = %d $perms_sql ",
|
||||||
intval(TERM_OBJ_POST),
|
* intval(TERM_OBJ_POST),
|
||||||
dbesc($r1[$x]['xchan_hash']),
|
* dbesc($r1[$x]['xchan_hash']),
|
||||||
intval(local_channel()),
|
* intval(local_channel()),
|
||||||
dbesc($r1[$x]['xchan_url']),
|
* dbesc($r1[$x]['xchan_url']),
|
||||||
intval(TERM_MENTION)
|
* intval(TERM_MENTION)
|
||||||
);
|
* );
|
||||||
if($r)
|
* if($r)
|
||||||
$r1[$x]['unseen'] = ((array_key_exists('unseen',$r1[$x])) ? $r1[$x]['unseen'] + $r[0]['unseen'] : $r[0]['unseen']);
|
* $r1[$x]['unseen'] = ((array_key_exists('unseen',$r1[$x])) ? $r1[$x]['unseen'] + $r[0]['unseen'] : $r[0]['unseen']);
|
||||||
*
|
*
|
||||||
* end @FIXME
|
* end @FIXME
|
||||||
*/
|
*/
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if($r1) {
|
if($r1) {
|
||||||
$o .= '<div class="widget">';
|
$o .= '<div class="widget">';
|
||||||
$o .= '<h3>' . t('Forums') . '</h3><ul class="nav nav-pills flex-column">';
|
$o .= '<h3>' . t('Forums') . '</h3><ul class="nav nav-pills flex-column">';
|
||||||
|
@ -190,6 +190,16 @@ function get_features($filtered = true) {
|
|||||||
feature_level('event_tz_select',2),
|
feature_level('event_tz_select',2),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
|
[
|
||||||
|
'premium_channel',
|
||||||
|
t('Premium Channel'),
|
||||||
|
t('Allows you to set restrictions and terms on those that connect with your channel'),
|
||||||
|
false,
|
||||||
|
get_config('feature_lock','premium_channel'),
|
||||||
|
feature_level('premium_channel',4),
|
||||||
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
'advanced_dirsearch',
|
'advanced_dirsearch',
|
||||||
t('Advanced Directory Search'),
|
t('Advanced Directory Search'),
|
||||||
@ -438,16 +448,10 @@ function get_features($filtered = true) {
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$x = [ 'features' => $arr, ];
|
||||||
|
call_hooks('get_features',$x);
|
||||||
|
|
||||||
$arr['general'][] = [
|
$arr = $x['features'];
|
||||||
'premium_channel',
|
|
||||||
t('Premium Channel'),
|
|
||||||
t('Allows you to set restrictions and terms on those that connect with your channel'),
|
|
||||||
false,
|
|
||||||
get_config('feature_lock','premium_channel'),
|
|
||||||
feature_level('premium_channel',4),
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
$techlevel = get_account_techlevel();
|
$techlevel = get_account_techlevel();
|
||||||
|
|
||||||
@ -482,7 +486,5 @@ function get_features($filtered = true) {
|
|||||||
$narr = $arr;
|
$narr = $arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
$x = [ 'features' => $narr, 'filtered' => $filtered, 'techlevel' => $techlevel ];
|
return $narr;
|
||||||
call_hooks('get_features',$x);
|
|
||||||
return $x['features'];
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user