You are here

function og_test_my_content in Organic groups 7.2

Page callback for displaying nodes for the current user.

1 string reference to 'og_test_my_content'
og_test_menu in tests/og_test.module
Implements hook_menu().

File

tests/og_test.module, line 83
Test module for OG.

Code

function og_test_my_content() {
  global $user;
  $nodes = node_load_multiple(array(), array(
    'uid' => $user->uid,
  ));
  $table = array(
    '#theme' => 'table',
    '#header' => array(
      t('Title'),
      t('Operations'),
    ),
    '#rows' => array(),
  );
  foreach ($nodes as $node) {
    $operations = array();
    if (node_access('view', $node)) {
      $operations['view'] = l(t('view'), 'node/' . $node->nid);
    }
    if (node_access('update', $node)) {
      $operations['update'] = l(t('edit'), 'node/' . $node->nid . '/edit');
    }
    if (node_access('delete', $node)) {
      $operations['delete'] = l(t('delete'), 'node/' . $node->nid . '/delete');
    }
    $table['#rows'][$node->nid] = array(
      check_plain($node->title),
      implode(' | ', $operations),
    );
  }
  return $table;
}