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

Tutorial node module access permissions

I'm creating a new node - a tutorial. It's purpose is to record tutor-student tutorials/interviews. I've got most of it working, just have a problem the access. There are two roles -tutor and student. I want:

  • Any tutor to be able to create, read and edit any tutorial record
  • Only the authoring tutor can delete a tutorial
  • Of the students, only the tutorial's student can view the tutorial

Here's the code:

<?php
/**
* Implementation of hook_perm().
* Define the permissions this module uses
*/
function tutorial_perm() {
return array('view tutorials', 'create tutorials', 'manage tutorials');
}

/**
* Implementation of hook_access().
*/
function tutorial_access($op, $node) {
global $user;

// Either any tutor or the tutorial's student can view the tutorial
$tut = db_fetch_object(db_query('SELECT t.sid FROM {tutorial} t WHERE t.nid = %d', $node->nid));
if($op == 'access') {
return (in_array('tutor', $user->roles) || ($user->uid == $tut->sid));
}

if ($op == 'create') {
return user_access('create tutorials');
}

// Any tutor can update the tutorial.
if ($op == 'update') {
return user_access('manage tutorials');
}

// Only the authoring tutor can delete the tutorial.
if ($op == 'delete') {
return (user_access('manage tutorials') && ($user->uid == $node->uid));
}

Dynamic Fields

I am working on a module that uses a but of javascript to add dynamic fields to the form. When I hit submit and begin verifying the input via the drupal_get_form("contact_insert_form",$form) call back, I have noticed that my dynamic fields are not added as elements in the $edit variable array. Is there a step I am missing?

I am inserting the dynamic fields using HTML similar to what Drupal generates:

StaffBio Module 4.6 -> 4.7

Hi!

I'm quite new to this, so please forgive me my beginner's ignorance...

I'm currently trying to get the StaffBio module working for my Drupal 4.7.3 installation... I converted the form elements with the automated tool, and changed the return values. The settings-page seems to work fine, and the content type is displayed in the menu. But the menu entry doesn't do anything... I assume this is due to invalid form porting (everything else should work as fine in 4.7 as it did in 4.6, right?), so below are the two blocks I edited (original code commented out).

I would be really grateful if someone could tell me what I did wrong there...
Thanks in advance!

Developer Needed: Groups Hierarchy Module

I know that there are a few workarounds for this, but I'd like to get a Group hierarchy module developed that allows top level groups to have subgroups.

What should be included:

workspace+cck

I am using workspace and cck to make a list of everything a user has created. when workspace displays my custom made cck nodes there are no operations next to it (edit, delete) but when it displays the page node the operations are there. i'm sure it's just a simple setting but does anyone know how to display the edit and delete operations next to cck nodes in the workspace module view?

Install Module sitemap?

I see the module Sitemap in site drupal.org used for Drupal, but when I set it up for my site (on localhost), it doesn't work.
How can i fix this problem?
Please help me .
Thanks!
Savi.

Pages

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