12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- defined('GNUSOCIAL') || die();
- class FeaturedUsersSection extends ProfileSection
- {
- public function show()
- {
- $featured_nicks = common_config('nickname', 'featured');
- if (empty($featured_nicks)) {
- return;
- }
- parent::show();
- }
- public function getProfiles()
- {
- $featured_nicks = common_config('nickname', 'featured');
- if (!$featured_nicks) {
- return null;
- }
- $quoted = array();
- foreach ($featured_nicks as $nick) {
- $quoted[] = "'$nick'";
- }
- $table = common_database_tablename('user');
- $limit = PROFILES_PER_SECTION + 1;
- $qry = 'SELECT profile.* ' .
- 'FROM profile INNER JOIN ' . $table . ' ON profile.id = ' . $table . '.id ' .
- 'WHERE ' . $table . '.nickname IN (' . implode(',', $quoted) . ') ' .
- 'ORDER BY profile.created DESC LIMIT ' . $limit;
- $profile = Memcached_DataObject::cachedQuery('Profile', $qry, 6 * 3600);
- return $profile;
- }
- public function title()
- {
-
- return _('Featured users');
- }
- public function divId()
- {
- return 'featured_users';
- }
- public function moreUrl()
- {
- return common_local_url('featured');
- }
- }
|