diff options
| -rw-r--r-- | feed_lib.php | 15 | ||||
| -rw-r--r-- | modules/mod_feed.php | 6 | ||||
| -rw-r--r-- | templates/center_feed.php | 6 |
3 files changed, 24 insertions, 3 deletions
diff --git a/feed_lib.php b/feed_lib.php index a73bc4f..18a82f5 100644 --- a/feed_lib.php +++ b/feed_lib.php @@ -3,15 +3,24 @@ function feed_get_actions( $pListHash ) { global $gBitDb; + $whereSql = ''; + $bindVars = array(); + + BitBase::prepGetList( $pListHash ); + if( !empty( $pListHash['user_id'] ) ) { + $whereSql = " WHERE lal.user_id = ? "; + $bindVars[] = $pListHash['user_id']; + } + $query = "SELECT lal.content_id, lal.user_id, MAX(lal.last_modified) AS last_modified, uu.login, uu.real_name, uu.email FROM liberty_action_log lal INNER JOIN liberty_content lc ON (lc.content_id=lal.content_id) INNER JOIN users_users uu ON (uu.user_id=lal.user_id) - WHERE lal.user_id = ? + $whereSql GROUP BY lal.content_id, lal.user_id, uu.login, uu.real_name, uu.email ORDER BY MAX(lal.last_modified) DESC"; - $res = $gBitDb->query( $query, array( $pListHash['user_id'] ), 10 ); + $res = $gBitDb->query( $query, $bindVars, $pListHash['max_records'] ); $conjugationQuery = "SELECT * FROM feed_conjugation"; $overrides = $gBitDb->getAssoc( $conjugationQuery ); @@ -20,7 +29,7 @@ function feed_get_actions( $pListHash ) { while ( $action = $res->fetchRow() ){ if( $content = LibertyContent::getLibertyObject($action['content_id']) ) { $contentType = $content->getContentType(); - $action['real_log'] = BitUser::getDisplayName( empty( $pParams['nolink'] ), $action ).' '; + $action['real_log'] = BitUser::getDisplayName( empty( $pListHash['no_link_user'] ), $action ).' '; if(!empty($overrides[strtolower($contentType)])){ $action['real_log'] .= $overrides[$contentType]['conjugation_phrase']; if($overrides[$contentType]['is_target_linked'] == 'y'){ diff --git a/modules/mod_feed.php b/modules/mod_feed.php index 647a172..96d9d27 100644 --- a/modules/mod_feed.php +++ b/modules/mod_feed.php @@ -6,6 +6,12 @@ require_once( FEED_PKG_PATH.'feed_lib.php' ); if( !empty($gQueryUser) ){ + if( !empty( $moduleParams['module_params']['no_link_user'] ) ) { + $listHash['no_link_user'] = TRUE; + } + if( !empty( $moduleParams['module_rows'] ) ) { + $listHash['max_records'] = $moduleParams['module_rows']; + } $listHash['user_id'] = $gQueryUser->mUserId; $actions = feed_get_actions( $listHash ); diff --git a/templates/center_feed.php b/templates/center_feed.php index ea77fa9..d185c4f 100644 --- a/templates/center_feed.php +++ b/templates/center_feed.php @@ -5,6 +5,12 @@ global $gBitDb,$gQueryUser,$gBitSmarty; require_once( FEED_PKG_PATH.'feed_lib.php' ); if( !empty($gQueryUser) ){ + if( !empty( $moduleParams['module_params']['no_link_user'] ) ) { + $listHash['no_link_user'] = TRUE; + } + if( !empty( $moduleParams['module_rows'] ) ) { + $listHash['max_records'] = $moduleParams['module_rows']; + } $listHash['user_id'] = $gQueryUser->mUserId; $actions = feed_get_actions( $listHash ); |
