Hello,

Can anyone tell me how to remove the "View" and "Task" (or any tabs really) from the Quiz taking portion of the module?
I'm not sure if it can be removed via permissions or a change to the theme.

I don't want users to be able to go back and forth between tabs when they are taking a test.
I use the Quiz overview that is within the "View" tab to give them information they are tested on and I don't want them to be able to go back and view the information while testing.
I've attached an image and circled in red what I needed removed.

Thank you in advanced!

CommentFileSizeAuthor
removetabs.jpg27.56 KBDanBerk4
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Simon Georges’s picture

Priority: Critical » Normal
Status: Active » Needs review

If you have a custom module, you can use the hook_menu_alter to remove the "Take" tab. The "View" one, as only tab left, will disappear too.

If your module name is "my_module", something like

/**
 * Implementation of hook_menu_alter().
 */
function my_module_menu_alter(&$items) {
  $items['node/%node/take']['type'] = MENU_CALLBACK;
}

should do the trick (don't forget to clear your menu cache).

Regards,

Simon Georges’s picture

Closing #899840: Remove View & Take buttons as a duplicate of this one.

charli213’s picture

where exactly do I have to put this code please ?

Simon Georges’s picture

You have to create a module (or use a custom one if you already have one). In this module, named "XXXX", you create a function named "XXXX_menu_alter" with the code from http://drupal.org/node/853908#comment-3297940.
This should do the trick (after you activate your module and clear your menu cache).

Regards,

charli213’s picture

Thanks for your answer, but sorry to play up, do really I have to create a module just to hide one or two tabs, there is no really other solution ?

codevoice’s picture

+1 for an easy way to disable these tabs.

superxain’s picture

+1. Calling for a checkbox to replace the module thing.

Now, I did it by editing quiz.module:

  $items['node/%node/take'] = array(
    'title' => 'Take',
    'page callback' => 'quiz_take',
    'page arguments' => array(1),
    'access callback' => 'quiz_take_access',
    'access arguments' => array(1),
    'type' => MENU_CALLBACK, // MENU_LOCAL_TASK,
    
  );
Sivaji_Ganesh_Jojodae’s picture

Status: Needs review » Active

I don't want users to be able to go back and forth between tabs when they are taking a test.

I agree with this. This is not good from usability point. "Take" tab is surplus as we already have a button in view tab to start the quiz howeverhook_menu_alter() is not a recommended approach. I am in favor of changing to MENU_CALLBACK but i am not sure whether this will be accepted now.

BTW : "Need reviews" status to be used when you have patches.

Simon Georges’s picture

Hi,

Sorry for changing the status.
I'd agree with changing the callback too, but as it was just a support request, I only proposed a non-intrusive way of doing it. If you propose to change the menu type in quiz.module to MENU_CALLBACK, I'll support you ;)

Best regards,
Simon

anumathew’s picture

Priority: Normal » Major

Hi, I want to hide this view and take only for user(except Admin) , so how can i make changes in the menu_alter function ..??please help me ...

Thanks

anumathew’s picture

Hlo, I need this two menus only for admin(viewable for admin only) , so how can i make changes on the menu_alter function...???

Thanks

jebernier’s picture

Where exactly (line #) did you put that code snippet in the quiz.module.

Thx,
JB

djdevin’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

This issue is being closed because it is filed against a version that is no longer supported.