I can only add questions if I log in as Admin. Is there no way to set permissions for other roles?

Comments

Ed Sawyer’s picture

We had this problem too.

We modified it by changing the block_quiz.module file, look for this function (below) starting at line 23 of that file.

The field that needs changing is the "Access Arguments" element of the array. In the original module it was set to "administer site configuration". Here, we set it to "access administration menu", meaning anyone who can admin the site and see Administration Menu (which we use), can administer the block_quiz module.


function block_quiz_menu() {

  $items['admin/settings/block_quiz'] = array(  
    'title' => 'Quiz Block Management',
    'description' => 'Add/Remove Quiz, import/export function',
    'page callback' => 'block_quiz_admin',
    'access arguments' => array('access administration pages'),
    'type' => MENU_NORMAL_ITEM,
  );
 
  $items['admin/settings/block_quiz/view'] = array(
	'title' => 'View/Edit Quiz Questions',
	'description' => 'View/Add/Edit/Remove Quiz Questions',
	'access callback' => TRUE,
	'page callback' => 'drupal_get_form',
	'page arguments' => array('block_quiz_mgmt_form'),
   'access arguments' => array('access administration pages'),
	'type' => MENU_LOCAL_TASK,
  );
 
  $items['admin/settings/block_quiz/add'] = array(
	'title' => 'Add a quiz item',
	'description' => 'Add a new question into the quiz bank',
	'access callback' => TRUE,
	'page callback' => 'block_quiz_add',
   'access arguments' => array('access administration pages'),
	'type' => MENU_LOCAL_TASK,
  );

	// handles all the operations: add/edit/enable/disable/delete
	$items['admin/settings/block_quiz/%/%'] = array(
		'title' => t('Quiz Question Operation'),
		'page callback' => 'block_quiz_ops',
		'page arguments' => array(3, 4),
		'access arguments' => array('access administration pages'),
		'type' => MENU_CALLBACK,
	);
	
	$items['block_quiz/answer_js'] = array(
		'page callback' => 'block_quiz_js',
		'type' => MENU_CALLBACK,
		'access arguments' => array('access content'),
	);
	
  return $items;
}

Hope that helps.
-Ed

jovemac’s picture

Hello!

I did the changes... as mentioned above.

function block_quiz_menu() {

$items['admin/settings/block_quiz'] = array(

'title' => 'Quiz Block Management',

'description' => 'Add/Remove Quiz, import/export function',

'page callback' => 'block_quiz_admin',

'access arguments' => array('access administration pages'),

'type' => MENU_NORMAL_ITEM,

);

$items['admin/settings/block_quiz/view'] = array(

'title' => 'View/Edit Quiz Questions',

'description' => 'View/Add/Edit/Remove Quiz Questions',

'access callback' => TRUE,

'page callback' => 'drupal_get_form',

'page arguments' => array('block_quiz_mgmt_form'),

'access arguments' => array('access administration pages'),

'type' => MENU_LOCAL_TASK,

);

$items['admin/settings/block_quiz/add'] = array(

'title' => 'Add a quiz item',

'description' => 'Add a new question into the quiz bank',

'access callback' => TRUE,

'page callback' => 'block_quiz_add',

'access arguments' => array('access administration pages'),

'type' => MENU_LOCAL_TASK,

);

// handles all the operations: add/edit/enable/disable/delete

$items['admin/settings/block_quiz/%/%'] = array(

'title' => t('Quiz Question Operation'),

'page callback' => 'block_quiz_ops',

'page arguments' => array(3, 4),

'access arguments' => array('access administration pages'),

'type' => MENU_CALLBACK,

);

$items['block_quiz/answer_js'] = array(

'page callback' => 'block_quiz_js',

'type' => MENU_CALLBACK,

'access arguments' => array('access content'),

);

But it didnt help. Any other suggestions will be of great help!