I have just installed aMember Pro and I'm trying to prepare it for my project. I need to be able to set up a number of 'interest groups' in a members profile and have the ability to email the member list depending on their interests. I can add the interest groups to the profile ok but I'm struggling to see how I can access this information in order to email just the right group of members. For instance if I have interest groups 'cats', 'dogs', 'snakes' and 'spiders' the user will specify which animals they are interested in when they sign up. When I have an offer say on 'spider cages' then I want to email everyone who has an interest in 'spiders'. Could you tell me how I might accomplish this please. Steve
Hi Alex, That's ok but is it possible for you to show me how to implement my own mailing system? I can handle the mail sending part but I need to know how to access the additional field data in each members profile. I've installed aMember into the same database that my main application will be using so I should be able to access the data ok. If you could tell me how best to get the data from the aMember tables it would help me a lot. Steve
Checkbox fields must be "common" type fields. Lets say you name field as "lists". Then you can do something like that in code: PHP: // non-expired users only $q = mysql_query("SELECT * FROM amember_users WHERE status = 1");while ($u = mysql_fetch_assoc($q)){ $data = unserialize($u['data']); $lists = $data['lists']; // do something with info print_r($u); print_r($lists);}
Hi Alex, Thanks, I think that is just what I need. I've been reading the manual again and I was wondering whether I can use the global '$db' in my own php code. It looks as if the use is confined to the 'site.inc.php' file which would be located in my '/amember' folder. Can I use it from files in the root folder? If not I shall access the database directly as in your example. My concern is that it is possible for the database structure to change between upgrades but it is less likely that '$db' would change. Steve