Show posts in overvieuw sorted by Form

This topic contains 2 reply and 2 voices, and was last updated by MDelcour 11 years, 4 months ago
Viewing 2 Posts - 1 through 2 (of 2 total)
Author Posts
July 12, 2013 at 2:56 pm 5905
MDelcour I have a question about the overvieuw page of the users where they can edit/delete/see their posts. Ain't it a good idea to show posts sorted by which forms they were published with. So if I have form1 and form2 and I want to see only posts made by form1. Is there already a solution for this?
July 12, 2013 at 3:29 pm 5908
Tareq Hasan Tareq Hasan

The isn’t any direct solution for this, but you could use filters to achieve sorting.

[php]
function wpufe_dashboard_post_type( $args ) {
if ( $args[‘post_type’] == ‘something_unique’ ) {
$args[‘post_type’] = ‘post’;
$args[‘meta_query’] = array(array(
‘key’ => ‘_wpuf_form_id’,
‘value’ => ‘6’
));
}

return $args;
}

add_filter( ‘wpuf_dashboard_query’, ‘wpufe_dashboard_post_type’ );
[/php]

You might add a unique post type name, then check the post type and set the correct post type again (if you want post to be filtered out based on different form id). Then add a meta query and placing the form ID will filter your posts using that form id.

July 12, 2013 at 4:17 pm 5909
MDelcour MDelcour

Hello Tareq, Thank you again for your great solution! I’ll go and try this out.
I’ll let you know.

Viewing 2 Posts - 1 through 2 (of 2 total)