Skip Navigation

[Resolved] Using filter for checkbox not working . please see post #579822

This support ticket is created 7 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 14 replies, has 2 voices.

Last updated by Erik 7 years ago.

Assisted by: Shane.

Author
Posts
#580532
filter-view.jpg
field-cpt.jpg

Hi, please see the former post answered by Minesh #579822

His solution worked for the participants, but now the filter for the view where only the interested contestants should show does not work anymore.

I've added two pictures
How can I use the filter to show the, by checkbox, selected "interested" only in the view?

Best, Erik

URl hidden link

#580635

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Erik,

Thank you for contacting our support forum.

Could you link me to the post that Minesh assisted with? Unfortunately I can't find the post from that number you sent.

Thanks,
Shane

#580640
#580717

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Erik,

So to clarify you want to display your view filtered by both parameters correct?

Thanks,
Shane

#580816

Hello Shane,
There are 2 views.
1: view of participants (deelnemers). This one works fine after the function Minesh showed me. If the CPT field "Interested" has been selected this participant disappears from the view list.
2: view of interested (geinteresseerden). This is a copy from the first view with one exception: The filter for the CPT field "Interested". If this field has been selected, only these people will appear within this view. (at least, they should be).

So in fact there is only 1 parameter; the Checkbox field "interested"

Please let me know if you have enough information.
Best, Erik

#581286

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Erik,

Would you mind if I check this out further for you on the backend ?

The private fields will be enabled so that you can provide me with the credentials to the site.

Thanks,
Shane

#582153

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Erik,

Thanks,

I'm currently having a look for you.

#582154

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Erik,

I'm getting an Incorrect username.

Could you take a look at this for me and let me know.
Thanks,
Shane

#582247

Hello Shane,

I changed the password in the private message, please try again. I had no problem logging in.
Please try the on Causasus Rally. First you need to enable the extra tab in the rally itself.
Thanks!
Erik

#583711

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Erik,

I must apologize for the delay in response, however I'm looking for a post that will display the interested tab, could you send me a post that has that tab up so that I can have a look ?

Thanks,
Shane

#583921

Hi Shane,
The client asked me to disable the tab. I just enabled it again.
Please visit: hidden link tab: Interested.

From the participants tab I checked 3 participants as 'Interested' . They diasappeared from the tab 'Participants'. That is correct.
They now should appear under the tab "Interested."
Please see respons #580816 in this thread about the View.
Name of the View is : Deelnemers geinteresseerden ->2nd Query filter

Thanks!
Erik

#584634

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Erik,

It seems you might need to use taxonomies as a temporary workaround for the interested and not interested till I can test adequately the checkboxes because as it is right now it should work fine.

Please let me know if this helps.
Thanks,
Shane

#584734

Hi Shane, thank you for looking into this problem,

I managed to resolve the View for "interested" people by disabling the code (in functions.php) provided by Minesh.

VIEWS ADDING EXCEPTION FOR INTERESTED PARTICIPANTS

 add_filter( 'wpv_filter_query', 'func_not_checked_posts', 10, 3 );
function func_not_checked_posts( $query_args, $view_settings, $view_id ) {
    if($view_id = 67) {
       $query_args['meta_query'][] = array(
           'key'     => 'wpcf-geinteresseerde',
            'compare' => 'NOT EXISTS',
        );
    }
    return $query_args;
}

But unfortunately the, as "Interested" checked participant, is now visible again in the list (View) for Participants.
Maybe there the "wpcf-geinteresseerde" in this function also affects other views than the Participants view?

Best! Erik

#586941

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Erik,

So I've resolved this for you.

The main issue was that when you were telling the field to not save anything to the database when the user doesn't select the checkbox. This means that we were not able to evaluate a negative with our view.

However i've set the post group to save 0 to the database if the user doesn't select the option and now the Participants and the interests tabs work as intended.

Also you will need to go through and update the users by just clicking the update button on the post and they should start showing up. I used this rally here as a test hidden link

So as you can see its now displaying the relevant information.

Thanks,
Shane

#587020

Dear Shane,
Thank you for your help!
But with the new solution I had to alter 1000 participants one by one.

So I followed your first advice to use a taxonomy. Together with the plugin "Bulk Actions Select All" I managed to alter all the taxonomies in a few clicks.

Again, thank you for your time and help.
Erik