Get blog post authors.

@param Blog $blog

@return array
773428
public function getAuthors($blog)
    {
        $recordSet = $this->repo->findAuthorsByBlog($blog);
        $authorsIds = [];
        foreach ($recordSet as $value) {
            $authorsIds[] = $value['id'];
        }
        $authors = $this->userRepo->findBy(['id' => $authorsIds], ['lastName' => 'ASC']);
        $serializedAuthors = [];
        foreach ($authors as $author) {
            $serializedAuthors[] = $this->userSerializer->serialize($author, [Options::SERIALIZE_MINIMAL]);
        }

        return $serializedAuthors;
    }
1149231
public function getAll($excludeUnpublished = false, Blog $blog = null)
    {
        $this->clearInstance();
        $this->qb = $this->getInstance();

        //If $excludeUnpublished === true, we exclude the non published results
        if ($excludeUnpublished) {
            $this->qb
                ->andWhere('article.status = :status')
                ->orWhere('article.status = :scheduled_status AND article.publishedAt <= :now')
                ->setParameter('status', PageStatus::PUBLISHED)
                ->setParameter('scheduled_status', PageStatus::SCHEDULED)
                ->setParameter('now', new \DateTime());
        }

        if (null != $blog) {
            $this->qb
                ->andWhere('article.blog = :blog')
                ->setParameter('blog', $blog->getId());
        }

        return $this;
    }
1127308
public function getPostByIdOrSlug(Blog $blog, $postId)
    {
        if (is_int($postId)) {
            $post = $this->repo->findOneBy([
                'blog' => $blog,
                'id' => $postId,
            ]);
        } else {
            $post = $this->repo->findOneBy([
                'blog' => $blog,
                'slug' => $postId,
            ]);
        }

        return $post;
    }
1206079
public function getBlogAuthorsAction(Blog $blog)
    {
        $this->checkPermission('OPEN', $blog->getResourceNode(), [], true);

        return $this->postManager->getAuthors($blog);
    }
4981
public static function getArticles($nbposts)
    {
        $args = [
                'post_type'      => 'post',
                'category_name'  => 'blog',
                'posts_per_page' => $nbposts,
                'order'          => 'DESC',
            ];
        $loop = new \WP_Query($args);
        while ($loop->have_posts()) {
            $loop->the_post();
            get_template_part('template-parts/blog', 'article');
        }
        wp_reset_query();
    }
463295
public function getPostsByTagPaged(Blog $blog, Tag $tag, $filterByPublishPost, $page = 1)
    {
        $query = $this->repo->getByTag($blog, $tag, $filterByPublishPost, false);

        return $this->setPager($query, $page, $blog->getOptions()->getPostPerPage());
    }
529666
def get_recent_posts(blog_id, username, password, number):
    
    user = authenticate(username, password)
    site = Site.objects.get_current()
    return [post_structure(entry, site)
            for entry in Entry.objects.filter(authors=user)[:number]]
767863
public function newPostAction(Request $request, Blog $blog)
    {
        $article = new Article();
        $article->setBlog($blog);
        $form = $this->createForm(ArticleType::class, $article);

        $form->handleRequest($request);
        if ($form->isValid()) {
            $page = $this->get('victoire_blog.manager.article')->create(
                $article,
                $this->getUser()
            );

            $dispatcher = $this->get('event_dispatcher');
            $event = new ArticleEvent($article);
            $dispatcher->dispatch(VictoireBlogEvents::CREATE_ARTICLE, $event);

            if (null === $response = $event->getResponse()) {
                $response = new JsonResponse([
                    'success' => true,
                    'url'     => $this->generateUrl('victoire_core_page_show', [
                        '_locale' => $request->getLocale(),
                        'url'     => $page->getUrl(),
                    ]),
                ]);
            }

            return $response;
        }

        return new JsonResponse([
            'success' => false,
            'message' => $this->container->get('victoire_form.error_helper')->getRecursiveReadableErrors($form),
            'html'    => $this->container->get('templating')->render(
                'VictoireBlogBundle:Article:new.html.twig',
                [
                    'form'   => $form->createView(),
                    'blogId' => $blog->getId(),
                ]
            ),
        ]);
    }
516450
public function getComments($blogId, $postId, $userId, $filters, $allowedToSeeOnly)
    {
        if (!isset($filters['hiddenFilters'])) {
            $filters['hiddenFilters'] = [];
        }
        //filter on current blog and post
        $filters['hiddenFilters'] = [
            'blog' => $blogId,
            'post' => $postId,
        ];

        //allow to see only published post, or post whose current user is the author
        if ($allowedToSeeOnly) {
            //anonymous only sees published
            if (null === $userId) {
                $options = [
                    'publishedOnly' => true,
                ];
            } else {
                $options = [
                    'allowedToSeeForUser' => $userId,
                ];
            }

            $filters['hiddenFilters'] = array_merge(
                $filters['hiddenFilters'],
                $options);
        }

        return $this->finder->search('Icap\BlogBundle\Entity\Comment', $filters);
    }
802392
private function fetchLoggedAuthor(): Author
    {
        $author = new Author();

        try {
            $permissionResolver = $this->repository->getPermissionResolver();
            $userService = $this->repository->getUserService();
            $loggedUserId = $permissionResolver->getCurrentUserReference()->getUserId();
            $loggedUserData = $userService->loadUser($loggedUserId);

            $author->name = $loggedUserData->getName();
            $author->email = $loggedUserData->email;
        } catch (NotFoundException $e) {
            //Do nothing
        }

        return $author;
    }
1023842
public function edit(BlogRequest $request, Blog $blog)
    {
        return $this->response->title(trans('app.edit') . ' ' . trans('blog::blog.name'))
            ->view('blog::blog.edit', true)
            ->data(compact('blog'))
            ->output();
    }
18334
function getBook( $blog_id ) {

		/** @var $wpdb \wpdb */
		global $wpdb;

		$sql = "SELECT * FROM {$this->dbTable} WHERE users_id = %d AND blogs_id = %d AND deleted = 0 ";

		return $wpdb->get_row( $wpdb->prepare( $sql, $this->userId, $blog_id ), ARRAY_A ); // @codingStandardsIgnoreLine
	}
1333355
public function getPublishedPosts()
    {
        return PostSearch::find()
            ->joinWith('category')
            ->where(['publish_status' => Post::STATUS_PUBLISHED, 'blog_category.id' => $this->id])
            ->all();
    }
226544
public function addAuthors($authors)
    {
        $app = App::getInstance();

        foreach ($authors as $author) {
            $authorRecord = new ArticleAuthor();
            $authorRecord->setArticle($this)->setAuthor($author)->save();
        }
        return $authors;
    }
1296654
public function getAuthors()
    {
        $return  = array();
        $authors = $this->entry->get_authors();

        if (is_array($authors) && count($authors) > 0) {
            foreach ($authors as $author) {
                $authorName = $this->readName($this->decodeString($author->get_name()));
                $authors[] = array(
                    'firstname' => $authorName['firstname'],
                    'lastname' => $authorName['lastname'],
                    'email' => $author->get_email(),
                    'link' => $author->get_link(),
                );
            }
        }

        return $return;
    }
1327546
public function getTagsAction(Blog $blog)
    {
        $this->checkPermission('OPEN', $blog->getResourceNode(), [], true);

        $parameters['limit'] = -1;
        $posts = $this->postManager->getPosts(
            $blog->getId(),
            $parameters,
            $this->checkPermission('ADMINISTRATE', $blog->getResourceNode())
            || $this->checkPermission('EDIT', $blog->getResourceNode())
            || $this->checkPermission('MODERATE', $blog->getResourceNode())
                ? PostManager::GET_ALL_POSTS
                : PostManager::GET_PUBLISHED_POSTS,
            true);

        $postsData = [];
        if (!empty($posts)) {
            $postsData = $posts['data'];
        }

        return new JsonResponse($this->blogManager->getTags($blog, $postsData));
    }
750041
public function getOptionsAction(Request $request, Blog $blog)
    {
        $this->checkPermission('EDIT', $blog->getResourceNode(), [], true);

        return new JsonResponse($this->blogOptionsSerializer->serialize($blog, $blog->getOptions(), $this->blogManager->getPanelInfos()));
    }