Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 20 Sep 2010, 17:08
AntonLargiader AntonLargiader is offline
 
Join Date: Dec 2005
Alter membergroupids through MySQL?

My forum has a custom usergroup for 'member' which is a paid membership not managed through vBulletin. I'd like to update this through MySQL, based on information in a separate table. In my case let's say it is group 11.

This means that if a user's membergroupids value is:
- blank I need to add '11'
- 10 I need to add ', 11'
- 12 I need to insert '11, '
- 10,12 I need to insert '11, '
- etc.

Plus if someone's membership expires I'll want to remove the 11 along with any extra commas.

Ideally there is a routine I can use somewhere in VB that will do this for me, but either way - is this something that anyone has dealt with before? Any suggestions? Sure I can write a bunch of if/then statements but I'm probably overlooking a much better solution.

--------------- Added 20 Sep 2010 at 18:50 ---------------

Doing a bit more looking, it seems the process would be:

Get membergroupids
Explode it
If arraysearch (11, membergroupids)
- remove the 11 element
- Implode it
- save it

Is there a function for removing a specific array element? I can find them for adding and removing end elements but nothing for a specific one that might be in the middle.

Last edited by AntonLargiader; 20 Sep 2010 at 18:50. Reason: Auto-Merged DoublePost
Reply With Quote
  #2  
Old 23 Sep 2010, 14:45
AntonLargiader AntonLargiader is offline
 
Join Date: Dec 2005
OK, looks like this hasn't really been tackled before. I'll get to it in the next few weeks, but it looks like array_splice() is going to be my friend for removing group IDs and array_push() will let me add them to the end.

get
explode()
array_search()
array_splice() or array_push() or nothing
if changed:
- implode()
- update
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 13:09.

Layout Options | Width: Wide Color: