Answers.Body: <p>From the <a href="https://craftcms.com/docs/searching#searching-for-specific-element-attributes" rel="nofollow">Search</a> page in the docs, it looks like you can't search by author. </p>
  
  <p>It looks, on the face of it, like entries can only be searched on Title, Slug and any of your Custom Fields.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-03T16:39:20.243Z
Answers.LastActivityDate: 2016-03-03T16:39:20.243Z
Answers.UserDisplayName: Steve Holland
Answers.Body: <p>For Craft 3, at least for now.</p>
  <ol>
  <li><p>Make a custom plugin</p>
  </li>
  <li><p>Add event to modify the query in control panel</p>
  <pre><code>// Register element query prepare event
  Event::on(ElementQuery::class, ElementQuery::EVENT_BEFORE_PREPARE,
      function(Event $event)  {
          if (Craft::$app-&gt;getRequest()-&gt;getIsCpRequest()) {
              if ($event-&gt;sender-&gt;elementType === 'craft\elements\Entry') {
  
                  if(isset($_POST['criteria']['search'])&amp;&amp;strpos($_POST['criteria']['search'],'author')!==false)
                  {
                      $email = explode(':',$_POST['criteria']['search']);
                      if(isset($email[1]))
                      {
                          $user = User::find()-&gt;email($email[1])-&gt;one();
  
                          if($user)
                          {
  
                              $event-&gt;sender-&gt;query-&gt;andWhere(['authorId'=&gt;$user-&gt;id]);  
                              $event-&gt;sender-&gt;subQuery-&gt;andWhere(['authorId'=&gt;$user-&gt;id]);  
                              $event-&gt;sender-&gt;search = null;
                          } 
                      }
  
                  }
              }
          }
      }
  );
  </code></pre>
  </li>
  <li><p>So when you type <code>author:[Email]</code> it can fetch in the CMS.</p>
  </li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-09T08:52:23.950Z
Answers.LastActivityDate: 2023-02-19T08:07:35.660Z
Answers.LastEditDate: 2023-02-19T08:07:35.660Z
Answers.UserDisplayName: Nickwanhere
Body: <p>How can you filter entries in the CP by Author? I assumed entering something like <strong>author:tdavis</strong> (where tdavis is my username) would do it, but no results returned. I also tried substituting id for username.</p>
  
Tags: <control-panel><search><author>
Title: Filter entries in CP by Author
ThreadText: # Filter entries in CP by Author
  
  (Asked by: username_0 on 2016-03-03)
  
  How can you filter entries in the CP by Author? I assumed entering something like **author:tdavis** (where tdavis is my username) would do it, but no results returned. I also tried substituting id for username.
  
  **Tags:** control-panel, search, author
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-03-03. Score: 1 | Accepted answer
  
  From the [Search](https://craftcms.com/docs/searching#searching-for-specific-element-attributes) page in the docs, it looks like you can't search by author.
  
  It looks, on the face of it, like entries can only be searched on Title, Slug and any of your Custom Fields.
  
  
  ---
  
  ### Answer by username_2 on 2020-01-09. Score: 2
  
  For Craft 3, at least for now.
  
  1. Make a custom plugin
  2. Add event to modify the query in control panel
  
     ```
     // Register element query prepare event
     Event::on(ElementQuery::class, ElementQuery::EVENT_BEFORE_PREPARE,
         function(Event $event)  {
             if (Craft::$app->getRequest()->getIsCpRequest()) {
                 if ($event->sender->elementType === 'craft\elements\Entry') {
  
                     if(isset($_POST['criteria']['search'])&&strpos($_POST['criteria']['search'],'author')!==false)
                     {
                         $email = explode(':',$_POST['criteria']['search']);
                         if(isset($email[1]))
                         {
                             $user = User::find()->email($email[1])->one();
  
                             if($user)
                             {
  
                                 $event->sender->query->andWhere(['authorId'=>$user->id]);  
                                 $event->sender->subQuery->andWhere(['authorId'=>$user->id]);  
                                 $event->sender->search = null;
                             } 
                         }
  
                     }
                 }
             }
         }
     );
  
     ```
  3. So when you type `author:[Email]` it can fetch in the CMS.
  
  
  ---
  
  