Skip to content

Instantly share code, notes, and snippets.

@bcmiller
Created June 2, 2010 15:51
Show Gist options
  • Save bcmiller/422557 to your computer and use it in GitHub Desktop.
Save bcmiller/422557 to your computer and use it in GitHub Desktop.
Index: content_profile.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/content_profile/Attic/content_profile.module,v
retrieving revision 1.1.2.48
diff -u -p -r1.1.2.48 content_profile.module
--- content_profile.module 7 Apr 2010 15:09:17 -0000 1.1.2.48
+++ content_profile.module 2 Jun 2010 15:50:55 -0000
@@ -24,6 +24,14 @@ function content_profile_ctools_plugin_d
}
/**
+ * Implementation of hook_nodeapi().
+ */
+ function content_profile_perm() {
+ return array('administer content profile nodes');
+}
+
+
+/**
* Implementation of hook_menu().
*/
function content_profile_menu() {
@@ -41,7 +49,7 @@ function content_profile_menu() {
'page callback' => 'drupal_get_form',
'page arguments' => array('content_profile_admin_settings', $type),
'access callback' => 'user_access',
- 'access arguments' => array('administer nodes'),
+ 'access arguments' => array('administer content profile nodes'),
'type' => MENU_LOCAL_TASK,
'weight' => 1,
);
@@ -91,7 +99,7 @@ function content_profile_page_access($ty
// Else user may view the page when they are going to create their own profile
// or have permission to create it for others.
global $user;
- if ($user->uid == $account->uid || user_access('administer nodes') ){
+ if ($user->uid == $account->uid || user_access('administer content profile nodes') ){
return node_access('create', $type);
}
return FALSE;
@@ -375,15 +383,16 @@ function _content_profile_node_delete($n
* Implementation of hook_nodeapi().
*/
function content_profile_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
+ global $last_nid;
- if ($op == 'prepare' && is_content_profile($node) && !isset($node->nid) && $node->uid && !user_access('administer nodes') && arg(0) != 'admin') {
+ if ($op == 'prepare' && is_content_profile($node) && !isset($node->nid) && $node->uid && !user_access('administer content profile nodes') && arg(0) != 'admin') {
// Check if this nodetype already exists
if ($nid = content_profile_profile_exists($node, $node->uid)) {
// This node already exists, redirect to edit page
drupal_goto('node/'. $nid .'/edit', 'destination=user/'. $node->uid);
}
}
- elseif ($op == 'validate' && is_content_profile($node) && user_access('administer nodes')) {
+ elseif ($op == 'validate' && is_content_profile($node) && user_access('administer content profile nodes')) {
$form = $a3;
// Only validate if the user-name changed or we add a new node
if (!empty($node->nid) && $form['author']['name']['#default_value'] == $node->name) {
@@ -538,7 +547,7 @@ function content_profile_show_profiles($
// Working around the bug described at http://drupal.org/node/302873
module_load_include('inc', 'content_profile', 'content_profile.theme');
}
- elseif (user_access('create '. $type .' content') && content_profile_get_settings($type, 'add_link') && !$node && ($uid == $user->uid || user_access('administer nodes'))) {
+ elseif (user_access('create '. $type .' content') && content_profile_get_settings($type, 'add_link') && !$node && ($uid == $user->uid || user_access('administer content profile nodes'))) {
$content['content_profile_'. $type] = array(
'#admin' => $uid != $user->uid,
'#theme' => 'content_profile_display_add_link',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment