Get a list of all flags created by the current user's flagged users?

Created on 20 January 2017, almost 8 years ago
Updated 22 December 2023, about 1 year ago

So, I've been able to:

* Get a list of all (nodes of type A) that the (contextual User ID) has flagged.

This is great for something like user/%/my-flags. Fine. Awesome.

But, what if I wanted to get a little crazier? Say I have "Flag Follower" enabled. I've followed 5 users. Now, I don't want to see their CONTENT (as the default included View does), but I want to see what THEY'VE FLAGGED. And, for bonus points, I'd like to see what WE'VE flagged. To some degree, I'm looking for a single activity stream of all the flags of myself and whom I'm following. Is that possible? Something like https://www.truetrophies.com/gamer/MorbusIff where all of the "user has won this trophy" are the equivalent of "my followed user, or myself, has flagged this content".

πŸ’¬ Support request
Status

Active

Version

4.0

Component

Views integration

Created by

πŸ‡ΊπŸ‡ΈUnited States morbus iff

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡±Netherlands Web-Beest

    If you want to use the session_id (in case of anonymous users), you should use the session id generated by the flag service in stead of the sessionManager. They are different ;-)

        $flag = $this->flagService->getFlagById('flag_id');
        $user = $this->currentUser;
        $session_id = $this->flagService->getAnonymousSessionId();
    
        $query = $this->database
          ->select('flagging', 'f')
          ->fields('f', [])
          ->condition('flag_id', $flag->id())
          ->condition('uid', $user->id());
    
        if ($user->isAnonymous()) {
          $query->condition('session_id', $session_id);
        }
        $result = $query->execute()->fetchAll();
    
Production build 0.71.5 2024