This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Newbie: Problem getting MENU_CALLBACK to work

I am writing a new module called mynode.module for learning the drupal system. The trouble is that I cant get the http://mysite.com/?q=mynode to get to generate what I want. I get a "Page Not Found".

My mynode_menu is as follows:

/**
 * Implementation of hook_menu().
 */
function mynode_menu($may_cache) {
  $items = array();

  if ($may_cache) {
    $items[] = array('path' => 'node/add/mynode', 'title' => t('New node type'),
      'access' => mynode_access('create', NULL));
    $items[] = array('path' => 'mynode', 'title' => t('New node type entries'),
      'callback' => 'mynode_page', 
      'access' => TRUE,                  /* Allow access for anybody */
        'type' => MENU_CALLBACK);
  }

  return $items;
}

I have coded mynode_page similar to blog_page_last() in the blog.module(basically, it generates last few posts of 'mynode' type). Still when I go to http://mysite.com/?q=mynode to get to generate what I want. I get a "Page Not Found" error.
What could be the reason that ?q=mynode is not recognized? Am I doing anything wrong in the hook_menu? How can I debug this?

Little bit background into what I did:
I started from page.module & changed it for mynode.module. In the process i created mynode_form, mynode_validate, mynode_insert, mynode_load, mynode_view as per documentation at 4.6 node_example.module

nodeapi view problem

I have this code in my googlemap.module file:

function googlemap_nodeapi(&$node, $op, $teaser = NULL $page = NULL) {
  switch ($op) {
     case 'view':	
      if (!$teaser) {
       $map = googlemap_single();
       $node->body = $map . $node->body;
       }
       break;
}
}

It does what I want--it inserts the output of googlemap_single() at the end of $node->body.

Ecommerce Promotional Code

How do you implement a promo code feature?

A settings page where you can input a promo code?
A user box to input a promo code - which checks against the database which approves the discount...

I am just a novice... so please be nice :)

Session ID / User ID test php snippet

Just testing out some code... and learning php at the same time :)


  if ($user->uid) {
    print $user->uid;
	print " : This is your user ID";
  }
  elseif ($sid = session_id()) {
    print $sid;
	print " : This is your Session ID";
  }

This code should print out your UID if logged in or your session id if you are just a visitor.... right?

Why then if I pasted this in a page with php input, I always get my session ID but not my User ID when I'm logged in?

Newbie help please!

Hi, for the last few months I have been looking for a CMS for a new website I want to make, its for a flower export company.

Now I have installed and tried about 7 differant ones so far but running into Drupal seems I have found what I need :)

Let me explain what I need this website to do for me, it has to be pretty simple, but needs away to let customers place there order for flowers online, they get invoiced so no need for a payment thingy.

Modification to the LDAP_integration Module

I have made a modification to the LDAP_integration Module that for users to login using "Friendly Names", nicknames and such. The reasoning behind this is that the CN of a user in an LDAP database can sometimes be fairly cumbersome as most of us know, I for example would be Jeremy G. Devoid on the server I am connecting to. To make sign-ins easier I have created a "Friendly Name Lookup" additon to the LDAP module, it is optional and the admin can turn it on or off. The look up is based on key fields, on the LDAP server, that he admin desires, such as the cn and nickname fields.

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions