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

Organics groups module

Hello ,

I am currently looking to understand how the organic groups module works so that i contribute to its development but i am having difficulty understanding from the code how a "delete" button is showing on a group "page" published by an ordinary group subscriber when viewed by a moderator. I can't see how this should be after treading through the code , here's what i have found..

The delete button on the group "page" is rendered here

node.module
1275
/**
* Generate the node editing form.
*/
function node_form($edit) {
..
1364
if ($edit->nid && node_access('delete', $edit)) {
$output .= form_submit(t('Delete'));
}

so node_access() ultimately determines whether this button is rendered on the "page"

821
...
function node_access($op, $node = NULL, $uid = NULL) {

1856 calling og_access or page_access ?
$access = module_invoke(node_get_module_name($node), 'access', $op, $node);
if (!is_null($access)) {
return $access; // returning from here
}

from within node access i know that node_access returns here to node_form
after calling the hook page_access with $op and $node as arguments

page.module

35

function page_access($op, $node) {
global $user;

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

if ($op == 'update' || $op == 'delete') {
if (user_access('edit own pages') && ($user->uid == $node->uid)) {

Redefine the "author" input form for a new node type

Hello,

I have created a new node type: "article".
I (the editor in chief) am the only person with the power of creating new articles. When I do so, I would like to "pick" a user from the ones who have "magazine_author" as a role.

Is it possible to change the way the input for the node's author is handled, so that it gives me a list?
Right now, my node_article_form function looks like this:

I need a DATE! Ok ok - I need dates to work!

Hi

I am stuck with dates. I have a node form where the user can enter a date - and I cna even store it correctly! But when I try to edit the node all comes crashing down around me :(

Details:
In my form I generate the date field like this:

<?php
  $form['startdate'] = array(
  '#type' => 'date',
  '#title' => t('Start Date'),
  '#default_value' => $node->startdate,
  '#description' => "The date on the competition will be open to entries.",
  '#required' => TRUE,
  );
?>

It shows up fine on the page and I can enter the date fine.
I store it in my database in a field " startdate int(11) NOT NULL " using this code in my insert hook:

<?php
    db_query("INSERT INTO fhsstadmin_competition (nid,startdate,enddate) VALUES (%d,%d, %d)",
        $node->nid,
        mktime(12,0,0,$node->startdate['month'],$node->startdate['day'],$node->startdate['year'])- $user->timezone,
        mktime(0,0,0,$node->enddate['month'],$node->enddate['day'],$node->enddate['year'])- $user->timezone
        );
?>

And when I view it using:

<?php
format_date($node->startdate,'short')
?>

It looks fine when I do this. So far so good. But when I try to edit the node I get an error

Fatal error: Cannot create references to/from string offsets nor overloaded objects in /var/www/FHSST2/includes/form.inc on line 310

How do I... enable CSS for a homegrown module

Hi, question from a noobie.

I have created a new module for my own use. I have uploaded it to my installation and it's working fine.

Now I've created a CSS file for the module, but I'm not sure how to get drupal to use it. Does drupal 'automagically detect' this CSS file or do I need to code something somewhere?

I have searched the docs but can't find the answer.

Yours naively, Lucy C

Q: Is there a module that links certain keywords on a page?

I was wondering if there was a module that would be able to take certain keywords from the page and then parse them as links to a certain location. This way, all the pages on a site would all interlink with each other much better. Does this make sense? Do you think something like this exists or would be a good idea?

Thanks!

Need help with Mail setup in XAMPP local install

I have xampp installed with Drupal 4.7b5 running. I have Mercury Mail running. But I'm missing something in the mail setup that's producing the error below:

warning: mail() [function.mail]: SMTP server response: 550 Address '' not known here. in C:\XAMPP\htdocs\drupal47b5\modules\user.module on line 400.

I think that once I get this problem resolved, I'll have a local install up and running, but at this point, I'm lost and need some guidance. It's probably a really basic setup step that I've missed or messed up.

Roger

Pages

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