Search code examples
wordpressmagentofishpig

Fishpig Wordpress Magento integration - get the list of all authors


I am using Magento 1.7.0.2 and Fishpig Wordpress full integration extension v. 2.5.0.9

I would like to list all blog authors on my WP integrated Magento Blog. I want it to be done automatically, so the list is updated whenever a new WP author appears.

Anyone has a suggestion how I could extract an array of authors and their information (name, description, etc) using Fishpig functionality?


Solution

  • You can retrieve a collection of authors using the following code:

    <?php $authors = Mage::getResourceModel('wordpress/user_collection') ?>
    

    You can then list through these as follows:

    <?php $authors = Mage::getResourceModel('wordpress/user_collection') ?>
    <?php if (count($authors) > 0): ?>
        <ul>
        <?php foreach($authors as $author): ?>
            <li>
                <a href="<?php echo $author->getUrl() ?>"><?php echo $author->getDisplayName() ?></a>
            </li>
        <?php endforeach; ?>
        </ul>
    <?php endif; ?>