Skip Navigation

[Resolved] When I place a Custom Search Filter I cannot select USER.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 17 replies, has 2 voices.

Last updated by Minesh 1 year, 4 months ago.

Assisted by: Minesh.

Author
Posts
#2625613

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

But why you added the form to this page:
- hidden link
and
- hidden link

The workflow we discuss is the form you will create that will create child entry in one-to-many post relationship should be added to the single post of your parent - right? so that we can grab the parent post ID from your parent post and then based on that parent post ID we will get the parent post author.

#2625619

Okay, now it gets a bit more complicated. 🙂

I added an extra field (school name).
This could be a hidden field in which the USERNAME is automatically filled in.

So that the site visitor can search by USERNAME

Can the forms not be placed on these pages?
FYI, it's 2 forms for posting 2 types of posts.

#2625631

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've added the following code to "Custom Code" section offered by Toolset:
- hidden link

add_action('cred_save_data','func_save_user_name_to_schoolnaam', 10, 2);
function func_save_user_name_to_schoolnaam($post_id, $form_data){
    // if a specific form
	global $current_user;
	
	$forn_ids = array(1095,1033);
	
    if (in_array($form_data['id'],$forn_ids)){
		
		update_post_meta($post_id,'wpcf-schoolnaam',$current_user->user_login); 
        
    }
}

As you can see we are updating the "schoolnaam" custom field value with the current user login.

Now, when you submit the form the "schoolnaam" custom field value will be automatically filled.

Note: I've removed the custom field "schoolnaam" you added to your form as its not required and the "schoolnaam" custom field value will be automatically filled using "cred_save_data" hook.

#2625649

Very happy with your help!!!
Have a nice day!