Community Builder Extended profile part 2 Print E-mail
Written by Andy   
Tuesday, 29 April 2008
The second half of the Community Builder Extended profile article.

 

6. Paste the following code in xtdUserProfile.php:

 

<?php defined'_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
 
$avatar $user->avatar;
 $avatarapproved    $user->avatarapproved;
 if ($avatar=='' || $avatar==null) {
  //$avatar_img = "components/com_comprofiler/plugin/language/default_language/images/tnnophoto.jpg";
$avatar_img sefRelToAbs'components/com_comprofiler/plugin/language/default_language/images/nophoto.jpg' );
   } elseif ($avatarapproved==0) {
$avatar_img=sefRelToAbs('components/com_comprofiler/plugin/language/default_language/images/tnpendphoto.jpg');
   } elseif (strpos($avatar,"gallery/")===false) {
$avatar_img "images/comprofiler/tn".$avatar;
   } else {
 $avatar_img sefRelToAbs'images/comprofiler/' .$avatar );
            }
 
  if($ueConfig['allow_onlinestatus']==1) {
            $database->setQuery("SELECT COUNT(*) FROM #__session WHERE userid =".$user->id);
 
            $isonline $database->loadResult();
            $online_status '';
            if ($isonline 0) {
                $online_status 'Online';
            } else {
                $online_status 'Offline';
            }
        }
 
//Date Functions
        if ($user->lastupdatedate == '0000-00-00 00:00:00') {
            $user->lastupdatedate 'Never';
        } else {
            $user->lastupdatedate cbFormatDate($user->lastupdatedate);
        }
 
        $user->registerDate cbFormatDate($user->registerDate);
        $user->lastvisitDate cbFormatDate($user->lastvisitDate);
 
?>
<!-- Begin xtdUserProfile Template -->
 
<!-- End xtdUserProfile Template -->
 
 
7. Add the HTML after 
 
“<!-- Begin xtdUserProfile Template -->” 
 
You can add CSS to style the layout in the default template.css file.
 
 
Here is an example of one possible layout:
 
<!-- Begin xtdUserProfile Template -->
 
 <table class="xtdUserProfileWrapper">
<tr>
    <td colspan="2">
    Header here Registerlogin links here
    </td>
</tr>
<tr>
    <td colspan="2">
    <!-- Top row of links -->
    <?php echo $userViewTabs["cb_head"]; ?>
    </td>
</tr>
<tr>
   <td colspan="2">
   <div style="float:right; width:125px;">
   Rating<br/> <em>I never figured how to get the rating to work correctly</em>
   </div>
   <!-- Your Avatar -->
   <img src="<?php echo $avatar_img; ?>" title="Your Avatar" alt="Your Avatar" align="left" />
   <?php echo $user->username; ?>
   <br/>
   Name: <?php echo $user->firstname; ?>   
   Age: <?php echo $user->age; ?>   
   Gender: <?php echo $user->gender; ?>
   <br/>
   Town/City: <?php echo $user->city; ?>   
   Country: <?php echo $user->country; ?>  
   <br/>
   Links here, such as: Send a Message, Donate Points , Add to Buddy List, Add to Block List
   </td>
</tr>
<tr>
   <td colspan="2">
   <div style="float:right; width:125px;">
   This is <?php echo $user->username; ?>'s Profile
   </div>
   Profile
   <hr/>
   </td>
</tr>
<tr>
   <!-- Begin first column -->
   <td class="leftColumn">
   Load your information here. (Such as <?php echo $user->username; ?>)<br/>
   It might be good to create a tab for each of these boxes.<br/>
   Or you could run a SQL query to get each 'tab' in the user profile.
   <br/>And do a <h3><?php echo $tab[AboutMe]->title; ?>. Then a foreach echo tab[key]: tab[value] 
   </td>
   <!-- End first column -->
 
   <!-- Begin second column -->
   <td class="rightColumn">
   </td>
   <!-- End second column -->
 
<!-- End xtdUserProfile Template -->
 
Notes
 
If you would like to know what all the available fields are 
add the following code above the HTML in xtdUserProfile:
 
$debug 1;
if ($debug == 1) {
  echo '<pre>';
  print_r($user);
  echo '</pre>';
}
 
If you would like to only show it to you or always leave it on, you can also add the following:
 
$debug 1;
if ($debug == && $my->id == "YourLoginInfo) {
  echo '<pre>';
  print_r($user);
  echo '</pre>';
}
 
If $my->id does not work add this to the xtdUserprofile function: 
 
global $my;
 

 

Trackback(0)
feed0 Comments

Write comment
You must be logged in to a comment. Please register if you do not have an account yet.

busy
 
< Prev

Groups

You are not a member of any group

Friends

You don't have any friend connection.
 

Who's Online

Total Users

681 registered
1 today
12 this week
17 this month
Last: ralston25

Stats tracking

JoomlaWatch Stats 1.2.5 by Matej Koval