lewismcarey / User-Field-ACF-Add-on

User Field Add on for Advanced Custom Fields
40 stars 19 forks source link

FATAL ERROR: CANNOT USE OBJECT OF TYPE STDCLASS AS ARRAY... #14

Closed trewknowledge closed 11 years ago

trewknowledge commented 12 years ago

I keep getting the following error:

FATAL ERROR: CANNOT USE OBJECT OF TYPE STDCLASS AS ARRAY IN

I added this to my functions.php file

` function get_author() { $postid = get_the_ID(); $authors = get_field('author', $postid);

if($authors) {    
    foreach($authors as $author) {
        echo 'By '. $author['user_email'] .' on ';      
    }     
}

}`

and this in my page template:

echo get_author();

Any suggestions?

trewknowledge commented 11 years ago

Needed to use $author->user_email