Tips and Tricks HQ Support Portal › Forums › WP eMember › WP eMember Troubleshooting › Shortcode within another Shortcode
Tagged: shortcode, shortcode within shortcode
- This topic has 9 replies, 3 voices, and was last updated 12 years ago by admin.
-
AuthorPosts
-
October 30, 2012 at 5:22 am #7786BjeddMember
I am attempting to put a shortcode within a shortcode, but not sure how that would be implemented. In the theme I am using, it already has a shortocode for a button link, e.g.- [button_link url=”/the/path/to/my/permalink” class=”popup” style=”impactBtn”] [wp_eMember_login] [/button_link] This works, but it displays the eMember login form rather than being called on click from the button. Is there a way to call the [wp_eMember_login] directly from within the other shortocde?
October 31, 2012 at 3:03 am #50886adminKeymasterThis will depend on the capability of this other shortcode and it was implemented. Shortcode nesting only works if both the shortcodes are implemented using WordPress’s shortcode API. eMember’s shortcode is implemented using the WP Shortcode API but I don’t know how the other shortcode (the one from your theme) is implemented.
With that said, what is that other shortcode suppose to do? From the shortcode itself, it looks like it create a button link? I am not sure how you can place a login form inside a button link.
You can try playing with the shortcode filtering priority to see if that helps:
November 2, 2012 at 3:36 pm #50887BjeddMemberYes, the other shortcode is supposedly compatible with the WordPress API. But that shortcode just creates a button with the a link – href=”” , and I can’t figure out anyway to call another shortcode through that method because the API won’t allow. I could set a graphic button, but that won’t help to call the shortcode. I have tried playing with the filtering, but that did not seem to change anything because the second shortocde appears at the same time as the button shortcode. Does this mean the button shortcode is not following the API?
I am wondering if the eMember shortcode could be used in some other way with say the wp_lightbox_ulitmate?
November 3, 2012 at 4:34 am #50888adminKeymasterYou are probably going about it the wrong way. Please tell me what you are trying to achieve (what is your final goal?) so I can see if there is a way to do that.
November 4, 2012 at 9:50 pm #50889BjeddMemberI probably am and appreciate your take. My goal is to create a popup with eMember Login on the homepage that occurs within another shortcode (a button). The theme does not have an easy way to place a widget area so I can’t use the eMember popup widget. The button just needs to call the eMember Login as a popup. The theme shortcode creates a button or button link. The button that needs to call the eMember popup is here titled “Current Member Login”: and the button is labeled “Login”:. Here’s the link: [http://www.lifepurposeinstitute.com/alumni/]
Currently I am loading the eMember login page as an iframe to accomplish the task, but a strange thing is happening as soon as I click into one of the input fields it automatically submits and gets a 404 error: “The page you are looking for could not be found.”.
Thanks for you help.
November 4, 2012 at 10:29 pm #50890nurMemberhi,
actually this was not designed to work with iframe. to make it work in iframe, i think the follow fix is gonna be just enough:
open eMember_auth_utils.php and go to line #436 and do the following replacement:
replace ( line 436 to 445 inclusive)
Code:$emember_auth = Emember_Auth::getInstance();
$emember_config = Emember_Config::getInstance();$msg = $emember_auth->getSavedMessage(‘eMember_login_status_msg’);
$state_code = $emember_auth->getSavedMessage(‘eMember_login_status_code’);
$join_url = $emember_config->getValue(‘eMember_payments_page’);
$eMember_multiple_logins = $emember_config->getValue(‘eMember_multiple_logins’);
ob_start();
?>
<form action=”” method=”post” class=”loginForm wp_emember_loginForm” name=”wp_emember_loginForm” id=”wp_emember_loginForm” >with
Code:$emember_auth = Emember_Auth::getInstance();
$emember_config = Emember_Config::getInstance();
$login_url = $emember_config->getValue(‘login_page_url’);
$login_url = empty($login_url)? get_site_url():$login_url;
$msg = $emember_auth->getSavedMessage(‘eMember_login_status_msg’);
$state_code = $emember_auth->getSavedMessage(‘eMember_login_status_code’);
$join_url = $emember_config->getValue(‘eMember_payments_page’);
$eMember_multiple_logins = $emember_config->getValue(‘eMember_multiple_logins’);
ob_start();
?>
<form action=”<?php echo $login_url;?>” method=”post” class=”loginForm wp_emember_loginForm” name=”wp_emember_loginForm” id=”wp_emember_loginForm” >thanks
November 5, 2012 at 4:34 am #50891BjeddMemberSorry, but I am not seeing the same code. Here is what I have from line 441-450: from eMember Version v8.2.4
$emember_auth = Emember_Auth::getInstance();
$emember_config = Emember_Config::getInstance();
$msg = $emember_auth->getSavedMessage(‘eMember_login_status_msg’);
$state_code = $emember_auth->getSavedMessage(‘eMember_login_status_code’);
$join_url = $emember_config->getValue(‘eMember_payments_page’);
ob_start();
?>
<form action=”” method=”post” class=”loginForm wp_emember_loginForm” name=”wp_emember_loginForm” id=”wp_emember_loginForm” >
<?php wp_nonce_field(’emember-login-nonce’); ?>
November 6, 2012 at 2:41 am #50892adminKeymasterYou only need to change the following line I think:
<form action=”” method=”post” class=”loginForm wp_emember_loginForm” name=”wp_emember_loginForm” id=”wp_emember_loginForm” >
Change the above to the following:
<form action=”<?php echo $_SERVER[“REQUEST_URI”]; ?>” method=”post” class=”loginForm wp_emember_loginForm” name=”wp_emember_loginForm” id=”wp_emember_loginForm” >
November 6, 2012 at 3:22 am #50893BjeddMemberI replaced the form action code as suggested, but it does not seem to have any affect. I still get an Error 404 after clicking in either of the input fields.
November 6, 2012 at 5:01 am #50894adminKeymasterIt was worth a try. It won’t work the way you have it with that other shortcode unfortunately. You will need to make the button link to the eMember’s login page.
-
AuthorPosts
- You must be logged in to reply to this topic.