I need help printing the contents of this function: which came from:
$userFlags = flag_get_user_flags('user', null, $node->uid, null, false); If I use print_r:
print '<pre>'; print_r(flag_get_user_flags('user', null, $node->uid, null, false)); print '</pre>'; I get -
Array ( [follow] => Array ( [13] => stdClass Object ( [flagging_id] => 20 [fid] => 5 [entity_type] => user [entity_id] => 13 [uid] => 1 [sid] => 0 [timestamp] => 1385845849 ) [15] => stdClass Object ( [flagging_id] => 21 [fid] => 5 [entity_type] => user [entity_id] => 15 [uid] => 1 [sid] => 0 [timestamp] => 1385912237 ) [17] => stdClass Object ( [flagging_id] => 22 [fid] => 5 [entity_type] => user [entity_id] => 17 [uid] => 1 [sid] => 0 [timestamp] => 1386040495 ) [18] => stdClass Object ( [flagging_id] => 23 [fid] => 5 [entity_type] => user [entity_id] => 18 [uid] => 1 [sid] => 0 [timestamp] => 1386040515 ) [21] => stdClass Object ( [flagging_id] => 24 [fid] => 5 [entity_type] => user [entity_id] => 21 [uid] => 1 [sid] => 0 [timestamp] => 1386043939 ) [14] => stdClass Object ( [flagging_id] => 25 [fid] => 5 [entity_type] => user [entity_id] => 14 [uid] => 1 [sid] => 0 [timestamp] => 1386129658 ) ) ) When I use:
foreach($userFlags as $item) { echo $item; } All i get is the word "Array" printed. If your familiar with drupal ideally I need to convert each entity_id to its author. printing the 13,15 etc. is a good start for me.
thanks for any help-
foreach($userFlags['follow'] as $item) { var_dump ($item); }codeobject(stdClass)#116 (7) { ["flagging_id"]=> string(2) "19" ["fid"]=> string(1) "5" ["entity_type"]=> string(4) "user" ["entity_id"]=> string(1) "1" ["uid"]=> string(2) "59" ["sid"]=> string(1) "0" ["timestamp"]=> string(10) "1385845765" } object(stdClass)#117 (7) { ["flagging_id"]=> string(2) "27" ["fid"]=> string(1) "5" ["entity_type"]=> string(4) "user" ["entity_id"]=> string(2) "17" ["uid"]=> string(2) "59" ["sid"]=> string(1) "0" ["timestamp"]=> string(10) "1386167853" }code