I'm trying to take the currently logged in user id on my website and add it to the end of the URL to display in an iframe (iframe is for a third party website) I have stumbled upon this code;
function makeClickableLink($text) {
$text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '<a href="\\1">\\1</a>', $text);
$text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '\\1<a href="http://\\2">\\2</a>', $text);
return $text;
}
$user_id = get_current_user_id(); // getting current user id from wordpress
$text = "http://example.com/something/something/?ba=310139&gd=927691&sid=$user_id"; // that's the link to a website i'm trying to iframe with my $user_id at the end
echo makeClickableLink($text);
http://example.com/something/something/?ba=310139&gd=927691&sid=1
So this code outputs the link that I put into the $text and replaces $user_id with the currently logged in users id which is so far exactly what I'm looking for.
Now.. Is there a way to iframe this link by modifying the above code ? (i have a plugin that allows me to use the iframe tags in wordpress before someone mentions that i can't use it there) Or another different way to do it? I need the above URL but in an iframe. I'm sure this is fairly easy to do however I cannot wrap my head around it (very new to all this but trying my best to learn :))
Any help would be greatly appreciated! Thanks!