Support Forum

 
You must be logged in to post
Search Forums:


 






Wildcard Usage:
*    matches any number of characters
%    matches exactly one character

Change form element based on user role??

Information/How to
UserPost

5:21 am
April 13, 2010


danskinner

1

Hello again,

I'm currently using pro to design an rsvp for a wedding website. I'm adding all invitees as wordpress users but only half are being invited to the ceremony.

I've setup a couple of custom roles (via the Capability Manager/Role Scoper plugins – both based on Contributor) 'quest_reception' & 'guest_ceremony' which I plan to assign to each user as I set them up.

What I'd then like to do is have the rsvp form pick up the role of the user filling it in and display a different dropdown list question depending if they are invited to the ceremony or just reception.

I've toyed with the idea of having 2 rsvp forms and then using my sidebar login widget to redirect people to the appropriate form based on their role, but I'd rather not have all rsvp data collected across 2 results pages (although I could probably recombine with a custom report?)

I could also potentially use another profile field (eg. put a 1 or 0 in the "AIM username" for example) which I would hide so they never see but which could potentially be used to drive some differential form behaviour if Formidable is able to read such data??

Based on your intimate knowledge of Formidable I'm really just looking foir ideas around it's capabilities to support this – and if possible, how you'd go about do it.

Thanks in advance :)

Dan

10:32 pm
April 28, 2010


Steph

2

Do you still need this? Sorry this one has taken me so long. I have an answer now though. I think the easiest way is to change the field to a hidden field if the user shouldn't see it. You could unlock the field keys on the Formidable -> Settings page, and set the field key for the ceremony-only fields to 'ceremony_something' (just make sure there is a 'ceremony_' in front). You could add this into your theme functions file or a new plugin. This will need some specific tweaking, but this should get you started.

add_filter('frm_field_type', 'change_type', 15, 2);
function change_type($type, $field){
  if(strncmp($field->field_key, 'ceremony_', 9) and current_user_can('level_8') and !is_admin())
    $type = 'hidden';

  return $type;
}

Information/How to