Forums
Hello!
I have the message after enabling some modules:
"Notice: Trying to get property of non-object in funtcion opigno_collaborative_workspaces_install_default_permissions() (line 242 in file /.../profiles/opigno_lms/modules/opigno/opigno_moxtra_app/modules/opigno_collaborative_workspaces/opigno_collaborative_workspaces.install).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'rid' cannot be null: INSERT INTO {role_permission} (rid, permission, module) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => [:db_insert_placeholder_1] => create collaborative_workspace content [:db_insert_placeholder_2] => node )
in function user_role_grant_permissions() (line 3171 in the file /home/u13534/domains/univerico.com/modules/user/user.module
Before I had a problem with homebox module on the same site cause I have php 5.3. on server and I needed to use 5.4 ore to use patch
The situatuin is in this topic https://www.opigno.org/en/forum/support/err-500-during-modules-enabling
What should I change in this files?
What should I do to fix the problme with database?
And what modules should I unable with drush to have an acces to my site while I am trying to fix the problem?
The text of files
the first:
from line 232 to 249
function opigno_collaborative_workspaces_install_default_permissions()
{
$administrator = user_role_load_by_name('administrator');
$administrator_permissions = array(
'create collaborative_workspace content',
'delete any collaborative_workspace content',
'edit any collaborative_workspace content',
'view participants collaborative_workspace',
'view all collaborative_workspace',
);
user_role_grant_permissions($administrator->rid, $administrator_permissions);
$student_manager = user_role_load_by_name('student manager');
$student_manager_permissions = array(
'create collaborative_workspace content',
'delete own collaborative_workspace content',
'edit own collaborative_workspace content',
'view participants collaborative_workspace',
Line 242: user_role_grant_permissions($administrator->rid, $administrator_permissions);
The second
line 3171
from line 3159 to 3172:
function user_role_grant_permissions($rid, array $permissions = array()) {
$modules = user_permission_get_modules();
// Grant new permissions for the role.
foreach ($permissions as $name) {
db_merge('role_permission')
->key(array(
'rid' => $rid,
'permission' => $name,
))
->fields(array(
'module' => $modules[$name],
))
->execute();
}
Hi,
Hi,
Your opigno instance is missing the role "administrator" ? The problem comes from here.
You have two choices, either you create the role "administrator" or you make a small code editing to remove the default permissions.
For the first possibility, it's straigh forward, go to the page admin/people/permissions/roles and add the role "administrator".
For the second solution, open the file located at: profiles/opigno_lms/modules/opigno/opigno_moxtra_app/modules/opigno_collaborative_workspaces/opigno_collaborative_workspaces.install
Go to the line 194 and put // (double slash) at the very beginning of the line. it should look like this: "// opigno_collaborative_workspace_install_default_permissions();"
Then try to install the opigno collaborative workspace module again.
Hope it helps. Do not hesitate to contact us again ! :)
Best regards,
Allan
In reply to Hi, by Amermod
Thank you.