Skip to main content
edited tags
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
Post Reopened by avpaderno
improved formatting and grammar
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

access text Access input format based on user role

iI have onethe Developer user role : developer, i want developer canwhich should only access text format :the developer_html For this developer role needs a permission and input format. I am trying to grant thisthe necessary permission bywith user_role_grant_permissionsuser_role_grant_permissions().

i searched and tried with lots of codes but failed everytime, iI got this piece of code here https://api.acquia.com/api/drupal/modules!filter!filter.install/function/filter_update_7008/7here and also tried to edit according to my requirement, but failed.

<?php
function filter_update_7008() {>
  // Build the list of permissions to grant.
  $permissions = array();
  foreach (filter_formats() as $format_id => $format) {
    if ($permission = filter_permission_name($format)) {
      $permissions[] = $permission;
    }
  } 

  // Grant text format permissions to all roles that can 'administer filters'.
  // Albeit anonymous users *should not* have the permission, we cannot presume
  // that they do not or must not.
  if ($roles = user_roles(FALSE, 'administer filters')) {
    foreach ($roles as $rid => $name) {
      user_role_grant_permissions($rid, $permissions);
    }
  }
?>}

also this https://api.acquia.com/api/drupal/modules%21user%21user.module/function/user_role_grant_permissions/7

access text format based on user role

i have one user role : developer, i want developer can only access text format : developer_html For this developer role needs a permission and to grant this permission by user_role_grant_permissions

i searched and tried with lots of codes but failed everytime, i got this piece of code here https://api.acquia.com/api/drupal/modules!filter!filter.install/function/filter_update_7008/7 and also tried to edit according to my requirement but failed

<?php
function filter_update_7008() {>
// Build the list of permissions to grant.
$permissions = array();
foreach (filter_formats() as $format_id => $format) {
if ($permission = filter_permission_name($format)) {
 $permissions[] = $permission;
}
}
// Grant text format permissions to all roles that can 'administer filters'.
// Albeit anonymous users *should not* have the permission, we cannot presume
// that they do not or must not.
if ($roles = user_roles(FALSE, 'administer filters')) {
 foreach ($roles as $rid => $name) {
   user_role_grant_permissions($rid, $permissions);
   }
  }
?>

also this https://api.acquia.com/api/drupal/modules%21user%21user.module/function/user_role_grant_permissions/7

Access input format based on user role

I have the Developer user role which should only access the developer_html input format. I am trying to grant the necessary permission with user_role_grant_permissions().

I got this piece of code here and also tried to edit according to my requirement, but failed.

function filter_update_7008() {
  // Build the list of permissions to grant.
  $permissions = array();
  foreach (filter_formats() as $format_id => $format) {
    if ($permission = filter_permission_name($format)) {
      $permissions[] = $permission;
    }
  } 

  // Grant text format permissions to all roles that can 'administer filters'.
  // Albeit anonymous users *should not* have the permission, we cannot presume
  // that they do not or must not.
  if ($roles = user_roles(FALSE, 'administer filters')) {
    foreach ($roles as $rid => $name) {
      user_role_grant_permissions($rid, $permissions);
    }
  }
}
Post Closed as "exact duplicate" by niksmac, Clive
deleted 98 characters in body
Source Link
Somik
  • 75
  • 10

i have one user role : developer who, i want developer can able toonly access text format : developer_html programicallyFor this developer role needs a permission and to grant this permission by user_role_grant_permissions

i searched and tried with lots of codes but failed everytime, i got this piece of code here https://api.acquia.com/api/drupal/modules!filter!filter.install/function/filter_update_7008/7 and also tried to edit according to my requirement but failed

<?php
function filter_update_7008() {>
// Build the list of permissions to grant.
$permissions = array();
foreach (filter_formats() as $format_id => $format) {
if ($permission = filter_permission_name($format)) {
 $permissions[] = $permission;
}
}
// Grant text format permissions to all roles that can 'administer filters'.
// Albeit anonymous users *should not* have the permission, we cannot presume
// that they do not or must not.
if ($roles = user_roles(FALSE, 'administer filters')) {
 foreach ($roles as $rid => $name) {
   user_role_grant_permissions($rid, $permissions);
   }
  }
?>

also this https://api.acquia.com/api/drupal/modules%21user%21user.module/function/user_role_grant_permissions/7

i have one user role : developer who can able to access text format : developer_html programically

i searched and tried with lots of codes but failed everytime, i got this piece of code here https://api.acquia.com/api/drupal/modules!filter!filter.install/function/filter_update_7008/7 and also tried to edit according to my requirement but failed

<?php
function filter_update_7008() {>
// Build the list of permissions to grant.
$permissions = array();
foreach (filter_formats() as $format_id => $format) {
if ($permission = filter_permission_name($format)) {
 $permissions[] = $permission;
}
}
// Grant text format permissions to all roles that can 'administer filters'.
// Albeit anonymous users *should not* have the permission, we cannot presume
// that they do not or must not.
if ($roles = user_roles(FALSE, 'administer filters')) {
 foreach ($roles as $rid => $name) {
   user_role_grant_permissions($rid, $permissions);
   }
  }
?>

also this https://api.acquia.com/api/drupal/modules%21user%21user.module/function/user_role_grant_permissions/7

i have one user role : developer, i want developer can only access text format : developer_html For this developer role needs a permission and to grant this permission by user_role_grant_permissions

i searched and tried with lots of codes but failed everytime, i got this piece of code here https://api.acquia.com/api/drupal/modules!filter!filter.install/function/filter_update_7008/7 and also tried to edit according to my requirement but failed

<?php
function filter_update_7008() {>
// Build the list of permissions to grant.
$permissions = array();
foreach (filter_formats() as $format_id => $format) {
if ($permission = filter_permission_name($format)) {
 $permissions[] = $permission;
}
}
// Grant text format permissions to all roles that can 'administer filters'.
// Albeit anonymous users *should not* have the permission, we cannot presume
// that they do not or must not.
if ($roles = user_roles(FALSE, 'administer filters')) {
 foreach ($roles as $rid => $name) {
   user_role_grant_permissions($rid, $permissions);
   }
  }
?>

also this https://api.acquia.com/api/drupal/modules%21user%21user.module/function/user_role_grant_permissions/7

make it looks like code
Source Link
niksmac
  • 7.7k
  • 3
  • 31
  • 69
Loading
Source Link
Somik
  • 75
  • 10
Loading