addMembersToGroup Error with Additional Groups?

Started by mrandall131, June 02, 2008, 07:49:48 PM

Previous topic - Next topic

mrandall131

Ok, I have a gaming clan management mod that I have made for my team (eventually, I plan on sharing it with everyone).  One of the features is sending in an application to join.  I have all that working, now I want to try and add the applicant to the "Members" membergroup.  Now, I have it all coded and it works properly, if the applicant has an additional membergroup in their profile.  If there are no additional membergroups specified, then I get this error:

Quote from: Error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')
WHERE ID_MEMBER IN (31)
AND ID_GROUP != 14
AND NOT FIND_IN_SET(14, ' at line 2
File: **************/Sources/Subs-Members.php
Line: 555

Here is the code I use to call it:


addMembersToGroup($applicant_id[$j], $clan['config']['mem_group'], 'only_additional');


I am using SMF 1.1.4.

forsakenlad

This has probably something to do with the ID_GROUP being an array when there are alternate membergroups.

You should make sure the id group isn't an array (in this case imploded with a comma) when only one membergroup is present.
Eren "forsakenlad" Yaşarkurt
SMF Friend & Former Team Member

mrandall131

The group id isn't an array.  It's a single value set in a "settings file" for now until I finish the admin panel.

mrandall131

Ok, tried to implode it like you said.  Here's the code.....


                 // Add to Member Group
                  $group_id = implode(',', $clan['config']['mem_group']);
                  addMembersToGroup($applicant_id[$j], $group_id, 'only_additional');


Now, I don't get an error, but it didn't add the member group either.  Also, now it doesn't add the member to the group if they are assigned to a second group.

[SiNaN]

Why don't you check it type and value with var_dump()? This will help you I hope.
Former SMF Core Developer | My Mods | SimplePortal

Advertisement: