Thanks for this much-needed module. I have a multisite with a large number of sites, all with the same roles. I want to enable role export on all these sites (in preparation for exporting some rules that rely on role ID), and at the same time update all of the existing role IDs to use the hash generated by role export. Can you recommend the best way to do this? I found that I was able to run this php script via drush for each role and it seems to work, but I'm not sure if there's a better way:

<?php
$role = user_role_load_by_name('administrator');
role_export_user_role_update($role);
?>

This would be pretty easy to run against all my sites if it's an acceptable solution.

Thanks in advance.

Comments

klausi’s picture

Status: Active » Fixed

Don't call the hook implementation directly, just use user_role_save() and it will be called. And a warning: if you update your roles you might also have to update your contributed configurations manually that rely on roles (e.g. views, ctools, rules etc.).

knaffles’s picture

Perfect. And yes, I believe I've identified all the various components which are relying on role IDs. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.