This is actually what I tried first. The problem is that User::addGroup does security checks and checks a "addable" array that is a list of groups you are allowed to add someone too. So non sysops can not add add themselves to the sysop group.
On Jun 20, 2011, at 6:52 AM, Łukasz Garczewski wrote: > On Mon, Jun 20, 2011 at 5:29 AM, Adam Meyer <[email protected]> wrote: >> It looks like the way to do it would be to run a query like so: >> >> $user = User::newFromName( $userName ); >> >> $dbw = wfGetDB( DB_MASTER ); >> >> $dbw->insert( 'user_groups', >> array( 'ug_user' => $user->getID(), 'ug_group' => 'bot', ), >> 'User::addGroup', array( 'IGNORE' ) ); > > Never run queries on the database when you can use wrapper methods. > Use this instead: > > $user = User::newFromName( $name ); > $user->addGroup( 'sysop' ); > > -- > Lucas 'TOR' Garczewski > Community Engineer > [email protected] > > _______________________________________________ > MediaWiki-l mailing list > [email protected] > https://lists.wikimedia.org/mailman/listinfo/mediawiki-l _______________________________________________ MediaWiki-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
