1
kurak_bu
Profile ['hasSearch'] ?
  • 2009/9/27 18:32

  • kurak_bu

  • Quite a regular

  • Posts: 342

  • Since: 2005/9/5 1


Hello, is there any hack to make profiles (Profile module) searchable through /search.php ?

I am aware that /modules/profile/search.php exists however I would like to use just one search engine on site (google custom SE doesn't solve the issue)

//xoops 2.3.3

2
ghia
Re: Profile ['hasSearch'] ?
  • 2009/9/27 20:32

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


See this.
Be aware that permissions are to be verified in order not to disclose protected or priviliged data.

3
kurak_bu
Re: Profile ['hasSearch'] ?
  • 2009/9/27 20:57

  • kurak_bu

  • Quite a regular

  • Posts: 342

  • Since: 2005/9/5 1


Thank you for reply,
unfortunately, http://dev.xoops.org/modules/phpwiki/index.php/SearchFunction doesn't work.
To be honest I had hope that someone made such hack before. This might be be too hard for me but I'll try, thank you.

4
ghia
Re: Profile ['hasSearch'] ?
  • 2009/9/27 21:21

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Oops, a dead link.
Try this (in French).

5
kurak_bu
Re: Profile ['hasSearch'] ?
  • 2009/10/5 15:39

  • kurak_bu

  • Quite a regular

  • Posts: 342

  • Since: 2005/9/5 1


Here is code of my search.inc.php if anyone would like to use it (may contain vulnerabilities!)

//thanks http://www.frxoops.org/modules/smartsection/item.php?itemid=179

function profile_search ($queryarray$andor$limit$offset$userid) {
global 
$xoopsDB;

// création de la requête
$sql "SELECT * FROM (".$xoopsDB->prefix("users")." join ".$xoopsDB->prefix("profile_profile")." on ".$xoopsDB->prefix("users.uid")."=".$xoopsDB->prefix("profile_profile.profile_id").") where uid>0 ";
// $sql .= " WHERE uid>0 ."";
if ( $userid != ) {
$sql .= " AND uid=".$userid." ";
}
if ( 
is_array($queryarray) && $count count($queryarray) ) {
$sql .= " AND ((uname LIKE '%$queryarray[0]%' OR user_intrest LIKE '%$queryarray[0]%' OR bio LIKE '%$queryarray[0]%' OR city LIKE '%$queryarray[0]%' OR club LIKE '%$queryarray[0]%' OR bussines LIKE '%$queryarray[0]%')";
for(
$i=1;$i $count;$i++){
$sql .= $andor " ;
$sql .= "(uname LIKE '%$queryarray[$i]%' OR user_intrest LIKE '%$queryarray[$i]%' OR bio LIKE '%$queryarray[$i]%' OR city LIKE '%$queryarray[0]%' OR club LIKE '%$queryarray[0]%' OR bussines LIKE '%$queryarray[0]%')" ; } $sql .= ") " ;
}
$sql .= "ORDER BY uid DESC" // si condition de tri
$result $xoopsDB->query($sql,$limit,$offset);

// création du tableau des résultats
$ret = array();
$i 0;
while(
$myrow $xoopsDB->fetchArray($result)){
$ret[$i]['image'] = "images/mymodule.gif";
$ret[$i]['link'] = "userinfo.php?uid=".$myrow['uid'].""// lien sur la page qui affichera le texte
$ret[$i]['title'] = $myrow['uname'];
//$ret[$i]['time'] = $myrow['created'];
//$ret[$i]['uid'] = $myrow['uid'];
$i++;
}
return 
$ret;

?>

city, club, bussines are custom fields made with profile module. Modify it to your needs.

Login

Who's Online

340 user(s) are online (205 user(s) are browsing Support Forums)


Members: 0


Guests: 340


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits