Hi All,
Actually my requirement is create a contact page for user and all the contact details should be showed in content page as a tab after comments tab at admin side using module. For this I have created a module and using this module I have created a contact page for user and also created database table to store contact details.
Now I am facing the issue i.e., when I tried to show the contact user details in a tab in Content page after comments it is not working. I am able to create a tab, when it is clicked content is not showin. Can anyone help me in this. I used below code to create a tab and displaying content.
function new_menu() {
$items['new'] = array(
'title' => 'Contact',
'page callback' => 'drupal_get_form',
'page arguments' => array('new_form'),
'access arguments' => array('new module'),
// 'access callback' => TRUE
);
$items['admin/content/contacts'] = array(
'title' => 'Contacts',
'description' => "Manage your site's book outlines.",
'page callback' => 'drupal_get_form',
'page arguments' => array('node_admin_content123'),
'access arguments' => array('new module'),
'type' => MENU_LOCAL_TASK,
);
return $items;
}
function node_admin_content123($path) {
if ($path == 'admin/content/contacts') {
echo '
' . t('New module contact page') . '
' .
'
' . t('contact description...') . '
';
}
}
what code should i write to display content when I clicked custom tab in content page.
Thanks Inadvnace...
Comments
First, if you wrap your code
First, if you wrap your code in <?php ?> tags, it will be easier for us to read.
Next, you are setting the 'page callback' for your tab as 'drupal_get_form', but the function you are passing as page arguments is not a form definition. Instead, you should do this:
Finally, you don't echo values in a page callback, you return them. So you should be doing this:
Thank you for your reply
Thank you for your reply Jaypan. And I am getting error like "Fatal error: Unsupported operand types in /opt/lampp/htdocs/drupal7/includes/form.inc on line 1079" when I tried to use the above code. Please help me.
You need to clear the Drupal
You need to clear the Drupal cache after you change the code.
I have cleared the Drupal
I have cleared the Drupal Chache still problem exists. This is my code.
Jaypan, I think now you are
Jaypan, I think now you are able to read.. please check my code once..
You didn't change your hook
You didn't change your hook_menu() definition as I showed.
Thanks Jaypan it works but I
Thanks Jaypan it works but I am getting a Notice like "Notice: Undefined variable: output in node_admin_content123() (line 34 of /opt/lampp/htdocs/drupal7/sites/all/modules/new/new.module)."
And also I have a doubt, can I write the code in the below function to get users list from database table?
Show your actual function.
Show your actual function. Can't help with the reason you are getting the error if you don't show your code.
Thank you for your support
Thank you for your support Jaypan, actually the above issue resolved. And now I am able to display user contact information in the Cotact Tab in Content page. I have used the below code..
But now my requirement is, I need to display an Edit or Delete after each user record for Admin. By this Admin can have a privilage to do edit or delete the user information.