This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • in reply to: Disabled pages and posts shown in search results #41444
    HeizpadHeizpad
    Participant

    Hi again.

    Thanks for that link, but I don’t want to completely disable keyword suggestions. I just want to remove suggestions from pages and posts that an user has no access to.

    For example I have a page with the title “Membership only page” and access to this page is blocked via Digimember for all users that have no membership.

    When I, as a user without a membership, start typing “Member” it will automatically suggest me in the input bar “Membership only page” but of course return no results in the live results.

    Could you please provide a code to also remove those type of search suggestions?

    Thank you a lot again!

    in reply to: Disabled pages and posts shown in search results #41441
    HeizpadHeizpad
    Participant

    Hi Ernest,

    wow, thank you for your efforts.

    When I added your provided code my whole site crashed. Then I removed one closing brace and now it works. Just to make sure, I used this code instead:

    add_filter( 'asp_results', 'asp_digimember_access_filter', 10, 1 );
    function asp_digimember_access_filter( $results ) {
      foreach ($results as $k=>&$r) {
    	if ( isset($r->post_type) ) {
    		if ( digimember_currentUserAccessDenied($r->post_type, $r->id) )
    			unset($results[$k]);
    		}
      } 
      return $results;
    }

    Am I right with my assumption that in your code there was one brace too much?

    As I said, it works now and doesn’t return disabled search results. However, it still suggests me “Did you mean: ” and then search input suggestions for disabled pages are displayed. Is it possible to disable search suggestions for disabled pages and posts as well?

    Thank you a lot again for your help!

    in reply to: Show suggestions only when search is opened #40394
    HeizpadHeizpad
    Participant

    Works perfectly without any issues so far, thank you very much again!

    in reply to: Show suggestions only when search is opened #40368
    HeizpadHeizpad
    Participant

    Hi again!

    Thank you, I really appreciate your efforts here. However, when the input field is out of focus again the suggestions still stay there. Is it possible to remove them again once the user is out of focus?

    Thank you

Viewing 4 posts - 1 through 4 (of 4 total)