Well with little bit of struggle I think I found a solution. It seems to work for me.
Make following changes in WordSearch plugin.
Instead of
# ===
my $sb = $home->{cgi}->{sb};
my $so = $home->{cgi}->{so} || 'ASC';
my $mh = $home->{cgi}->{mh} || 25;
my $nh = $home->{cgi}->{nh} || 1;
my $bg = ($nh == 1) ? 0 : ($nh - 1) * $mh;
my $lm = "LIMIT $bg, $mh";
# Do the search and count the results.
my $sth = $home->{db}->select($cond) or return $home->search_form($GT::SQL::error);
my $hits = $sth->rows;
( $sb ) ? $home->{db}->select_options("ORDER BY $sb $so", $lm) : $home->{db}->select_options($lm);
$sth = $home->{db}->select($cond) or return $home->search_form($GT::SQL::error);
# ===
Use the following
# ===
# Start of mod - to ensure view_own_only works
# creating another Condition Object as WordSearch is a OR condition object
# $totalcond is a AND condition which will be ANDed with OR
my $totalcond = new GT::SQL::Condition('AND');
$totalcond->add($cond);
# Check if users can view only their own record
if ($home->{cfg}->{'auth_view_own'} and $home->{cfg}->{'auth_user_field'}) {
$totalcond->add($home->{cfg}->{'auth_user_field'},'=', "$home->{user}->{'Username'}");
}
# End
my $sb = $home->{cgi}->{sb};
my $so = $home->{cgi}->{so} || 'ASC';
my $mh = $home->{cgi}->{mh} || 25;
my $nh = $home->{cgi}->{nh} || 1;
my $bg = ($nh == 1) ? 0 : ($nh - 1) * $mh;
my $lm = "LIMIT $bg, $mh";
# Do the search and count the results.
my $sth = $home->{db}->select($totalcond) or return $home->search_form($GT::SQL::error);
my $hits = $sth->rows;
( $sb ) ? $home->{db}->select_options("ORDER BY $sb $so", $lm) : $home->{db}->select_options($lm);
$sth = $home->{db}->select($totalcond) or return $home->search_form($GT::SQL::error);
# ===
Plugin worked with this change, now it shows only records created by the user.
Make following changes in WordSearch plugin.
Instead of
# ===
my $sb = $home->{cgi}->{sb};
my $so = $home->{cgi}->{so} || 'ASC';
my $mh = $home->{cgi}->{mh} || 25;
my $nh = $home->{cgi}->{nh} || 1;
my $bg = ($nh == 1) ? 0 : ($nh - 1) * $mh;
my $lm = "LIMIT $bg, $mh";
# Do the search and count the results.
my $sth = $home->{db}->select($cond) or return $home->search_form($GT::SQL::error);
my $hits = $sth->rows;
( $sb ) ? $home->{db}->select_options("ORDER BY $sb $so", $lm) : $home->{db}->select_options($lm);
$sth = $home->{db}->select($cond) or return $home->search_form($GT::SQL::error);
# ===
Use the following
# ===
# Start of mod - to ensure view_own_only works
# creating another Condition Object as WordSearch is a OR condition object
# $totalcond is a AND condition which will be ANDed with OR
my $totalcond = new GT::SQL::Condition('AND');
$totalcond->add($cond);
# Check if users can view only their own record
if ($home->{cfg}->{'auth_view_own'} and $home->{cfg}->{'auth_user_field'}) {
$totalcond->add($home->{cfg}->{'auth_user_field'},'=', "$home->{user}->{'Username'}");
}
# End
my $sb = $home->{cgi}->{sb};
my $so = $home->{cgi}->{so} || 'ASC';
my $mh = $home->{cgi}->{mh} || 25;
my $nh = $home->{cgi}->{nh} || 1;
my $bg = ($nh == 1) ? 0 : ($nh - 1) * $mh;
my $lm = "LIMIT $bg, $mh";
# Do the search and count the results.
my $sth = $home->{db}->select($totalcond) or return $home->search_form($GT::SQL::error);
my $hits = $sth->rows;
( $sb ) ? $home->{db}->select_options("ORDER BY $sb $so", $lm) : $home->{db}->select_options($lm);
$sth = $home->{db}->select($totalcond) or return $home->search_form($GT::SQL::error);
# ===
Plugin worked with this change, now it shows only records created by the user.