@@ -614,6 +614,45 @@ function profile_admin_delete($fid) {
}
}
functionprofile_search($op='search',$keys=null){
switch($op){
case'name':
if(user_access('access user profiles')){
returnt('users');
}
case'search':
if(user_access('access user profiles')){
$find=array();
// Replace wildcards with MySQL/PostgreSQL wildcards.
$keys=preg_replace('!\*+!','%',$keys);
if(user_access('administer users')){
// administrators don't have restrictions
$result=pager_query("SELECT u.* FROM {users} u INNER JOIN {profile_values} pv ON u.uid = pv.uid WHERE LOWER(pv.value) LIKE LOWER('%%%s%%') OR LOWER(u.name) LIKE LOWER('%%%s%%')",15,0,NULL,$keys,$keys);
}
else{
// non-administrators can only search public fields and active users
$result=pager_query("SELECT u.* FROM {users} u INNER JOIN {profile_values} pv ON u.uid = pv.uid INNER JOIN {profile_fields} pf ON pv.fid = pf.fid WHERE ((LOWER(pv.value) LIKE LOWER('%%%s%%') AND pf.visibility IN (%d, %d)) OR LOWER(u.name) LIKE LOWER('%%%s%%')) AND u.status = 1",15,0,NULL,$keys,PROFILE_PUBLIC,PROFILE_PUBLIC_LISTINGS,$keys);
@@ -614,6 +614,45 @@ function profile_admin_delete($fid) {
}
}
functionprofile_search($op='search',$keys=null){
switch($op){
case'name':
if(user_access('access user profiles')){
returnt('users');
}
case'search':
if(user_access('access user profiles')){
$find=array();
// Replace wildcards with MySQL/PostgreSQL wildcards.
$keys=preg_replace('!\*+!','%',$keys);
if(user_access('administer users')){
// administrators don't have restrictions
$result=pager_query("SELECT u.* FROM {users} u INNER JOIN {profile_values} pv ON u.uid = pv.uid WHERE LOWER(pv.value) LIKE LOWER('%%%s%%') OR LOWER(u.name) LIKE LOWER('%%%s%%')",15,0,NULL,$keys,$keys);
}
else{
// non-administrators can only search public fields and active users
$result=pager_query("SELECT u.* FROM {users} u INNER JOIN {profile_values} pv ON u.uid = pv.uid INNER JOIN {profile_fields} pf ON pv.fid = pf.fid WHERE ((LOWER(pv.value) LIKE LOWER('%%%s%%') AND pf.visibility IN (%d, %d)) OR LOWER(u.name) LIKE LOWER('%%%s%%')) AND u.status = 1",15,0,NULL,$keys,PROFILE_PUBLIC,PROFILE_PUBLIC_LISTINGS,$keys);
$form['user_block_seconds_online']=array('#type'=>'select','#title'=>t('User activity'),'#default_value'=>variable_get('user_block_seconds_online',900),'#options'=>$period,'#description'=>t('A user is considered online for this long after they have last viewed a page.'));
$form['user_block_max_list_count']=array('#type'=>'select','#title'=>t('User list length'),'#default_value'=>variable_get('user_block_max_list_count',10),'#options'=>drupal_map_assoc(array(0,5,10,15,20,25,30,40,50,75,100)),'#description'=>t('Maximum number of currently online users to display.'));
$form['user_block_seconds_online']=array('#type'=>'select','#title'=>t('User activity'),'#default_value'=>variable_get('user_block_seconds_online',900),'#options'=>$period,'#description'=>t('A user is considered online for this long after they have last viewed a page.'));
$form['user_block_max_list_count']=array('#type'=>'select','#title'=>t('User list length'),'#default_value'=>variable_get('user_block_max_list_count',10),'#options'=>drupal_map_assoc(array(0,5,10,15,20,25,30,40,50,75,100)),'#description'=>t('Maximum number of currently online users to display.'));