Unhide on front end Publishes not-approved Listings

When a user submits a listing, I manually approve it and publish it. But if I find an error, and change the status from Pending to Draft - the user can just log in and click “Unhide”, and the listing is published without without me ever approving it.

Hi,

Thanks for the feedback. Yes, in this version, draft status is also available to vendors, but we will try to improve this feature in future updates. We recommend keeping listings in pending status until we improve the workflow.

Also, as a temporary fix, we can provide you with a snippet to hide the hide option. Let us know if this works for you.

Hi,

I am also having this issue. @andrii Could we get the snippet to remove the Hide/Unhide functions? (completely disable it with code, not hide it with CSS). As you have said, it will be great to have this workflow improved.

Thank you.

 add_filter( 'hivepress/v1/templates/listing_edit_page/blocks', [ $this,  'alter_edit_listing_block' ], 20, 2 );

    function alter_edit_listing_block( $blocks, $template ) {
        $listing = $template->get_context('listing');
        // Hide/unhide logic
        if ( $listing ) {
            if (
                $edit_type == 'new_listing' &&
                isset($blocks['page_container']['blocks']['page_content']['blocks']['page_topbar']['blocks']['listing_actions_secondary']['blocks']['listing_hide_toggle'])
            ) {
                unset($blocks['page_container']['blocks']['page_content']['blocks']['page_topbar']['blocks']['listing_actions_secondary']['blocks']['listing_hide_toggle']);
            }
        }
        return $blocks;
    }

This snipped conditionally removes the hide/unhide toggle. Adjust it for your situation.

Needles to say, it needs to be fixed in the core.

Thank you for your assistance @JSHBV. But I am getting a critical error upon adding this code. :frowning:

You need to adjust it for your situation.

Remove $edit_type == 'new_listing' && and most likely it will work without errors, but it will remove the hide toggle under all circumstances including ligitimate ones.

Hi,

Please use this CSS snippet:

.hp-listing__action--hide {
	display: none;
}

You can add a CSS snippet using this doc: How to add custom code snippets - HivePress Help Center

I hope it helps