First time posting a question here. I’m definitely NOT a coding expert, I have learned some HTML and CSS thanks to Google, StackOverflow, and lots of trial and error, but this one seems to be a PHP issue, and I know almost nothing about PHP.
I am creating a subscription WordPress website and I need to create an iframe with a dynamic src value.
The first part of the src value would be the same for every user (for example https://app.example.com/autoin/) and then it should be completed by a unique code given to each user. That code lives in one of the fields in the user’s profile. I’m currently using the second address line for that. The id or name for that field is address-two.
The closest I have come across to a working code is the one below, which I add to directly to the page I will use, using a Raw HTML box from WPBakery.
<?php
$current_user = wp_get_current_user();
if($current_user) {
?>
<iframe class="metricool-iframe" src="https://app.example.com/autoin/<?php echo $current_user->address-two; ?>>
</iframe>
<?php
}
?>
When I check the View Page Source in Chrome, I can see that the URL is still https://app.example.com/autoin/<?php echo $current_user->address-two; ?>
So, it’s not really working.
Please, is there anything I can do to improve the code above. Or is there any other method? Please keep in mind that I’m a total beginner to this 😛
Thank you in advance!!
Ern.
2
Answers
It's a Wordpress website, the index page is index.php.
I checked my server with https://iplocation.io/ and it returned "Apache". Not sure if that is what you were referring to.
I was wondering if, instead of generating the URL with PHP, I just put the full unique URL in the address-two profile field?
I tried this, but it doesn't work:
Also, note that I will need to request the user's email address too and add it as a parameter.
Thank you very much!
You could try this:
If this helps please mark as answer, it would mean a lot!
EDIT:
What is the name of your file? (Ex: index.html, index.php)
And what webserver are you using, and are you 100% sure it has php running on it?