More access permissions

Events happening in the community are now at Drupal community events on www.drupal.org.
dmiric's picture

Hi,

Could anyone help me a little. I'm trying to modify Content Profile module so I can add more permissions exept administer nodes that can create a profile for other users. Since there are many places in the code that deal with access permissions I can't seem to find the right spot to add 1 more permission.

This seems to be the right place for that:


function content_profile_page_access($type, $account) {
  if ($node = content_profile_load($type, $account->uid)) {
    return node_access('update', $node);
  }
  // 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') ){
    return node_access('create', $type);
  }
  return FALSE;
}

but when I try to do something like

function content_profile_page_access($type, $account) {
  if ($node = content_profile_load($type, $account->uid)) {
    return node_access('update', $node);
  }
  // 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') || user_access('permission') ){
    return node_access('create', $type);
  }
  return FALSE;
}

Where permission is properly named permission from the list it dosent work. I also tried adding "|| user_access('permission')" to other places in code where user_access('administer nodes') shows up but no luck still cant make it work.

Comments

add taxonomy info on profile view

orfils's picture

Quick solution in 'content_profile.theme.inc'

add in content_profile_preprocess_content_profile_display_view function

$variables['content'] = node_view($node, ($element['#style'] == 'teaser'), TRUE, TRUE);

+ $variables['content'] .= content_profile_process_taxonomy($node);

and at the end the calling function :

function content_profile_process_taxonomy($node) {
$output = ' ';
$vocabularies = taxonomy_get_vocabularies();
foreach($vocabularies as $vocabulary) {
if ($vocabularies) {
$terms = taxonomy_node_get_terms_by_vocabulary($node, $vocabulary->vid);
if ($terms) {
$output .= '<div class="field">>'
$output .= '<div class="field-label">'
$output.=$vocabulary->name.
$outout.=': </div>';
$output .= '<div class="profile-taxonomy">';
foreach ($terms as $term) {
$trm[] = t($term->name);
}
$output .= implode(', ', $trm);
$output .= '</div></div>';
}
}
}
return $output;
}

Pierre Orfinger
Schaveyslaan 34
1650 BEERSEL
Belgium
pierre@orfinger.be
+32 475443959

Profiles as nodes

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week