How to use checkbox to agree to be included in Membership List

Hi Keith.

Did you resolve this. I’m trying to do the same thing and finding that the custom field can’t be used as a filter along with another filter for member fields (custom or otherwise!)

Andy

Andy (and Keith). I used the radio-button-multi-option to solve this same need without using PHP The question prompt reads “I want to be in the directory” and the options are yes and no. using the pipe | allows the webmaster to choose both the option value (what you will use to filter behind the scenes) and the “option label” (what the user sees when they choose which box (really circle) to check. HERE IS THE PART that makes no sense, but MAKES IT WORK: the software needs to have a ccaps filter, even if you add in all your ccaps so it doesn’t limit the output.

[s2Member-List orderby=“last_name” order=“asc” s2member_custom_field_directory_public search=“public-directory” show_fields=“Name:full_name,last_name, email, phone,phone2, city” limit=“100” ccaps=“annual,lifetime,autorenew,executive” rlc_satisfy=“ANY” avatar_size=90 /]

But Jason @jaswrks , can you tell me why my output will not orderby?

@daleandy, @MASP

Hi MCBA

I have to say that I admitted defeat on the basis that it is too hard to achieve in S2Member with the limitations of the functionality. Instead I installed plugin “AMR Users” which integrates with S2Member custom fields and presents a public directory. It worked perfectly and with greater options and functionality than I’d originally required.

It does however mean that I do not need the Pro licence, but that’s life. J

Thanks, @daleandy ! I will check out AMR Users. I have S2Member Pro on two sites, helping two non-profits with over 1,000 members. I’m hoping that @jaswrks can straighten me out on the orderby and search of that list (right now the search pulls from entire data base instead of just the custom_field search.)

I shall watch this thread to see whether you get a solution, but I went thought the exact same issues and came up blank. What you in effect want is the custom field to be treated like a ccap field, but S2Member treats them very differently.

Took me an hour to get AMR Users to do what I wanted. Don’t get me wrong, S2Member is great and a key part of my social group site functionality, but it has been hard to get the member directory issue resolved, and interfacing seamlessly with mailchimp took a lot of code in a S2hacks MU plugin.

Good luck.

Andy

@daleandy Andy, which AMR additional plugins did you buy?

AMR Users. Free version was fine to do a good member directory integrating with the S2Member custom fields.

@daleandy Thanks or finding AMR plug-in for me. I am playing with AMR now. I need filtering, which requires +plus addon, unless, as AMR suggests, I may be able to get away with an HTML filter, if I can figure it out.

FROM THEIR WEBSITE:
Simple Filtering
If you have some very simple filtering needs, you could code your own little form html to sit on the same page. The html should pass the following parameters back to the user list page.
Yes – this can also be done as links from other pages.

QUERY STRING PARAMETERS:
filter=hide or show
activate filtering request. plugin will then look for column names
hide says “hide that column” – as all rows will have the same value
show = “show the column”
column_name=value
pass the technical column name (see the ‘nice names’ list in the settings) and the value to be selected

I just had a need to allow a public directory with users who had agreed to be searched, being searchable by last name, and 3 other fields. There was no filtering of results for me. To ensure that only anyone who had agreed to be searched could themselves search, I included a PHP IF statement against the custom field checkbox. I understand why you may need to additional features. Works great but you do need to read the documentation as it not very intuitive at all!

Andy

so wait, you ARE filtering based on if they agreed to be searched. How ?

Hi MCBA.

OK, that’s why I say the documentation is difficult, as you can do much of what you want without any extra bought functionality I think. I had to work it out thought!

Firstly - to filter a search based upon those who have agreed to share their details:-

So, using AMR Users I use the Member Directory option. Using the Include/Exclude tab, specify the tick box field you have and then check the box that says exclude if blank :grin: This will only list those in the directory who have ticked the box. However, to get that option in the include/exclude, you have to include the tick box field first in the field display options under the fields/sort tab. The clever bit that took some reading, is that once you’ve included the field in the include/exclude tab as above, you can then go back and remove it from the fields/sort tab so that it is not visible in the search results. It still stays in the include/exclude tab. It takes a careful read of the documentation and some googling to make sure you can do what you want.

Secondly - to only allow those who have agreed to share their details to see others, I installed EzPHP to allow me to include PHP code on my page mixed in with shortcodes. I then did an IF statement which checks whether the current user logged in and using the page has ticked the box (my custom field is called “sharing”):

[php] if(get_user_field(‘sharing’)) : [/php]

In the search box you can enter leaving year, city, country or last name. Only signed-up users who have agreed to share their details will appear in search results:

[userlist list=2 start_empty=1]

[php] else : [/php]

**Sorry, but you set your profile on the basis of not sharing your information and so you can’t use this tool. **

Don’t despair, you can change this option by editing your profile!

[php] endif; [/php]

The “start_empty” attribute is a nice feature which prevents the list from displaying anything without any search criteria, which I wanted.

Hope this helps.
Andy

1 Like

Wow, Andy. Thanks so much for taking the time to write all that out for me!
I did see the document you where you got that info but I got confused because my “Filters” tab is grayed out.
I’ll give it another run.