Hello, Everyone. Brand new user here.
I’m working on a WordPress-based site which is based on the S2 Member Pro, BuddyPress and GeoDirectory plugins. I’ve been working with the S2 developers, however, I think I might have surpassed their PHP support. That being said, I’m hoping I might get some insight from you all.
Basically, S2 allows for custom post types. My site has several categories and I’m planning to offer four types of membership levels in each category. I’ve created an S2-based page which allows for multiple forms. I’m trying to pass along a category attribute which the page will “remember” when a member chooses their membership level. Both the category and membership forms are taking place on the same page. Basically, the member will choose which category they wish to post their directory listing to and hit “submit.” Upon submission, the form will keep their category level and the member will then choose which membership level to join. So, a member might choose “category1” and then choose “category1_enhanced” for an enhanced listing within the Category #1 section. Then, when the member pays they are redirected back to their BuddyPress profile page where there will be a dynamic link to allow the member to submit a “category1_enhanced” level listing. This is all working as should be expected, however, except I cannot get the dynamic membership level to pass along to the sign up form.
Here’s my code:
[code]<?php
session_start();
$category = array();
if(isset($_POST[‘buttons’])) {
foreach($_POST as $key => $value) {
$category[$key][$value] = “checked”;
}
} elseif(isset($_SESSION[‘category’])) {
$category = $_SESSION[‘category’];
}
echo ‘<form method=“post” action=’.$_SERVER[‘php_self’].’>
';
echo '<input type=“radio” name=“buttons” value =“Brewery” ‘.$category[‘buttons’][Brewery].’ >Brewery
';
echo '<input type=“radio” name=“buttons” value =“Cidery” ‘.$category[‘buttons’][Cidery].’ >Cidery
';
echo '<input type=“radio” name=“buttons” value =“Winery” ‘.$category[‘buttons’][Winery].’ >Winery
';
echo ’
';
echo ’
';
echo '[s2Member-Pro-Stripe-Form register=“1” level=“0” ccaps="<?php echo esc_attr($category); ?>_free" desc=“Basic <?php echo esc_attr($category); ?> - Free!” custom=“www.cheersva.org” tp=“0” tt=“D” captcha=“clean” /]
';
$_SESSION[‘category’] = $category;
?>[/code]
As you can see, if a member selects “Brewery,” that value should pass along to the ccaps function which sets the listing level at brewery_free and also dynamically prints the “Basic Brewery - Free!” title. When I change the radio buttons and click the button, the page successfully refreshes and keeps the focus on the newly selected radio button, however, the ccaps and title never populate.
I think my issue lies at the echo statement where I’m using esc_attr. I also attempted $_POST and print but to no avail.
If anyone has any insight on what I’m doing wrong, I’d appreciate it.
Thanks much, in advance!
Regards,
Kory