--------------------------------------------------------------------------
 User Favorites
 --------------------------------------------------------------------------
 Get user favorites
170099
def favorites
      return @favorites if @favorites
      resp = @client.request('getFavorites', ofWhat: 'Songs', userID: @id)
      @favorites = resp.map { |s| Song.new(s) }
    end
1033727
public function getChildren(User $user)
    {
        $returnArray = array();
        foreach ($this->userList as $u) {
            /** @var $u User */
            if ($u->getParent() == $user->getUsername()) {
                $returnArray[] = $u;
                $returnArray = array_merge($returnArray, $this->getChildren($u));
            }
        }
        return $returnArray;
    }
468116
public function setup_users() {
        global $SESSION, $DB;

        $this->userwheresql = "";
        $this->userwheresql_params = array();
        if (isset($SESSION->gradereport['filterfirstname']) && !empty($SESSION->gradereport['filterfirstname'])) {
            $this->userwheresql .= ' AND '.$DB->sql_like('u.firstname', ':firstname', false, false);
            $this->userwheresql_params['firstname'] = $SESSION->gradereport['filterfirstname'].'%';
        }
        if (isset($SESSION->gradereport['filtersurname']) && !empty($SESSION->gradereport['filtersurname'])) {
            $this->userwheresql .= ' AND '.$DB->sql_like('u.lastname', ':lastname', false, false);
            $this->userwheresql_params['lastname'] = $SESSION->gradereport['filtersurname'].'%';
        }
    }
476154
function favorites_tags_update( $id,  $tags )
	{
		$params = array();
		$params['id'] = $id;
		if (is_array($tags) && !empty($tags)) {
			foreach ($tags as $k => $v) {
				$this->id_format($tags[$k]);
			}
			$params['tags'] = join(',', $tags);
		} else {
			$params['tags'] = $tags;
		}
		return $this->oauth->post( 'favorites/tags/update', $params );
	}
1086834
public function favorites($class = __CLASS__)
    {
        return $this->morphedByMany($class, config('follow.morph_prefix'), config('follow.followable_table'))
                    ->wherePivot('relation', '=', Follow::RELATION_FAVORITE)
                    ->withPivot('followable_type', 'relation', 'created_at');
    }
76671
function favorites_show( $id )
	{
		$params = array();
		$this->id_format($id);
		$params['id'] = $id;
		return $this->oauth->get( 'favorites/show', $params );
	}
1242843
public function index()
    {
        $configurations = Configuration::all();
        $configurations_by_sections = ['init' => [], 'email' => [], 'tickets' => [], 'perms' => [], 'editor' => [], 'other' => []];
        $init_section = ['main_route', 'main_route_path', 'admin_route', 'admin_route_path', 'master_template', 'bootstrap_version', 'routes'];
        $email_section = ['status_notification', 'comment_notification', 'queue_emails', 'assigned_notification',
        'email.template', 'email.header', 'email.signoff', 'email.signature', 'email.dashboard',
        'email.google_plus_link', 'email.facebook_link', 'email.twitter_link', 'email.footer', 'email.footer_link',
        'email.color_body_bg', 'email.color_header_bg', 'email.color_content_bg', 'email.color_footer_bg',
        'email.color_button_bg', ];
        $tickets_section = ['default_status_id', 'default_close_status_id', 'default_reopen_status_id', 'paginate_items'];
        $perms_section = ['agent_restrict', 'close_ticket_perm', 'reopen_ticket_perm'];
        $editor_section = ['editor_enabled', 'include_font_awesome', 'editor_html_highlighter', 'codemirror_theme',
          'summernote_locale', 'summernote_options_json_file', 'purifier_config', ];

        // Split them into configurations sections for tabs
        foreach ($configurations as $config_item) {
            //trim long values (ex serialised arrays)
            $config_item->value = $config_item->getShortContent(25, 'value');
            $config_item->default = $config_item->getShortContent(25, 'default');

            if (in_array($config_item->slug, $init_section)) {
                $configurations_by_sections['init'][] = $config_item;
            } elseif (in_array($config_item->slug, $email_section)) {
                $configurations_by_sections['email'][] = $config_item;
            } elseif (in_array($config_item->slug, $tickets_section)) {
                $configurations_by_sections['tickets'][] = $config_item;
            } elseif (in_array($config_item->slug, $perms_section)) {
                $configurations_by_sections['perms'][] = $config_item;
            } elseif (in_array($config_item->slug, $editor_section)) {
                $configurations_by_sections['editor'][] = $config_item;
            } else {
                $configurations_by_sections['other'][] = $config_item;
            }
        }

        return view('ticketit::admin.configuration.index', compact('configurations', 'configurations_by_sections'));
    }
1257742
protected function update_users_used() {
        global $DB;

        $this->userfullnames = array();
        $userids = array();

        // For each event cache full username.
        // Get list of userids which will be shown in log report.
        foreach ($this->rawdata as $event) {
            $logextra = $event->get_logextra();
            if (!empty($event->userid) && empty($userids[$event->userid])) {
                $userids[$event->userid] = $event->userid;
            }
            if (!empty($logextra['realuserid']) && empty($userids[$logextra['realuserid']])) {
                $userids[$logextra['realuserid']] = $logextra['realuserid'];
            }
            if (!empty($event->relateduserid) && empty($userids[$event->relateduserid])) {
                $userids[$event->relateduserid] = $event->relateduserid;
            }
        }
        $this->rawdata->close();

        // Get user fullname and put that in return list.
        if (!empty($userids)) {
            list($usql, $uparams) = $DB->get_in_or_equal($userids);
            $users = $DB->get_records_sql("SELECT id," . get_all_user_name_fields(true) . " FROM {user} WHERE id " . $usql,
                    $uparams);
            foreach ($users as $userid => $user) {
                $this->userfullnames[$userid] = fullname($user);
                unset($userids[$userid]);
            }

            // We fill the array with false values for the users that don't exist anymore
            // in the database so we don't need to query the db again later.
            foreach ($userids as $userid) {
                $this->userfullnames[$userid] = false;
            }
        }
    }
1283749
public function getUsersGender()
    {
        $dates = $this->getStartEndDate();

        $data = LaravelAnalytics::performQuery($dates['start'], $dates['end'], 'ga:sessions',
            ['dimensions' => 'ga:userGender']);

        $items = [];
        $rows = $data->rows;
        if (is_null($rows)) {
            return [];
        }
        shuffle($rows); // shuffle results / randomimize chart color sections
        foreach ($rows as $k => $item) {
            $items[] = $this->getPieDataSet(ucfirst($item[0]), $item[1]);
        }

        return $items;
    }
1345896
function preferences_list($args)
    {
        $rcube         = rcube::get_instance();
        $dont_override = $rcube->config->get('dont_override', array());

        if ($args['section'] == 'mailview' && !in_array('emoticons_display', $dont_override)) {
            $this->load_config();
            $this->add_texts('localization');

            $field_id = 'emoticons_display';
            $checkbox = new html_checkbox(array('name' => '_' . $field_id, 'id' => $field_id, 'value' => 1));

            $args['blocks']['main']['options']['emoticons_display'] = array(
                    'title'   => $this->gettext('emoticonsdisplay'),
                    'content' => $checkbox->show(intval($rcube->config->get('emoticons_display', false)))
            );
        }
        else if ($args['section'] == 'compose' && !in_array('emoticons_compose', $dont_override)) {
            $this->load_config();
            $this->add_texts('localization');

            $field_id = 'emoticons_compose';
            $checkbox = new html_checkbox(array('name' => '_' . $field_id, 'id' => $field_id, 'value' => 1));

            $args['blocks']['main']['options']['emoticons_compose'] = array(
                    'title'   => $this->gettext('emoticonscompose'),
                    'content' => $checkbox->show(intval($rcube->config->get('emoticons_compose', true)))
            );
        }

        return $args;
    }
776902
private function getFavorite($each_char)
    {
        $fav = $each_char->find('.favorites', 0)->plaintext;
        $fav = str_replace(',', '', $fav);

        return trim($fav);
    }
439919
private function get_favourite_sql(int $userid): array {

        $usercontext = \context_user::instance($userid);
        $alias = $this->get_table_alias();
        $ufservice = \core_favourites\service_factory::get_service_for_user_context($usercontext);
        list($favsql, $favparams) = $ufservice->get_join_sql_by_type('mod_forum', 'discussions',
            $this->get_favourite_alias(), "$alias.id");

        return [$favsql, $favparams];
    }
638489
public function getSettings()
    {
        $settings = Settings::all()->keyBy('settingsKey');

        $settings['defaultLanguage'] = (object) array('value' => Language::getDefault()->languageID);

        if(isset($settings['logo'])) {
            $media = Media::where('mediaID', $settings['logo']->value)->select("mediaID", "type", "filename", "fileDirectory")->first();
            if ($media) {
                $settings['logo']['media'] = $media;
            }
            $watermark = Media::where('mediaID', $settings['watermark']->value)->select("mediaID", "type", "filename", "fileDirectory")->first();
            if ($watermark) {
                $settings['watermark']['media'] = $watermark;
            }
        }
        // user groups
        $userGroups = UserGroup::all();
        // get all posts
        $posts = DB::table('post_pages')->select("postID", "title", "slug")->get();
        $posts = Language::filterRows($posts, false);
        // theme configs
        $themeConfigs = Theme::configs();

        return [
            'settings' => $settings,
            'userGroups' => $userGroups,
            'pages' => $posts,
            'themeConfigs' => $themeConfigs,
        ];
    }
364320
static function values( $user = false )
    {
        if ( !( $user instanceof eZUser ) )
            $user = eZUser::currentUser();

        if ( !$user->isAnonymous() )
        {
            // If the user object is not the currently logged in user we cannot use the session values
            $http = eZHTTPTool::instance();
            $useCache = ( $user->ContentObjectID == $http->sessionVariable( 'eZUserLoggedInID', false ) );

            $returnArray = array();
            $userID = $user->attribute( 'contentobject_id' );
            $db = eZDB::instance();
            $values = $db->arrayQuery( "SELECT name,value FROM ezpreferences WHERE user_id=$userID ORDER BY id" );
            foreach ( $values as $item )
            {
                if ( $useCache )
                    eZPreferences::storeInSession( $item['name'], $item['value'] );
                $returnArray[$item['name']] = $item['value'];
            }
            return $returnArray;
        }
        else
        {
            // For the anonymous user we just return all values, or empty array if session is un-started / value undefined
            $http = eZHTTPTool::instance();
            return $http->sessionVariable( eZPreferences::SESSION_NAME, array() );
        }
    }
1083187
function (userOptions) {
  var defaultOptions = { ignore: [], collection: null, jekyllStyleLayout: true };

  for (var opt in userOptions) defaultOptions[opt] = userOptions[opt];

  return defaultOptions;
}
1010137
public void saveFavorites(List<CmsFavoriteEntry> favorites) throws CmsException {

        try {
            JSONObject json = new JSONObject();
            JSONArray array = new JSONArray();
            for (CmsFavoriteEntry entry : favorites) {
                array.put(entry.toJson());
            }
            json.put(BASE_KEY, array);
            String data = json.toString();
            CmsUser user = readUser();
            user.setAdditionalInfo(ADDINFO_KEY, data);
            m_cms.writeUser(user);
        } catch (JSONException e) {
            LOG.error(e.getLocalizedMessage(), e);
        }

    }
833163
public function Activity($UserReference = '', $Username = '', $UserID = '', $Page = '') {
      $this->Permission('Garden.Profiles.View');
      $this->EditMode(FALSE);
      
      // Object setup
      $Session = Gdn::Session();
      $this->ActivityModel = new ActivityModel();
      
      // Calculate offset.
      list($Offset, $Limit) = OffsetLimit($Page, 30);
      
      // Get user, tab, and comment
      $this->GetUserInfo($UserReference, $Username, $UserID);
      $UserID = $this->User->UserID;
      $Username = $this->User->Name;
      
      $this->_SetBreadcrumbs(T('Activity'), UserUrl($this->User, '', 'activity'));
      
      $this->SetTabView('Activity');
      $Comment = $this->Form->GetFormValue('Comment');
      
      // Load data to display
      $this->ProfileUserID = $this->User->UserID;
      $Limit = 30;

      $NotifyUserIDs = array(ActivityModel::NOTIFY_PUBLIC);
      if (Gdn::Session()->CheckPermission('Garden.Moderation.Manage'))
         $NotifyUserIDs[] = ActivityModel::NOTIFY_MODS;

      $Activities = $this->ActivityModel->GetWhere(
         array('ActivityUserID' => $UserID, 'NotifyUserID' => $NotifyUserIDs), 
         $Offset, $Limit)->ResultArray();
      $this->ActivityModel->JoinComments($Activities);
      $this->SetData('Activities', $Activities);
      if (count($Activities) > 0) {
         $LastActivity = $Activities[0];
         $LastModifiedDate = Gdn_Format::ToTimestamp($this->User->DateUpdated);
         $LastActivityDate = Gdn_Format::ToTimestamp($LastActivity['DateInserted']);
         if ($LastModifiedDate < $LastActivityDate)
            $LastModifiedDate = $LastActivityDate;

         // Make sure to only query this page if the user has no new activity since the requesting browser last saw it.
         $this->SetLastModified($LastModifiedDate);
      }

      // Set the canonical Url.
      if (is_numeric($this->User->Name) || Gdn_Format::Url($this->User->Name) != strtolower($this->User->Name)) {
         $this->CanonicalUrl(Url('profile/'.$this->User->UserID.'/'.Gdn_Format::Url($this->User->Name), TRUE));
      } else {
         $this->CanonicalUrl(Url('profile/'.strtolower($this->User->Name), TRUE));
      }
      
      $this->Render();
   }