The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#11
|
|||
|
|||
Exactly - or a starting or ending comma. But last time I checked, the vb code that reads secondary groups explode()s the string then ignores any non-numeric, null, or duplicate values, so I'm pretty sure it wouldn't matter. Still, a mod might read that field and not be able to handle it, so I suppose there's some risk.
|
#12
|
|||
|
|||
I think you would need
REPLACE(REPLACE(membergroupids, '2,', ''), ',2', '' ) First it gets rid of 2 everywhere but at the end, then catches it at the end. |
#13
|
|||
|
|||
Yeah, I think that works. But you need a third REPLACE in case the field is only "2".
Pretty cool. |
#14
|
|||
|
|||
Code:
REPLACE( REPLACE( REPLACE( REPLACE(membergroupids, '2', ' '), ', ,', ''), ' ,', ''), ', ', '') |
#15
|
|||
|
|||
You know, I just thought of something (and this applies to TheLastSuperman's solution as well) - you can't just replace all 2's because someone could have a usergroup 12, or 20 something. I think you'd need a regular expression to match ^2, and ,2$ and well as ,2,.
Edit: I guess what I should say is that I think it will work for a one-time removal of some secondary groups if there's no conflict as is mentioned above. For instance if you want to remove secondary group 9 and you have less than 19 usegroups, it'll work fine. |
#16
|
|||
|
|||
If I were doing this I would select a batch and loop through it using php to manipulate the strings and then update one at a time in the loop. It would be slow but I'd rather have slow and predictable than fast and unpredictable. You could also check what's going on before running it with the update query and be sure you aren't messing up. If the whole process takes an hour to run, so be it.
--------------- Added [DATE]1321890191[/DATE] at [TIME]1321890191[/TIME] --------------- First I would use a SELECT That uses LIKE to match the membergroupid. I would use this php in a loop. If everything looks OK then replace the echo with an update PHP Code:
Here's the first thing I would do. Use this for a plugin in showthread_start. All it does is check that the string manipulation is working exactly as it should. You should have a white page with 10 lines each showing user name, primary usergroup, original secondary usergoup string and finally the modified secondary user group string. Edit in your userid in the first line where it says '1' PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|