PHP Code for Profile View Page - Please View

Permalink
Hi, first I can't tell you how grateful I am for any help. If you need to please look at my attached files and code below to see what I am talking about.

I am trying to find out what code I need to add to the view.php page (a sub of the Profile page in the Single-Pages section, see attached file 1) so that I can add custom User Attributes on the page, more than just the ones added as a big group because they are visible to other users. Does this make sense? I want to let them see several attributes (and edit too) about themselves outside of the edit page where they change their passwords, etc.

Here is the current code in the view.php page - my question is, what code can I place to include some specific individual attributes of any given user (as seen in attached file 2)??????????

--------------------------------------

<?php defined('C5_EXECUTE') or die("Access Denied."); ?>
<div id="ccm-profile-wrapper">
<?php Loader::element('profile/sidebar', array('profile'=> $profile)); ?>
<div id="ccm-profile-body">
<div id="ccm-profile-body-attributes">
<div class="ccm-profile-body-item">

<h1><?php echo $profile->getUserName()?></h1>

<?php
$uaks = UserAttributeKey::getPublicProfileList();
foreach($uaks as $ua) { ?>
<div>
<label><?php echo $ua->getKeyName()?></label>
<?php echo $profile->getAttribute($ua, 'displaySanitized', 'display'); ?>

</div>
<?php } ?>

</div>

</div>

<?php
$a = new Area('Main');
$a->setAttribute('profile', $profile);
$a->setBlockWrapperStart('<div class="ccm-profile-body-item">');
$a->setBlockWrapperEnd('</div>');
$a->display($c);
?>

</div>

<div class="ccm-spacer"></div>

</div>

------------------------

Your help is so appreciated, I am new to PHP and have been struggling for a long time now with this.

2 Attachments

View Replies:
ronyDdeveloper replied on at Permalink Reply
ronyDdeveloper
Use this to display any custom user attribute:
global $u; // current user
$info = UserInfo::getByID($u->getUserID());
echo $info->getAttribute('attribute_handle');


Note: You need to replace the "attribute_handle" text with your own attribute handle

Rony
jasonjb replied on at Permalink Reply
I got the code to work on pages other than my profile, is there a reason why that does that?

Also, what could would be required to edit/re-write that element? I know I will need some type of a form and submit button that will re-write to the database.

Again, thank you so much for your help