Skip Navigation

[Résolu] WordPress Archive filter by role

This support ticket is created Il y a 4 années et 9 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 6 réponses, has 2 voix.

Last updated by arisG Il y a 4 années et 9 mois.

Assisted by: Minesh.

Auteur
Publications
#1303601

Hello,

We have a WordPress Archive where we also get the pending post and we have the following code in the Loop section

[wpv-conditional if="( '[wpv-current-user info="role"]' eq 'administrator')"]     
        	<div class="[get_css_class]" >[wpv-post-body view_template="List View (Desktop)"]</div>
[/wpv-conditional]

[wpv-conditional if="( '[wpv-current-user info="role"]' ne 'administrator') AND ( '{!{wpv-post-status}!}' eq 'publish' )"]     
        	<div class="[get_css_class]" >[wpv-post-body view_template="List View (Desktop)"]</div>
        [/wpv-conditional]

So, if a user is Admin he can see the pending review posts, else only the published.

The above code works but if there are two pending review posts and the post per page is 10, the other roles can see only 8 posts.

How we can bypass this?

Thank you.

#1303635

Minesh
Supporter

Languages: Anglais (English )

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

Hello. Thank you for contacting the Toolset support.

Do you mean that you still wanted to display those two pending review posts to non-admin users or you have issue with something else?

#1303637

Hello,

if we have 3 pending review posts, a non admin user will not see the pending post but he will only see 7 published post in the list (10 pst per page) because from the 10 posts per page the 3 are not published (are hidden).

We want every time, any user gets 10 posts.

#1303653

Minesh
Supporter

Languages: Anglais (English )

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

Sorry but I still did not get you. If you do not display 3 pending review posts how it will display the 10 posts? Am I missing anything here.

#1305059

Hello Minesh,

the problem was the implementation. The user should always see 10 posts every time, even if pending post exist. Instead to hide posts we use pre_get_posts to filter the posts.

You can close the ticket.

Thank you

#1305079

Minesh
Supporter

Languages: Anglais (English )

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

ahh Ok. We are not allowed to close the ticket. Please, you can mark resolve this ticket.

#1305131

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.