Hi,
I need to create custom profile block using URL from profiles. I have

<?php if (isset($profile['profile_url'])): ?>
  <?php print $profile['profile_url']->value .'<br />'; ?>
<?php endif; ?>

But I don't know how to change displayed text of this link. Is there any solution?

Comments

romand’s picture

<?php if (isset($profile['profile_url'])): ?>
  <div class="somename"><?php print $profile['profile_url']->value; ?></div>
<?php endif; ?>
maxiorel’s picture

Thanks, but this is not, what I need. The code above generate

<a href="http://www.domain.tld/">http://www.domain.tld</a>

and I need something like

<a href="http://www.domain.tld/">My text</a>

Jan Polzer, Drupal & Symfony developer

mdixoncm’s picture

If your doing this in the theme user_template file then you can just grab the actual value off the $account object (which should be a raw string), rather than the fields array which will have its content processed into rendered output. Obviously this means you have to be a bit careful as you will be dealing with unfiltered user input - but you should be ok ...

Cheers,

Mike,
Computerminds offer Drupal development, consulting and training

maxiorel’s picture

thanks, that is exactly I want. Now I am able to use this piece of code :-)

<?php if (isset($profile['profile_homepage'])): ?>
  <?php print '<p><a href="'.check_url($account->profile_url).'">homepage</a></p>';?>  
<?php endif; ?>

Jan Polzer, Drupal & Symfony developer