user3679330 user3679330 - 4 months ago 16
PHP Question

Adding reference ID to messenger send button links

I have the following code:

<div class="fb-send" data-href="http://www.mywebsite.com/here/?ref=<?php $current_user->ID; ?>" data-size="small"></div>


I am trying to append the current user iD to the link and have that link shared via messenger, however when the messenger share button is clicked it only shares "http://www.mywebsite.com/here/?ref="

any help would be much appreciated!

Thanks in advance

Oh and I also have the Javascript SDK included on the page before the
<body>
tag

Answer

You just forgot to echo your variable :

<div class="fb-send" data-href="http://www.mywebsite.com/here/?ref=<?php echo $current_user->ID; ?>"  data-size="small"></div>
Comments