Support Forum
Support › MB User Profile › Profile pages using MB User Profile and Meta Box - Beaver Themer Integrator
Hello Jan,
Here is my screen record so that you can understand how the conditional logic works with other elements on the same page https://drive.google.com/file/d/1-jelzCptVwMPl_8p186pni4d9P4lTjUl/view?usp=sharing
You can wrap the quform
shortcode in a div with a specific ID and use the ID in the conditional logic code.
add_filter( 'rwmb_outside_conditions', function( $conditions ) {
$conditions['#quform-1'] = array(
'visible' => ['#select_operations', 'drc_other'],
);
$conditions['#quform-14'] = array(
'visible' => ['#select_operations', 'zimbabwe_other'],
);
$conditions['#quform-13'] = array(
'visible' => ['#select_operations', 'zimbabwe_todal'],
);
$conditions['#quform-12'] = array(
'visible' => ['#select_operations', 'zimbabwe_ccih_sabot'],
);
return $conditions;
} );
You can change form 1
form 14
with the shortcode on your site and put the code anywhere on the same page.
<div id="quform-1">form 1</div>
<div id="quform-14">form 14</div>
<div id="quform-13">form 13</div>
<div id="quform-12">form 12</div>
Note: the select option value should be in lowercase, no space, like this
drc_metalkol: Drc - Metalkol
drc_other: Drc - Other
mali_all: Mali - All
mauritius_all: Mauritius - All
mozambique_all: Mozambique - All
south_africa_emsa: South Africa - Emsa
south_africa_sabot: South Africa - Sabot
south_africa_other: South Africa - Other
zambia_chambishi: Zambia - Chambishi
zambia_sabot: Zambia - Sabot
zambia_other: Zambia - Other
zimbabwe_ccih_sabot: Zimbabwe – Ccih (Sabot)
zimbabwe_todal: Zimbabwe – Todal
zimbabwe_other: Zimbabwe – Other
Hi Peter
Thank you so much for your help. I applied your code see below to profile page and theme functions page. The problem is all the form are appearing not just the ones I have selected :
So for example on the profile demo page, under selected operations, there is “ Drc – Other, Zimbabwe – Ccih (Sabot), Zambia – Sabot, Drc - Metalkol” only those need to show up as only they were selected in the registration form when signing up, not all the forms.
Profile page
<div id="quform-1">[quform id="1" name="DRC Other"]</div>
<div id="quform-2">[quform id="2" name="DRC Metalkol"]</div>
<div id="quform-3">[quform id="3" name="Mali"]</div>
<div id="quform-4">[quform id="4" name="Mauritius"]</div>
<div id="quform-5">[quform id="5" name="Mozambique"]</div>
<div id="quform-6">[quform id="6" name="South Africa EMSA"]</div>
<div id="quform-7">[quform id="7" name="South Africa Sabot"]</div>
<div id="quform-8">[quform id="8" name="South Africa Other"]</div>
<div id="quform-9">[quform id="9" name="Zambia Chambishi"]</div>
<div id="quform-10">[quform id="10" name="Zambia Sabot"]</div>
<div id="quform-11">[quform id="11" name="Zambia Other"]</div>
<div id="quform-12">[quform id="12" name="Zimbabwe CCIH"]</div>
<div id="quform-13">[quform id="13" name="Zimbabwe Todal"]</div>
<div id="quform-14">[quform id="14" name="Zimbabwe Other"]</div>
I added the following code to my theme functions file :
add_filter( 'rwmb_outside_conditions', function( $conditions ) {
$conditions['#quform-1'] = array(
'visible' => ['#select_operations', 'drc_other'],
);
$conditions['#quform-2'] = array(
'visible' => ['#select_operations', 'drc_metalkol'],
);
$conditions['#quform-3'] = array(
'visible' => ['#select_operations', 'mali_all'],
);
$conditions['#quform-4'] = array(
'visible' => ['#select_operations', 'mauritius_all'],
);
$conditions['#quform-5'] = array(
'visible' => ['#select_operations', 'mozambique_all'],
);
$conditions['#quform-6'] = array(
'visible' => ['#select_operations', 'south africa_emsa'],
);
$conditions['#quform-7'] = array(
'visible' => ['#select_operations', 'south africa_sabot'],
);
$conditions['#quform-8'] = array(
'visible' => ['#select_operations', 'south africa_other'],
);
$conditions['#quform-9'] = array(
'visible' => ['#select_operations', 'zambia_chambishi'],
);
$conditions['#quform-10'] = array(
'visible' => ['#select_operations', 'zambia_sabot'],
);
$conditions['#quform-11'] = array(
'visible' => ['#select_operations', 'zambia_other'],
);
$conditions['#quform-12'] = array(
'visible' => ['#select_operations', 'zimbabwe _ccih_sabot'],
);
$conditions['#quform-13'] = array(
'visible' => ['#select_operations', 'zimbabwe_todal'],
);
$conditions['#quform-14'] = array(
'visible' => ['#select_operations', 'zimbabwe _other'],
);
return $conditions;
} );
Hi Peter
I also just wanted to add these select are from the multiselect fields ( advanced select) not a dropdown as show in your screen cast example.
OK I seem to have found a work around, but now I am battle with one last issue, when a registration form is filled in on the front end none of the fields are pulling through and saving on the back end. Not the standard user fields or the custom fields added. only the username and password is saved.
Maybe it s because I have created a custom user type " vendor". But i have check that is the default registration type and i created the role using a plugin "user role editor"
PLEASE HELP
Hello Jan,
Let me check that issue on your site.
I've removed the condition in "Advanced location rules" (MB Include Exclude) to fix this issue. Screenshot https://monosnap.com/file/ZcVNJfH7e3zBrhHzZuGScV4U01G8GW
Hi Peter
Thank you so much it finally works, just 2 more little favour please.
1) styling the registration form, how do I make the fields side by side and also the check boxes.
2) Then with the checkboxes is it possible for the check to appear inline before the text
Hello Jan,
1. To display fields side by side, you can use the extension Meta Box Columns, please read more on the documentation https://docs.metabox.io/extensions/meta-box-columns/
2. I think it is not difficult with some CSS code, you can contact your developer to ask for help with this issue.
Hi Peter
I used Meta Box Columns for the middle part of the form. The beginning is generated by WordPress. The end part with the check boxes can be put into groups and it looks fin on the form part, but then the information does not pull through onto the profile page.
I must also express my disappointment, I have asked multiple times for a small live session to explain things and speeds the project up and you agreed but have never shown up 🙁
Hello Jan,
Sorry about the live session, it is also beyond our scope of support. I recommend contacting our Key Master Anh Tran if he allows providing this kind of support. Thanks for your understanding and patience.
Regarding the issue "then the information does not pull through onto the profile page", I see you've confirmed it works above. Does it not work for now?