Closed (fixed)
Project:
Profile 2
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
3 Dec 2011 at 19:02 UTC
Updated:
6 Jan 2015 at 09:21 UTC
Jump to comment: Most recent
Comments
Comment #1
bjalford commentedtried this:
global $user;
$test = profile2_load_by_user($user->uid);
dpm($test);
but get undefined function
Comment #2
ron williams commentedI replaced
dpm($test);with
print_r($test);Do you have devel installed?
Comment #3
ron williams commentedComment #4
Saoirse1916 commentedI've done this method as well and I can successfully print_r($test), in this case. I can see the full array of profile variables, but when I print them it breaks my site. Its as if it somehow strips out all CSS and crashes the rendering at the point that I try to print the variable that I need. Here's my code:
?>
The print causes the crash. If I do this:
It renders just fine, but it includes the label "First Name:" which I don't want.
Comment #5
Saoirse1916 commentedComment #6
pwaterz commented$profile is an object not an array. Try using dsm or print_r on $profile. There is not bug here, just lack of understanding or php.
Comment #7
Saoirse1916 commentedYou're right -- I figured it out. Here's the code that did it for me.
Comment #8
jay.lee.bio commentedSaoirse1916, thanks for #7. If anyone knows what the code should be for Location, please let me know: https://www.drupal.org/node/1702180, #3