Attaching WP username to form submission using custom insert PHP code no longer working

  • Profile Image
    Asked on November 25, 2014 at 05:35 AM

    Hi guys.


    I have a form on my website which I have a hidden field on that captures the logged in username and attaches it to the form. Now this is no longer working and instead the following information is being transferred to the form:


    [insert_php] global $current_user; get_currentuserinfo(); echo $current_user->user_login; [/insert_php]!


    Code I have used in iframe:


    <iframe id="JotFormIFrame" style="width: 100%; height: 1011px; border: none;" src="//[insert_php] global $current_user; get_currentuserinfo(); echo $current_user-&gt;user_login; [/insert_php]" width="100%" height="1020px" frameborder="0" scrolling="no"></iframe>

    <script type="text/javascript">// <![CDATA[

    window.handleIFrameMessage = function(e) {var args =":");var iframe = document.getElementById("JotFormIFrame");if (!iframe)return;switch (args[0]) {case "scrollIntoView":iframe.scrollIntoView();break;case "setHeight" = args[1] + "px";break;}};if (window.addEventListener) {window.addEventListener("message", handleIFrameMessage, false);} else if (window.attachEvent) {window.attachEvent("onmessage", handleIFrameMessage);}

    // ]]></script>


    Any ideas how I can resolve this problem? Thanks in advance.

  • Profile Image
    Answered on November 25, 2014 at 08:31 AM


    From your original post here where you have created this custom solution, can you please double check if the plugin insert PHP is working?


    that can be the possible cause why the PHP code is no longer executing within your WP page.

    Hope this help. Please update us if still not resolve.




  • Profile Image
    Answered on November 26, 2014 at 04:05 AM

    You're the man Jonathan!