I have done some modifications to the profile display and update pages and I have a little problem with getting a photo to display properly. I need to be able to set a photo when there is one and have it display a text message when there is not. I will show below what I have so far and the problems I am having.
Added to modules/Forums/includes/usercp_viewprofile.php
Code:
if ($profiledata['user_photo']==''){
$user_photo = 'No user provided photo exists!';
}else{
$user_photo = '~img src='images/userphotos/" . $profiledata['user_photo'] "'~';
}
Replace the ~ with < > respectively. That snippet causes the page to come up empty, not blank but empty, however if there is no user photo in the DB it works just as planned. Then if I change it to this to test:
Code:
if ($profiledata['user_photo']==''){
$user_photo = 'No user provided photo exists!';
}else{
$user_photo = '~img src='images/userphotos/ki4mve.jpg'>';
}
I get a photo but that would display my photo everytime that woulnt work. I need to somehow pass a varriable to the img tag to display the proper photo of whatever is stored in the database field user_photo only when that field is populated. Any ideas would be great.
I have already modified the .tpl for the profile display and all my other fields are displaying fine but they dont exactly need if/else to control data display.
Last edited by chadrt on Sun Jul 22, 2007 4:49 am; edited 1 time in total
Again replace the ~ with <or> respectively. But that was my solution to the problem I dont know why that would not work by joining text and a variable maybe someone here can show me what I did wrong. But I at least had to experiment and read a bit just so I could learn.
Your first bit of code was missing a . (period) .. so it was incorrect syntax and would not parse. Also a missing end double-quote. Thus the blank page
Which dosent seem right I thought you had to start and end with the same character example "< + >" would be ok but "< + >' would not be ok? I am at another stand still using the same exact thing as I just went thru up top but using the $userinfo located in a mod I am doing with the Your_Account module so I can see, change, and delete the profile photo. No matter what I do the photo wont display. If I place a single img tag it works but not if I add the if/else statements in there to control the output. Here it is for index.php in Your_Account module:
Code:
if ($userinfo['user_info']==''){
echo "This is no photo on file for your profile use the utilities to the left to add one!";
}else{
echo "~img src=images/userphotos/".$userinfo['user_photo'] .">";
}
If I echo only the img tag it displays perfectly but this just shows the "There is no photo" error and thats it. Even thought it is definately populated if I echo just the $userinfo['user_photo'] above, below or both it shows up perfectly so the if should see something there and process else correct?
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum