Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
7 - 4 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
     

Re: Xoopsmembers search by group and rank (HACK)
by simonvl on 2004/4/19 13:54:09

It sounds like a slight error in the code. Check it through. If that fails, turn on PHP debug in admin/general and post the details of your debug info. Someone here may be able to help.
Simon
Re: Xoopsmembers search by group and rank (HACK)
by cauchy on 2004/4/18 5:23:36

I have some problem with the navigation bar at the bottom of the page.
This hack doesn't work for me.
Re: Xoopsmembers search by group and rank (HACK)
by simonvl on 2004/4/18 2:28:13

As I promised, here is a further extension of the hack.

I would like to be able view the members without having to go through the search form (by putting [$op = "submit";] at the top of the form). Additionally, I would like to be able to have all groups shown if the visitor is logged on ($xoopsUser), but only certain groups if it is an anonymous visitor.
I used this code around line 215 (of the hacked version available from my website):
le="color: #000000"><?php //hack 3 if ( !empty($HTTP_POST_VARS['groupid']) && $xoopsUser ) { $groupid = ($HTTP_POST_VARS["groupid"]); } elseif ( $xoopsUser ) { $groupid = array(1,2,4,7); } else { $groupid = array(1,7); } // end hack 3
Re: Xoopsmembers search by group and rank (HACK)
by simonvl on 2004/4/18 0:18:25

That's absolutely fantastic!! It worked first time!
Thanks so much, its very kind of you to help me.

For anyone interested, I have implemented this "search for users by group" hack- you can view the result at http://www.chillout.org.uk/modules/xoopsmembers/exampleindex.php
(for a limited time only) and you can see the code used in my wfsnippets section.
Enjoy.
(more hacks to this module will hopefully follow in this thread)
Simon
Re: Xoopsmembers search by group and rank (HACK)
by samuels on 2004/4/16 8:02:06

I don't know if it's usefull for you but I've made this hack to add a new search option. You can select one or more groups, and you will see only the users of these groups.
I have not tested it yet, perhaps runs or perhaps not

At xoopsmembers.php, after line 27:

le="color: #000000"><?php function SearchByGroups($grps,$uid) { $User= new XoopsUser($uid); $groupid = $User->getGroups(); for ($i=0; $i<count($groupid); $i++) { if (@in_array($groupid[$i], $grps)) { return true; } } }


With this little function you know if certain user is in one or more groups

Now, before the submit button
le="color: #000000"><?php $form->addElement($submit_button);


Add a formselectgroup
le="color: #000000"><?php $form->addElement( new XoopsFormSelectGroup (_MD_GROUPACCESS, 'groupid',false,array(1,2),3,true));


Documentation of this is HERE

First value: Description Text.
Second value: Name (must be unique in the form)
Third value: Do you want to show anonymous group?
4º value: Preselected values.
5º value: Number of lines to show.
6º value: Do you want to select more than one value?


Now we need to capture the form values.
After
le="color: #000000"><?php $limit = (!empty($HTTP_POST_VARS['limit'])) ? intval($HTTP_POST_VARS['limit']) : 20; if ( $limit == 0 || $limit > 50 ) { $limit = 50; }


Add this
le="color: #000000"><?php $groupid = ($HTTP_POST_VARS["groupid"]);


And now it's the time to use the function. I don't know how to use CriteriaCompo objects. This is and easy way to do that.

Look for line:
le="color: #000000"><?php foreach (array_keys($foundusers) as $j) {


And add after:
le="color: #000000"><?php if (SearchByGroups($groupid,$foundusers[$j]->getVar("uid"))) {


And before line:
le="color: #000000"><?php $totalpages = ceil($total / $limit);


Add:
le="color: #000000"><?php }


I hope this code can help you a little.

Who's Online

223 user(s) are online (162 user(s) are browsing Support Forums)


Members: 0


Guests: 223


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits