diff --git a/C4/Auth.pm b/C4/Auth.pm
index 9df309ebea..a006baa8d8 100644
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -449,7 +449,9 @@ sub get_template_and_user {
# Decide if the patron can make suggestions in the OPAC
my $can_make_suggestions;
- if ( C4::Context->userenv && C4::Context->userenv->{'number'} ) {
+ if ( C4::Context->preference('Suggestion') && C4::Context->preference('AnonSuggestions') ) {
+ $can_make_suggestions = 1;
+ } elsif ( C4::Context->userenv && C4::Context->userenv->{'number'} ) {
$can_make_suggestions = Koha::Patrons->find(C4::Context->userenv->{'number'})->category->can_make_suggestions;
}
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc
index fbab4ec2c9..c13f52f4dc 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc
@@ -329,7 +329,7 @@
Browse search
[% END %]
- [% IF Koha.Preference( 'suggestion' ) == 1 %]
+ [% IF suggestion %]
[% IF Koha.Preference( 'AnonSuggestions' ) == 1 || Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]
Purchase suggestions
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt
index c47962d22c..95fa8d6304 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt
@@ -549,7 +549,7 @@
[% END # / IF total %]
[%# Display "Not finding what you're looking for" for suggestion or ILL %]
- [% IF suggestion && ( Koha.Preference( 'AnonSuggestions' ) == 1 || loggedinusername ) || ( Koha.Preference( 'ILLModule' ) == 1 && loggedinusername ) %]
+ [% IF suggestion || ( Koha.Preference( 'ILLModule' ) == 1 && loggedinusername ) %]
Not finding what you're looking for?
diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl
index b6942d6753..dceae6c766 100755
--- a/opac/opac-suggestions.pl
+++ b/opac/opac-suggestions.pl
@@ -94,9 +94,11 @@ else {
}
# If suggestions are turned off, or this patron belongs to a category not allowed to make suggestions (suggestionPatronCategoryExceptions syspref) we redirect to 404 error. This will also redirect guest suggestions
-if ( !Koha::Patrons->find( $borrowernumber )->category->can_make_suggestions ) {
- print $input->redirect("/cgi-bin/koha/errors/404.pl");
- exit;
+if ( defined $borrowernumber && !C4::Context->preference('AnonSuggestions') ) {
+ if ( (!Koha::Patrons->find( $borrowernumber )->category->can_make_suggestions) ) {
+ print $input->redirect("/cgi-bin/koha/errors/404.pl");
+ exit;
+ }
}
my $suggested_by;