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

Spice menu item into LOCAL_TASK tree?

Hi all,

I am building a community website with user profile pages using a separate theme template from the main site. Here is a sample of what the user/profile page looks like:

profile page.

The menu bar at the top of the user page is the primary tab of the user menu tree. I've added the blog item menu and listing by modifying the blog.module in this manner:


function blog_menu($may_cache) {
global $user;
$items = array();

if ($may_cache) {
$items[] = array('path' => 'node/add/blog', 'title' => t('blog entry'),
'access' => user_access('edit own blog'));
$items[] = array('path' => 'blogs', 'title' => t('blogs'),
'callback' => 'blog_page',
'access' => user_access('access content'),
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'blogs/'. $user->uid, 'title' => t('my blog'),
'access' => user_access('edit own blog'), 'type' => MENU_DYNAMIC_ITEM);
}
else {
if (arg(0) == 'user' && is_numeric(arg(1))) {
$items[] = array(
'path' => 'user/'. arg(1) . '/blogs', 'title' => t('blog'),
'callback' => 'blog_page', 'access' => user_access('access content'),
'type' => MENU_LOCAL_TASK, 'callback arguments' => array(arg(1)));
$items[] = array(
'path' => 'user/'. arg(1) . '/blogs/node/' . arg(4), 'title' => t('Blog Entry'),

Strange behaviour using the forms API

I've just begun converting my home-grown modules to 4.7, and of course the first thing I worry about is the admin form. After a bit of mucking about, much helped by the very useful Quickstart guide, and the also very useful converter kindly hosted by Lullabot. I have managed to get a form to display correctly, with default values in it, and to get the "_submit" function to, err... function. After a fashion...

Here is the code for my "submit" button:

   $form['titles_press_button'] = array(
   	'#type' => 'submit',
	'#value' => t('Update'),
	);

I then handle the submit using an appropriately named function, as thuswise:
<?php
function titles_admin_form_submit($form_id, $form_values) {
$edit = $_POST['edit'];

$result = db_query('DELETE FROM {titles_settings}');
for ($i = 0; $i < $form_values['titles_count']; $i++) {
if ($edit["titles_display_name_$i"] != '') {
if ($edit["titles_weight_$i"] == '') {$edit["titles_weight_$i"] = 0;}
if ($edit["titles_days_up_$i"] == '') {$edit["titles_days_up_$i"] = 0;}
db_query("INSERT INTO {titles_settings} (uid, display_name, which_column, weight, days_up) VALUES ('%d', '%s', '%d', '%d', '%d')", $edit["titles_uid_$i"], $edit["titles_display_name_$i"],$edit["titles_which_column_$i"],$edit["titles_weight_$i"], $edit["titles_days_up_$i"]);

Can I add 'non-node' link to the create content page?

Hope I can explain this properly... I don't wish to create a new node type but I DO want to have a link to create a new type on the 'create content' page. Now I'm soooo nearly there and I just can't work out what I'm missing.

I've got set up:

hook_node_info
hook_help
hook_menu

Is there anything else I need to do? Currently the module displays all the menu links under 'create content' menu item but displays nothing on the actual page body itself. If it helps, here's the menu hook I'm using (which obviously works) it's more or less the same code for the other hooks too:

<?php
foreach (tablemanager_tables() as $no => $table) {

$items[] = array('path' => 'node/add/tablemanager-'.$no, 'title' => t($table['name']),
'callback' => 'tablemanager_add',
'access' => user_access("create '". $table['name'] ."' content") or $admin_access,
'type' => MENU_NORMAL_ITEM);
$items[] = array('path' => 'tablemanager/edit', 'title' => t("Edit Table '".$table['name']."' Entry"),
'callback' => 'tablemanager_edit',
'access' => user_access("edit own '". $table['name'] ."' content") or $admin_access,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'tablemanager/delete', 'title' => t("Delete Table '".$table['name']."' Entry"),

select issue

I'm busy writing a new node type for use with the event and signup modules. This node will (eventually) include several fields for use in the calendar, as well as a function to define a minimum number of participants for each event. (So that when this number isn't reached by the time the notification is sent out, the event is cancelled and a different notification is sent) that's all still to come though.

Right now I have a (hopefully simple) priblem with just my form. I cannot seem to figure it out, so perhaps one of you can help me:

Given the following code:

$form['min_parts'] = array(
        '#type' => 'select',
        '#name' => 'min_parts',
        '#title' => t('Minimum number of participants'),
        '#value' => $node->min_parts,
        '#options' => array('0', '1', '2', '3', '4',
                            '5', '6', '7', '8', '9',
                            '10', '15', '20', '25', '30',
                            '35', '40', '45', '50', '60',
                            '70', '80', '90', '100', '250',
                            '500', '750', '1000', '1500', '2000'),
        '#description' => t('The minimum number of participants required to have the event go through'),
        '#extra' => FALSE,
        '#multiple' => FALSE,
        '#required' => TRUE
        );

and lower down:

<?php

Content Construction Kit Search Engine

Hi there,

I want to say that I'm very happy of Drupal and I use the CCK module to create many content types.

I have created a "special content type" that I use to create search forms for some of my content types. This "special content type" just store the information about the search form like the sort order, the searchable fields... Then I use a special theme to generate the form, validate it and query the database.

Banner Module CVS for Drupal4.7

Hello
I have installed the banner module CVS and managed to upload a banner
in the admin and set up a block with the php command line

return banner_display(); 

However I now get only

return banner_display(); 

in the block instead of the image.
Please see http://paratlane.net Left menu top.

Pages

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