Hi,
(form 1)
I have a form (open to public) for people to publish their home removal requests. I set default status to draft. So I can check it before it is live.
(form 2)
I have another form for people who wants to be a site member. Simple registration form.
What I want is ; if someone register and become a member first, they should be able to use (form 1) and publish it immediately. (dynamically change post status to publish for registered users)
I guess that I need a piece of custom code for this… I checked around but couldn’t find something similar. Sorry… I am not good at playing with codes and creating my custom solution. Could you please help?
thanks a lot in advance…




October 9, 2012 at 10:17 am
Try this bit of custom code. You need to add this to your theme's functions.php file or to a new plugin.
add_filter('frm_get_default_value', 'my_custom_default_value', 10, 2);function my_custom_default_value($new_value, $field){
if($field->id == 25 and is_user_logged_in() and !is_admin()){ //change 25 to the ID of the field
$new_value = 'publish';
}
return $new_value;
}
This code should automatically change the default value of your "status" field to "publish" for users who are logged in. Be sure to swap out the 25 for the field ID of your status field.
Topic closed.