Pass current user to iFrame
-
Not sure, does it work to pass the current user ID to the iFrame?
I mean the user which can be showed with this command:global $current_user;
get_currentuserinfo();
echo ‘User ID: ‘ . $current_user->ID . “\n”;Can it be transmitted somehow with url_forward parameter ?
Thanks
Boas
-
No,
but you can easily add this to the src in the code.
Best, Michael
Please, as I am not a WordPress Guru, would you mind to just tell me where to put what? Thanks!!
π
BoasSearch for <iframe
in advanced_iframe.php
add before your sectionglobal $current_user;
get_currentuserinfo();
and add then the parameter to the id e.g.
$src = src . “?id=” . $current_user->ID;This is a good idea. I’ll add this parameter and a few more (login, e-mail) to the pro version.
Best, Michael
Yes please add it and let me know. I buy the pro version right away!
I can also test it.Thanks
BoasPlease send me a message through codecanyon after you got the plugin. I can send you a custom version than.
It always takes some time until code canyon updates.Best, Michael
Yes, will do.
Q: The URL forward parameters appearing as POST in the website inside the iFrame?
Or GET?
Q: As far as I can see the URL forward parameters are not appearing anywhere in the source code transmitted to the browser?Thanks!
Boas
– GET – they are appended to the url
” URL forward parameters are not appearing anywhere in the source code transmitted to the browser?” I don’t understand.
The parameters defined there are read from the parent and passed as get parameter to the iframe url.
Best, Michael
” URL forward parameters are not appearing anywhere in the source code transmitted to the browser?”
If I have a look at the source on the wordpress site where the iframe is placed I do see:
…<iframe id=’advanced_iframe’ name=’advanced_iframe’ src=’http://www.mypage.ch/’ width=’100%’ height=’600′ scrolling=’auto’ frameborder=’0′ border=’0′ allowtransparency=’true’ ></iframe>..So whatever I define in url_forward_parameter it will not appear in the source of the main WordPress site?
Specially if we transmit User ID’s as discussed we have to take care about such issues….
Boas
I think we don’t talk about the same thing:
your parent: http://www.example.com/?id=1&test=2
your iframe: http://www.example2.com
you configure src=www.example2.com
and url_forward_parameters=”id,test”Than the url of the <iframe tag is src=”www.example2.com?id=1&test=2″
Explain again, puzzled, If I insert the tag:
[advanced_iframe securitykey=”e4ddsfbjdsfboub2114324234259e” src=”http://www.mypage.ch/” url_forward_parameter=”test = 776″]
I do see in the WordPress source (Firefox: right click “View page source”)
..<iframe id=’advanced_iframe’ name=’advanced_iframe’ src=’http://www.mypage.ch/’ width=’100%’ height=’600′ scrolling=’auto’ frameborder=’0′ border=’0′ allowtransparency=’true’ ></iframe>..
So the “test = 776” never appears, I assume in the page source of the WordPress page containing the iFrame. True?
Boas
Wrong config:
[advanced_iframe securitykey=”e4ddsfbjdsfboub2114324234259e” src=”http://www.mypage.ch/” url_forward_parameter=”test”]
would pass the parameter from http://www.parentpage.com/test=766
to
http://www.mypage.ch/?test=766If you want to simply add a fix parameter:
[advanced_iframe securitykey=”e4ddsfbjdsfboub2114324234259e” src=”http://www.mypage.ch/?test=776″%5DIn the version I will send you you can than use:
If you want to simply add a fix parameter:
[advanced_iframe securitykey=”e4ddsfbjdsfboub2114324234259e” src=”http://www.mypage.ch/?id={userid}”]Best, Michael
Hi Michael,
I’d been using just normal iframe HTML and passing a shortcode as part of the URL SRC to send a variable over prepopulate a form to Zoho Creator. (e.g. src=”https : //creator.zohopublic.com/…/User=[currentuser_username]” and this worked fine until WP 4.2.3 came out.Stumbled across the above and wondered whether your code would allow me to get back operational and pass the WP username in the URL string.
Thanks!
where does [currentuser_username] come from. This is nothing from the advanced iframe pro.
Best Michael
Thanks for the response. {currentuser_username] is from another shortcode plugin that I had been using within a normal HTML iframe tag. But with the WP upgrade to 4.2.3, that shortcode stopped working within an iframe and I’m looking for another way to do what I need.
I’m not a coder and wasn’t sure how to write something myself. I saw this thread where it suggests your advanced iframe pro allowa the inclusion of the {userid} and similar parameters to be passed within your shortcode. Before looking to buy the pro version, wanted to know if I’d be able to pass (login, userid or username) in src=”https://creator.zohopublic.com/…/User={WP user parameter}”
You can pass all of this parameters in the pro version.
Best, Michael
The topic ‘Pass current user to iFrame’ is closed to new replies.