-1

How should i extract fields from jomsocial (latest version 2.8) so i can showcase anywhere else in the profile? i'm planning to re-design the profile page.

I tried with this code in the profile.about.php but couldn't get it to function.

<?php
$data = array( 'type' => 'textarea' , 'value' => $user->getInfo('FIELD_ABOUTME') );
CFactory::load( 'libraries' , 'profile' );
$value = CProfileLibrary::getFieldData( $data );
?>
<?php echo $value; ?>

Got error:

Fatal error: Call to a member function getInfo() on a non-object in

I'm using jomsocial 2.8 and joomla 2.5.

Techie
  • 44,706
  • 42
  • 157
  • 243
nikita gupta
  • 49
  • 1
  • 1
  • 4

2 Answers2

1

Try this

<?php
        $data = array( 'type' => 'textbox' , 'value' => $member->getInfo('FIELD_COMPANY_NAME') );
        CFactory::load( 'libraries' , 'profile' );
        $value = CProfileLibrary::getFieldData( $data );
     ?>
        <?php echo $value; ?>
Flexo
  • 87,323
  • 22
  • 191
  • 272
  • it's not working out onlineplaner. It gives me an error: Fatal error: Call to a member function getInfo() on a non-object in ...the first line of this code. – nikita gupta Jan 23 '13 at 14:23
1

Jomsocial documentation recommends using the following code to get user field data, probably because its field values are set up a bit different in the database.

$user = CFactory::getUser($userId);
$data = $user->getInfo('FIELD_CODE');   
Kathir
  • 1,212
  • 15
  • 25