Page lists - filter by user

Permalink
I want to filter a page list by users that own (added) the page, I've been round the houses looking for a starting point in the documentation but can't seem to find anything.

Anyone got any pointers?

ali7566
 
siton replied on at Permalink Reply
siton
Search for "$list->filterBy.... in google / docs.
Mabye this:
https://www.concrete5.org/community/forums/customizing_c5/filtering-...
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi ali7566,

You can use the PageList filterByUserID() method to do this.

http://documentation.concrete5.org/api/class-Concrete.Core.Page.Pag...
ali7566 replied on at Permalink Reply
ali7566
Hey MrKDilkington,

I used filterByUserID() and passed in the user id using $c->getCollectionUserID() on the page object, Thanks for the advice!

Full code below

<?php
      // Blog posts by user 
      $ownerID = $c->getCollectionUserID();
      $ui = UserInfo::getByID($ownerID);
      if($ui) {
         $owner_name = $ui->getAttribute('full_name');
         ?>
         <div class="small-12 medium-12 large-12 columns tour-list-heading-wrapper">
             <h3>Blog Posts Posted By <?php echo $owner_name; ?></h3>
             <a class="button ghost-dark" href="<?php echo DIR_REL . '/index.php?cID=210&user_id=' . $ownerID; ?>">View All</a>
             <div class="break"></div>
         </div>
         <div class="columns small-12 medium-12 large-12">
            <?php
               $dh = Core::make('helper/date'); /* @var $dh \Concrete\Core\Localization\Service\Date */