Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

Display more data on the user profile

9 years 5 months ago
Licenses:
JomSocial Active

Hello.

I'm trying to insert a custom google map on the user profile (profile.about.php).
Here is a user profile for you to test: 2015.iyengar.com.br/jonathan

My code so far is something like that:

<?php 
	$cuser = CFactory::getUser();
	$addr = $cuser->getInfo('FIELD_ADDRESS');
	$cidade = $cuser->getInfo('FIELD_CITY');
	$estado = $cuser->getInfo('FIELD_STATE');
	$pais = $cuser->getInfo('FIELD_COUNTRY');
	$urlok = $addr . $cidade . $estado . $pais;
	$urlok = preg_replace('/\s+/', '+', $urlok);
?>

<iframe
width="100%"
height="400"
frameborder="0" style="border:0"
src="https://www.google.com/maps/embed/v1/search?key=AIzaSyAJ5mZi1gJYnMOQwVvrbDt4PUgzhVKO-bc&q=<?php echo $urlok; ?>" allowfullscreen>
</iframe>

To make matters worse, not even this below (which is in your documentation) is working.
And I tried that also on people.browse.php
<?php
    $cuser = CFactory::getUser();
    $data = $cuser->getInfo('FIELD_ADDRESS');
    echo $data;
?>

Cheers.

9 years 5 months ago
  • Dimas's Avatar
  • Dimas
  • Visitor
  • Thank you received: 0
Licenses:

Hi,

That code should be fine, so what is the problem? can you provide me more detail information plus the screenshoot, please?

thank you!

9 years 5 months ago
Licenses:
JomSocial Active

Hi Dimas.

OK, your answer made me think, then I checked if it was working when I'm logged in, and it is OK.
But as this website need to have 100% of the profile public, can you please tell me how to make this fields visible publicly?

I mean, any field that I can retrieve with your default code from the documentation:

    $cuser = CFactory::getUser();
    $data = $cuser->getInfo('FIELD_GENDER');
    echo $data;
should be visible by the public.

This page as well: 2015.iyengar.com.br/Professores/Membros
There is a field that show the state just below the name, and it will display only when I'm logged in.

You can login to the frontend with:
jonathan
aikido2004

Cheers!

9 years 5 months ago
  • Dimas's Avatar
  • Dimas
  • Visitor
  • Thank you received: 0
Licenses:

Hi,

Ok, please you open this file /components/com_community/templates/jomsocial/people.browse.php, add this code :

<?php echo JText::_($row->user->getInfo('FIELD_GENDER'))."<br>" ?>

below this code :
<a href="<?php echo $row->profileLink; ?>"><h4 class="joms-text--username"><?php echo $row->user->getDisplayName(); ?></h4></a>

9 years 5 months ago
Licenses:
JomSocial Active

Hi Dimas.

That worked for the people.browse.php. Thank you!

But profile.about.php still doesn't work with my map instance:

<?php 
	$addr = $row->user->getInfo('FIELD_ADDRESS');
	$cidade = $row->user->getInfo('FIELD_CITY');
	$estado = $row->user->getInfo('FIELD_STATE');
	$urlok = $addr . "+" . $cidade . "+" . $estado ;
?>
<iframe
width="100%"
height="400"
frameborder="0" style="border:0"
src="https://www.google.com/maps/embed/v1/search?key=AIzaSyAJ5mZi1gJYnMOQwVvrbDt4PUgzhVKO-bc&q=<?php echo $urlok; ?>" allowfullscreen>
</iframe>

Cheers!

9 years 5 months ago
Licenses:
JomSocial Active

Ops, here is the correct code:

<?php 
	$cuser = CFactory::getUser();
	$addr = $cuser->getInfo('FIELD_ADDRESS');
	$cidade = $cuser->getInfo('FIELD_CITY');
	$estado = $cuser->getInfo('FIELD_STATE');
	$urlok = $addr . "+" . $cidade . "+" . $estado ;
	$urlok = preg_replace('/\s+/', '+', $urlok);
?>

<iframe
width="100%"
height="400"
frameborder="0" style="border:0"
src="https://www.google.com/maps/embed/v1/search?key=AIzaSyAJ5mZi1gJYnMOQwVvrbDt4PUgzhVKO-bc&q=<?php echo $urlok; ?>" allowfullscreen>
</iframe>

9 years 5 months ago
Licenses:
JomSocial Active

Clarification on the last post above:
"here is the correct non working code"

9 years 5 months ago
  • Dimas's Avatar
  • Dimas
  • Visitor
  • Thank you received: 0
Licenses:

its working fine

Attachments:
9 years 5 months ago
Licenses:
JomSocial Active

Hi Dimas.

You are logged in. It should also work while you are logged out.

Cheers!

9 years 5 months ago
Licenses:
JomSocial Active

I looked at the docs again, and found that replacing

$cuser = CFactory::getUser();
with
$cuser = CFactory::getRequestUser();
worked perfectly.

If that can help someone else, the final code is:
<?php 
	$cuser = CFactory::getRequestUser();
	$addr = $cuser->getInfo('FIELD_ADDRESS');
	$cidade = $cuser->getInfo('FIELD_CITY');
	$estado = $cuser->getInfo('FIELD_STATE');
	$urlok = $addr . "+" . $cidade . "+" . $estado ;
	$urlok = str_replace(',', '', $urlok);
	$urlok = str_replace('.', '', $urlok);
	$urlok = str_replace('-', '', $urlok);
	$urlok = str_replace(';', '', $urlok);
	$urlok = str_replace(' ', '+', $urlok);
?>

<iframe
width="100%"
height="400"
frameborder="0" style="border:0"
src="https://www.google.com/maps/embed/v1/search?key=AIzaSyAJ5mZi1gJYnMOQwVvrbDt4PUgzhVKO-bc&q=<?php echo $urlok; ?>" allowfullscreen>
</iframe>

Cheers!

Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW