#!/usr/bin/env php . */ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); $shortoptions = 'i:n:r:d'; $longoptions = array('id=', 'nickname=', 'role=', 'delete'); $helptext = <<getProfile(); if (empty($profile)) { print "User with ID $id has no profile\n"; exit(1); } } else { print "You must provide either an ID or a nickname.\n"; exit(1); } $role = get_option_value('r', 'role'); if (empty($role)) { print "You must provide a role.\n"; exit(1); } if (have_option('d', 'delete')) { print "Revoking role '$role' from user '$profile->nickname' ($profile->id)..."; try { $profile->revokeRole($role); print "OK\n"; } catch (Exception $e) { print "FAIL\n"; print $e->getMessage(); print "\n"; } } else { print "Granting role '$role' to user '$profile->nickname' ($profile->id)..."; try { $profile->grantRole($role); print "OK\n"; } catch (Exception $e) { print "FAIL\n"; print $e->getMessage(); print "\n"; } }