• Hello community,

    how can I hand over the current logged User (UserID) to a iframe?
    In this iframe run a PHP file and get the UserID.
    e.g. domain.com/run.php?userid=42

    Can everybody help me?
    Thank you!
    Michael

Viewing 3 replies - 1 through 3 (of 3 total)
  • Something like this?

    <iframe src="http://remotesite.com?userid=<?php echo get_current_user_id(); ?>"></iframe>

    Just take a note of what it says on the codes page as well, just in case. https://codex.wordpress.org/Function_Reference/get_current_user_id

    Thread Starter MM2

    (@mm2)

    Thank you, but it don’t work.
    I have installed the “Advanced iframe Pro” and the code in WordPress is:

    [advanced_iframe securitykey="4g4j54jh46g32gf67" src="http://www.domain.com/zertvbapp/userid.php?userid=<?php echo get_current_user_id(); ?>" id="example1"]

    The code from userid.php is:

    <?php
    echo "Start<br>";
    echo "(".$_GET["userid"].")";
    echo "End";
    ?>

    And the output is:

    Start
    ()End

    How can I check, if the PHP Code execute correct in wordpress?
    Thank you!
    Michael

    Yeah, that’s in a shortcode, and you can’t do it that way. Shortcodes don’t work with PHP code, so you’d need to figure something else out.

    As it’s done via a plugin, the plugin needs to be set up to do this. You would need to check with the plugins author or vendor for support as it’s a commercial plugin.

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

The topic ‘Put UserID ti a PHP File in a iframe’ is closed to new replies.