Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
better_formats
Commits
9de25c78
Commit
9de25c78
authored
May 31, 2009
by
dragonwize
Browse files
Only show roles that have admininster blocks permission for block defaults.
parent
0cd4501e
Changes
2
Hide whitespace changes
Inline
Side-by-side
better_formats.install
View file @
9de25c78
...
...
@@ -74,7 +74,7 @@ function better_formats_install() {
foreach
(
$roles
as
$rid
=>
$role
)
{
db_query
(
$sql
,
$rid
,
'node'
,
0
,
1
,
0
);
db_query
(
$sql
,
$rid
,
'comment'
,
0
,
1
,
0
);
db_query
(
$sql
,
$rid
,
'block'
,
0
,
1
,
0
);
db_query
(
$sql
,
$rid
,
'block'
,
0
,
1
,
25
);
}
// Set default perms to be like core defaults.
...
...
@@ -115,3 +115,21 @@ function better_formats_uninstall() {
WHERE name LIKE 'better_formats%'"
;
db_query
(
$sql
);
}
/**
* Update from 1.0 to 1.1.
*/
function
better_formats_update_6110
()
{
$ret
=
array
();
// Insert block format defaults.
$roles
=
user_roles
();
$sql
=
"INSERT INTO
{
better_formats_defaults
}
VALUES (%d, '%s', %d, %d, %d)"
;
foreach
(
$roles
as
$rid
=>
$role
)
{
$result
=
db_query
(
$sql
,
$rid
,
'block'
,
0
,
1
,
25
);
$ret
[]
=
array
(
'success'
=>
$result
!==
FALSE
,
'query'
=>
check_plain
(
$sql
));
}
return
$ret
;
}
better_formats_defaults.admin.inc
View file @
9de25c78
...
...
@@ -102,6 +102,7 @@ function better_formats_get_role_default_fields($mode, $node_type = '') {
$per_node_type
=
variable_get
(
'better_formats_per_node_type'
,
FALSE
);
$block_admins
=
better_formats_get_roles_by_perm
(
'administer blocks'
);
if
(
$per_node_type
&&
$node_type
)
{
$type
=
$mode
.
'/'
.
$node_type
;
$types
=
$type
.
"','"
.
$mode
;
...
...
@@ -120,6 +121,7 @@ function better_formats_get_role_default_fields($mode, $node_type = '') {
while
(
$role
=
db_fetch_object
(
$result
))
{
if
(
in_array
(
$role
->
rid
,
$roles_set
)
||
(
$mode
===
'block'
&&
!
in_array
(
$role
->
rid
,
$block_admins
)))
{
// if (in_array($role->rid, $roles_set)) {
continue
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment