1
deka87
Profile module search ain't working
  • 2011/10/17 12:51

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


Hi guys,

My profile module search doesn't work properly or doesn't work at all after I upgraded from 2.2 to 2.4.4 then to 2.5.3.

1. Opening profile/search.php - OK for Webmaster and Anonymous users. Debug indicates 0 errors.

2. I do a search: Webmaster gets several pages of results, the first page is ok, however when I go to the 2nd page or further (links looks like http://www.site/modules/profile/search.php?start=20&op=results&order=ASC&sortby=&limit=20) it doesn't fetch results by criteria but displays all users I have instead. Debug indicates 0 errors.
Anonymous users get a blank page or 500 internal server error. No errors by debug again.

I run out of ideas what the might be.
Mind anchors

2
trabis
Re: Profile module search ain't working
  • 2011/10/17 19:25

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1



3
deka87
Re: Profile module search ain't working
  • 2011/10/18 4:27

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


Quote:
Nice bugs deka :)


pain in my arse

Quote:
Please test this version of profile/search.php


it's fixed the thing, woop woop! everything works fine now. I wonder if I was the only one who had this issue.

also what is the static url for profile search results look like? say I am looking for a user from germany (the 'country' field) so I supposed the link should look like http://www.mysite.com/modules/profile/search.php?country=russia&op=results but it doesn't work
Mind anchors

4
trabis
Re: Profile module search ain't working
  • 2011/10/18 12:43

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Quote:
it's fixed the thing, woop woop! everything works fine now. I wonder if I was the only one who had this issue.

No, this is a general bug, maybe you are the only one using profile, Thanks for reporting the bug.

pain in my arse

Quote:

also what is the static url for profile search results look like? say I am looking for a user from germany (the 'country' field) so I supposed the link should look like http://www.mysite.com/modules/profile/search.php?country=russia&op=results but it doesn't work


Well, I'm not sure if adding parameters in url is good choice due to profile nature, there can be 'infinite' fields' and the uri cannot have infinite length (i'm using the absurd here). Also, it will cause duplicate titles, meta description, etc, something google does not appreciate(google webmaster tools).

I'll see if it is possible to manufacturer an uri (like in your example) that you can use as link and report back.

5
deka87
Re: Profile module search ain't working
  • 2011/10/18 13:02

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


thanks trabis! I used to have those links in 2.2 and it would be awesome to have them back.
Mind anchors

6
trabis
Re: Profile module search ain't working
  • 2011/10/18 19:17

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1



7
deka87
Re: Profile module search ain't working
  • 2011/10/18 19:39

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


works just fine thanks! links look like http://www.mysite.com/modules/profile/search.php?coutry[]=Spain&op=results that is awesome. one more question. i want to replace the email column in the search results with another custom field column ($about_me). I try to replace

$userarray["output"][] = ( $users[$k]->getVar('user_viewemail') == || (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin()) ) ? $users[$k]->getVar('email') : "";


with

$userarray["output"][] = $users[$k]->getVar('about_me');


but it doesn't work for custom fields like my $about_me. how do I correct it? thanks in advance!
Mind anchors

8
trabis
Re: Profile module search ain't working
  • 2011/10/18 20:07

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Quote:

deka87 wrote:
but it doesn't work for custom fields like my $about_me. how do I correct it? thanks in advance!


Use this instead
foreach (array_keys($fields) as $i) {
                if (
$fields[$i]->getVar('field_name') == 'about_me') {
                    
$userarray["output"][] = $fields[$i]->getOutputValue($users[$k], $profiles[$k]);
                }
            }

No tested. Should work even if your field is not searchable but can produce duplicate columns if your field is searchable.

Please notice that about_me column is displayed if you set it as searchable and user search for users using that field.
If you have this field as searchable then a better option would be to add around line 377:
$searchvars[] = 'about_me'
//Sort information

This will trick the system to think that the user have used this field for searching and produce an extra column, even if he didn't

Login

Who's Online

362 user(s) are online (280 user(s) are browsing Support Forums)


Members: 0


Guests: 362


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