X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=scripts%2Fuserrole.php;h=428abb8acedce4e93ad064a455aa58b3fa25bcf1;hb=b261a77be2a894e3fe4d00c86925bac7fb5d061c;hp=7b6a9b3fd8f97e4d2e4b9a365cf2864cebad8287;hpb=4b98edf75f4e255f8c61087bd1525d89653a521f;p=quix0rs-gnu-social.git diff --git a/scripts/userrole.php b/scripts/userrole.php old mode 100644 new mode 100755 index 7b6a9b3fd8..428abb8ace --- a/scripts/userrole.php +++ b/scripts/userrole.php @@ -18,7 +18,8 @@ * along with this program. If not, see . */ -define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); +define('INSTALLDIR', dirname(__DIR__)); +define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public'); $shortoptions = 'i:n:r:d'; $longoptions = array('id=', 'nickname=', 'role=', 'delete'); @@ -27,6 +28,8 @@ $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); @@ -63,9 +71,9 @@ if (empty($role)) { } if (have_option('d', 'delete')) { - print "Revoking role '$role' from user '$user->nickname' ($user->id)..."; + print "Revoking role '$role' from user '$profile->nickname' ($profile->id)..."; try { - $user->revokeRole($role); + $profile->revokeRole($role); print "OK\n"; } catch (Exception $e) { print "FAIL\n"; @@ -73,9 +81,9 @@ if (have_option('d', 'delete')) { print "\n"; } } else { - print "Granting role '$role' to user '$user->nickname' ($user->id)..."; + print "Granting role '$role' to user '$profile->nickname' ($profile->id)..."; try { - $user->grantRole($role); + $profile->grantRole($role); print "OK\n"; } catch (Exception $e) { print "FAIL\n";