The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
removing specific data from membergroupids
I've got a plugin that extends many of the VB permissions out to an external datasource.
One of the things I am trying to do is make updates to the membergroupids column of the user table based on logic in my plugin. I'm unsure how exactly to read the contents of membergroupids for a user and strip out only a single id number without changing the rest. So for example is user A has membergroupids set to 9,10, 11 and my plugin determines that this user should no longer have access to 10, I want to update that value to be 9,11. Does anyone have some insight on an easy method to accomplish this? Thanks! Bobbo |
#2
|
|||
|
|||
Anyone have some thoughts on this one?
I think what I am trying to do is update the array, but if I try to unset one of the values using a foreach statement it doesnt work. I suspect someone with more php knowledge than myself would know how to do this. I'd really appreciate any help. Thanks. B |
#3
|
|||
|
|||
Ok, I think I got this one licked...
I can tell the interest level by the high level of responses... lol. ;-) Anyhow, I'm doing something like this. Code:
eval('$getids = array ('.$vbulletin->userinfo['membergroupids'].');'); $dropid = "12"; //in my real code, this value is determined by an external MS SQL lookup for($i=0;$i<count($getids);$i++) { if($getids[$i] == $dropid) { unset($getids[$i]); } } $idupdate = implode(",", $getids); $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET membergroupids = '" . $idupdate . "' WHERE email = '" . $username . "' LIMIT 1 "); Seems to work really well. Not sure if there are any 'gotchas' or reasons why this would be a problem. If anyone has any feedback, I'd apprecaite it. Maybe it will help someone else... Bobbo |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|