Project

General

Profile

Download (2.42 KB) Statistics
| Branch: | Tag: | Revision:
1
### Eclipse Workspace Patch 1.0
2
#P Drupal_CVS
3
Index: nodefamily/nodefamily.module
4
===================================================================
5
RCS file: /cvs/drupal-contrib/contributions/modules/nodefamily/nodefamily.module,v
6
retrieving revision 1.19.2.14
7
diff -u -r1.19.2.14 nodefamily.module
8
--- nodefamily/nodefamily.module	4 Oct 2007 08:53:48 -0000	1.19.2.14
9
+++ nodefamily/nodefamily.module	10 Dec 2007 09:37:36 -0000
10
@@ -31,6 +31,15 @@
11
   return $items;
12
 }
13
 
14
+/**
15
+ * Additional permission  to allow users to create profiles for other users
16
+ */
17
+function nodefamily_perm() {
18
+    return array(
19
+        'create others nodes',
20
+	);
21
+}
22
+
23
 
24
 /**
25
  * Menu callback; provide the means to add and remove relations between
26
@@ -183,7 +192,7 @@
27
         break;
28
         
29
     case 'validate':
30
-        if (!$node->nid && user_access('administer nodes')) {
31
+        if (!$node->nid && ( user_access('administer nodes') || user_access('create others nodes')) ) {
32
           if ($account = user_load(array('name' => $node->name))) {
33
             $node->uid = $account->uid;
34
           }
35
@@ -198,7 +207,14 @@
36
         }
37
         break;
38
     case 'submit':
39
-        if ($node->nid && user_access('administer nodes')) {
40
+        // adjust uid if $node->nid && user_access('create others nodes'):
41
+        // since node_submit() is not aware of 'create others nodes'!!
42
+        if (!$node->nid && $node->type != 'usernode' && user_access('create others nodes')) {
43
+          if ($account = user_load(array('name' => $node->name))) {
44
+            $node->uid = $account->uid;
45
+          }
46
+        }
47
+        if ($node->nid && ( user_access('administer nodes') || user_access('create others nodes') ) ) {
48
           $parents = nodefamily_get_parent_types($node->type);
49
           $children = nodefamily_get_child_types($node->type);
50
           $oldnode = node_load($node->nid);          
51
@@ -256,7 +272,7 @@
52
   }
53
   else if (($form['#node_type']) && $form['#node_type']->type .'_node_form' == $form_id) {
54
     $node = $form['#node'];
55
-    if (!$node->nid && !user_access('administer nodes') && nodefamily_content_type_is_max($node->type, $node->uid)) {
56
+    if (!$node->nid && !user_access('administer nodes') && !user_access('create others nodes') && nodefamily_content_type_is_max($node->type, $node->uid)) {
57
       drupal_set_message(t("You can't create any more nodes of this type."), 'error');
58
       $form = NULL;
59
     }
    (1-1/1)