Tell us what you are trying to do?
I am trying to pre-filter the toolset blocks search filters based on the logged in users advanced custom fields associated with a user account. I am not sure where to start if perhaps using a toolset shortcut method would work or using something else like wpv_filter_query.
Are there any documentation or other user support requests related to this I could reference?
Rough example:
add_filter('wpv_filter_query', 'filter_toolset_denomination_dropdown_based_on_user_profile', #, #);
function filter_toolset_dropdown_based_on_user_profile_denomination($query_args, $view_settings, $example_view_id) {
if (is_user_logged_in()) {
// Get the current user
$current_user = wp_get_current_user();
// Not too sure what to do here
$query_args['meta_query'] = array(
array(
'key' => 'denomination',
'value' => $user_denomination,
//some action like : compare
)
);
}
Hello. Thank you for contacting the Toolset support.
We will require bit more information.
Do you mean that you have a user custom field "user_denomination" and you created the post type view using the blocks and based on the loggedin user's "user_denomination" custom field value you want to filter the custom post type posts.
If this is true I will require to check how exactly the value stored by "user_denomination" and with what postmeta key.
Please correct me if I'm wrong and send me problem URL where you are trying to display the view as well as admin access details.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
The topic ‘[Closed] Pre-Filter drop down fields based on logged in user custom fields’ is closed to new replies.