Title: Variable in mycred_link
Last modified: August 21, 2016

---

# Variable in mycred_link

 *  Resolved [Profusion](https://wordpress.org/support/users/profusion/)
 * (@profusion)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/variable-in-mycred_link/)
 * Hi Gabriel/ MyCred team. Thanks for your fantastic plugin.
 * I am trying to use the mycred_link shortcode with buddypress to charge members
   a point for following another member’s link to their external website. I’ve devised
   the following code which I plan to use in the Buddypress member-header.php template
   file (and hide the new custom xProfile “Website” field).
 *     ```
       <?php $mywebsite = bp_get_profile_field_data( 'field=Website' );
         echo do_shortcode('[mycred_link  amount="-1" href="'.$mywebsite.'" target="_blank"]Visit My Website[/mycred_link]'); ?>
       ```
   
 * When I do `echo $mywebsite;` it display the URL correctly but when I use it in
   myred_link shortcode it does not resolve properly.
 * Please help.
 * [http://wordpress.org/plugins/mycred/](http://wordpress.org/plugins/mycred/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [Profusion](https://wordpress.org/support/users/profusion/)
 * (@profusion)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/variable-in-mycred_link/#post-4339042)
 * Sorry – my bad.
 * Have to run `wp_strip_all_tags` on that xprofile field. So that works fine now
   and here is the code if anyone else needs it.
 *     ```
       <?php $userurl = bp_get_profile_field_data( 'field=Website' );
         $cleanurl = wp_strip_all_tags($userurl);
         echo do_shortcode('[mycred_link  amount="-1" href="'.$cleanurl.'" target="_blank"]Visit My Website[/mycred_link]'); ?>
       ```
   
 *  Plugin Author [myCred](https://wordpress.org/support/users/designbymerovingi/)
 * (@designbymerovingi)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/variable-in-mycred_link/#post-4339048)
 * Hey Profusion
 * Thank you for providing an update, I am sure BuddyPress users will find this 
   usable!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Variable in mycred_link’ is closed to new replies.

 * ![](https://ps.w.org/mycred/assets/icon-128x128.gif?rev=3512531)
 * [Points Management System For Gamification, Ranks, Badges, and Loyalty Rewards Program - myCred](https://wordpress.org/plugins/mycred/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mycred/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mycred/)
 * [Active Topics](https://wordpress.org/support/plugin/mycred/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mycred/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mycred/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [myCred](https://wordpress.org/support/users/designbymerovingi/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/variable-in-mycred_link/#post-4339048)
 * Status: resolved