There are certain forms that I don't want people to fill out if they're not logged in, so I've put this in as the function for the gform_pre_render_{id} filter:
function need_login_filter($form)
{
if(!is_user_logged_in()) {
$newForm=array(
'title' => 'You need to log in',
'description' => 'You have to log in to access this item'
)
);
$form=$newForm;
}
return $form;
}
Which works great for putting up my message, but the submit button is still there. I added 'button' rules to the form object, but when I do, the whole form disappears (including my changed text):
$newForm=array(
'title' => 'You need to log in',
'description' => 'You have to log in to access this item',
'button' => array(
'conditionalLogic' => array(
'actionType' => 'show',
'logicType' => 'all',
'rules' => array(
'fieldId' => 0,
'operator' => 'isnot',
'value' => 'jibberish'
)
)
)
);
So what's the best way to go about doing this? I could wrap it in a shortcode to hide the form based on membership, but I've got a few other things set up that require me to take care of this internal to GravityForms.