Disable user name auto complete if people cloud is deactivated for guest user
This commit is contained in:
parent
714d6730ae
commit
5f5cd93114
@ -229,21 +229,23 @@ class photoannotation_Controller extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function autocomplete() {
|
public function autocomplete() {
|
||||||
$users = array();
|
if (!identity::active_user()->guest || module::get_var("photoannotation", "allowguestsearch", false)) {
|
||||||
$user_parts = explode(",", Input::instance()->get("q"));
|
$users = array();
|
||||||
$limit = Input::instance()->get("limit");
|
$user_parts = explode(",", Input::instance()->get("q"));
|
||||||
$user_part = ltrim(end($user_parts));
|
$limit = Input::instance()->get("limit");
|
||||||
$user_list = ORM::factory("user")
|
$user_part = ltrim(end($user_parts));
|
||||||
->where("name", "LIKE", "{$user_part}%")
|
$user_list = ORM::factory("user")
|
||||||
->or_where("full_name", "LIKE", "{$user_part}%")
|
->where("name", "LIKE", "{$user_part}%")
|
||||||
->order_by("full_name", "ASC")
|
->or_where("full_name", "LIKE", "{$user_part}%")
|
||||||
->limit($limit)
|
->order_by("full_name", "ASC")
|
||||||
->find_all();
|
->limit($limit)
|
||||||
foreach ($user_list as $user) {
|
->find_all();
|
||||||
if ($user->name != "guest") {
|
foreach ($user_list as $user) {
|
||||||
$users[] = $user->display_name() ." (". $user->name .")";
|
if ($user->name != "guest") {
|
||||||
|
$users[] = $user->display_name() ." (". $user->name .")";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
print implode("\n", $users);
|
||||||
}
|
}
|
||||||
print implode("\n", $users);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user