0

HI im getting the following error
Warning: Invalid argument supplied for foreach() in /home/jktempla/public_html/includes/class-query.php on line 106
in the following bit of coding can anyone see whats happening

public function do_user_directory() {


    $users = $this->load_all_user_objects();

                    foreach ( $users as $user ) { ?> <div class="directory_item"> <h3><a href="/social/profile-view.php?uid=<?php echo $user->ID; ?>"><?php echo $user->user_nicename; ?></a></h3> <p><?php echo $user->user_email; ?></p> </div> <?php
                    }
                }

any help would be much appreicated jan :)

2
Contributors
1
Reply
14
Views
1 Year
Discussion Span
Last Post by Johnny1
1

The foreach() construct expects something "iterable" -- an array or an object. That error basically indicates that $this->load_all_user_objects() is not returning something iterable. So you need to focus on the "load_all_user_objects()" method and figure out why it is not returning the expected results.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.