0

Ok so my goal here is to allow users to link there social media profiles onto their user pages. So i tried to print the field within an href statement so it would come out as a link. For example if the value for the field link is http://www.google.com, then it should output the text link with a link to google when clicked.

But it doesnt, it instead outputs the value for the field_link and links it to

Heres what i attempted at:

<html>
<a href="<?php print render($user_profile['field_link']); ?>">Link</a>
</html>

Any help is appreciated!

Edit: Ok so this is what it outputs:

<a href=" <div class="field field-name-field-link field-type-text field-label-hidden><div class="field-items"><div class="field-item even">http://www.google.com</div></div>  </div> ">

But i only want the web address Please Help!!

1

Use the Link field Module:

The link module can be count to the top 50 modules in Drupal installations and provides a standard custom content field for links. With this module links can be added easily to any content types and profiles and include advanced validating and different ways of storing internal or external links and URLs. It also supports additional link text title, site wide tokens for titles and title attributes, target attributes, css class attribution, static repeating values, input conversion, and many more.

Or better, yet do a search for drupal social media for a number of different modules to do exactly this.

  • Thank you so much!! How did i not think of that facepalm – Tyler Newman May 15 '14 at 22:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.