I have a module called CeeVee_content_sync. my module code:

<?php
function Ceevee_content_sync_menu(){
    $items = array();

    $items['admin/CeeVee/CVC-sync'] = array(
        'title' => 'CVC sync config',
        'description' => 'PAGE',
        'page_callback' => 'drupal_get_form',
        'page arguments' =>array('Ceevee_content_sync_form'),
        'access arguments' =>array('access administration pages'),
        'type' => MENU_NORMAL_ITEM,
    );

    $items['CVC-sync'] = array(
        'title' => 'CVC sync',
        'description' => 'PAGE',
        'page_callback' => 'Ceevee_content_sync_test_page',
        'access arguments' =>array('access content'),
        'type' => MENU_NORMAL_ITEM,
    );
    return $items;

}

/*
 * Implements hook_form
 */

function Ceevee_content_sync_form($node, &$form_state){
    $form['url'] = array(
        '#type' => 'textfield',
        '#title' => 'Server Url',
        '#default_value' => variable_get('Ceevee content sync Server Url'),
        '#description' => 'Server url containing the node list',
        '#required' => TRUE,
        '#weight' => -5,
    );
    $form['preview'] = array(
        '#type' =>'button',
        '#value' => t('Sync Now'),
        '#weight' => 19,
        //'#after_build' => array(),
    );
    return $form;
}

function Ceevee_content_sync_test_page(){
    return 'asd';
}
?>

my info file:

name = CeeVee Content Sync
description = sync with a server using json to broadcast content
core = 7.x
package = Features
version = 7.x-1.0
project = CeeVee_content_sync
package = CeeVee
dependencies[] = CeeVee_common
configure = admin/CeeVee/CVC-sync

Somehow the /CVC-page doesn't show. Is something wrong with my menu_hook function?

Comments

imranweb’s picture

Hi,

I couldn't find menu hook for /CVC-page in your code.

Where you have defined the menu for /CVC-page?

- Imran

nathan_czh’s picture

sorry, its CVC-sync, not CVC-page

imranweb’s picture

Did you clear the cache?

If not then clear the cache and try again.

nathan_czh’s picture

Still nothing

imranweb’s picture

What you see in page?

Access denied or some error?

nathan_czh’s picture

CVC-sync:
Access denied

admin/CeeVee/CVC-sync:
You do not have any administrative items.

imranweb’s picture

First run the upload.php.

If issue still exists then, follow the below steps:

- Navigate to the menu module's administration page at admin/structure/menu.
- Look for the Navigation menu and click on the List links option.
- You should have an Administer link here. Click on the reset option next to it.

-Imran

nathan_czh’s picture

Upload.php?

nathan_czh’s picture

Upload.php? or Update.php?

imranweb’s picture

Sorry,

yeah update.php

nathan_czh’s picture

I am using the recruiter distribution.(http://drupal.org/project/recruiter). There is no Administration link in the Navigation menu, and the Administration menu link in the Management menu has no rest link on it

bhatmahesht’s picture

As of drupal 7 you need to return as array to display the page

<?php
return array('#markup' => t('asd'));
?>

This will render the page

--
I am a PHP programmer. moving to become drupal programmer

nathan_czh’s picture

No effect. When I try it, I get an Access denied error

bhatmahesht’s picture

Change the permission to

<?php
'access arguments' => array('View published content');
?>

'access content' which was available in drupal 6 and was changed to 'View published content' in drupal 7.

If you want 'access content' to be available to you, then define it using hook_permissions

--
I am a PHP programmer. moving to become drupal programmer

nathan_czh’s picture

There is no change in either of the pages

bhatmahesht’s picture

Try clearing the cache each time you make changes to hook_menu

--
I am a PHP programmer. moving to become drupal programmer

Heine’s picture

'access content' is the proper machine name for the permission. See node_permission.

nathan_czh’s picture

Somehow, when i delete the original hook_menu function and pasted a new one from http://drupal.org/node/1111212 in, it worked!!!

Now my code is

<?php
function Ceevee_content_sync_menu() {
    $items = array();

    $items['admin/CeeVee/CVC-sync'] = array(
    'title' => 'CVC Sync',
    'description' => 'Configuration for CeeVee module',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('Ceevee_content_sync_form'),
    'access arguments' => array('access administration pages'),
    'type' => MENU_NORMAL_ITEM,
    );

EDIT:
I cleared the menu cache once after I deleted it, and also after I pasted the new one in.
    $items['CVC-sync'] = array(
    'title' => 'CVC Sync',
    'description' => 'sync page',
    'page callback' => 'Ceevee_content_sync_test_page',
    'access arguments' => array('access administration pages'),
    'type' => MENU_NORMAL_ITEM,
    );

  return $items;
}
?>

anyone see the difference?

Heine’s picture

'page_callback' is not a valid key :)

You also use a different permission.