Gary Mendoza
Gary Mendoza

Reputation: 11

How to pass a field from a Wordpress plugin into an iframe

I have just installed Paid memberships Pro plugin and I want to pass a field into an iframe. Below is one of a number of attempts and what the subsequent source code looks like. I don't know if the issue is being caused by the fact that the PMP field also requires quotes or I am getting the syntax wrong. I have tried with quotes in the correct place (I think) see below:

<iframe src="https://www.************.com/assessment/****?email=[pmpro_member field=‘user_email']&fname=[pmpro_member field=‘first_name']&lname=[pmpro_member field=‘last_name']" style="width:100%; height:1000px;"></iframe>

I don't seem to be able to find any examples of anyone doing this (maybe you can't)? If I put the PMP shortcode ([pmpro_member field="user_email”] directly into the HTML on a page then it picks up the correct email so I know this works. I can’t get it to pass this into the iframe though. I’m new to all this so any pointers would be appreciated.

HTML in WP page:

<iframe src='https://www.****************.com/assessment/****?email=[pmpro_member field="user_email”]' style="width:100%; height:1000px;"></iframe>

Source code:

<p><iframe src='https://www.************.com/assessment/****?email=[pmpro_member field="user_email”]' style="width:100%; height:1000px;"></iframe></p>

Upvotes: 0

Views: 69

Answers (2)

Gary Mendoza
Gary Mendoza

Reputation: 11

Hi I have managed to resolve this issue by using the 'advanced iframe pro' plugin (paid version). This allows you to take fields from the users profile and pass them into the iframe on another URL. Here is the HTML I used: [advanced_iframe src="//www.***************.com/assessment/****?fname={usermeta-first_name}&lname={usermeta-last_name}&email={usermeta-nickname}" width="100%" height=1100px"] This picks up the first and last name and nickname.

Upvotes: 1

flaxon
flaxon

Reputation: 942

assuming you use it in the code, you will need to use the wp function do_shortcode

<iframe src="https://www.****************.com/assessment/****?email=<?php echo do_shortcode( '[pmpro_member field="user_email”]' ); ?>" style="width:100%; height:1000px;"></iframe>

if you use the editer you will need to enable shortcodes in iframe tag

look here for more info https://codex.wordpress.org/Function_Reference/wp_kses_allowed_html

Upvotes: 0

Related Questions