Forum Replies Created
-
AuthorPosts
-
Heizpad
ParticipantHi 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!
Heizpad
ParticipantHi 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!
Heizpad
ParticipantWorks perfectly without any issues so far, thank you very much again!
Heizpad
ParticipantHi 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
-
AuthorPosts