0

I am still very new to drupal and have let to use all the hooks and coding needed to do everything, now I have come up with a problem, which I can not seem to fix either with a module or by looking at code posted online.

I am using the forum core module from drupal 7 to build a forum, within my page.tpl file I have the render($action_links) option printed on each page. This works fine for logged in user. It displays a 'add new forum topic' as a link. However when a non-user views the forums, its displays 'Log in to post new content in the forum'.

My problem / issue is that only the 'Log in' words are linked to the user login in page and not the whole text. I would like to move the tag drupal placed after the 'Log in' and move it to the end of the text!

I think I would have to use hook_menu something but I can't really find any information on how to do this for the $action_links. All the hook_menu options I find seem to deal with controlling the main menu output.

Any help give would be most welcome...

Thanks

Glenn Curtis

0

In D7, if you visit core FORUM module & open forum.module file you will find this code between line no 186 to 208 -

if (empty($links)) {
        // Authenticated user does not have access to create new topics.
        if ($user->uid) {
          $links['disallowed'] = array(
            '#theme' => 'menu_local_action',
            '#link' => array(
              'title' => t('You are not allowed to post new content in the forum.'),
            ),
          );
        }
        // Anonymous user does not have access to create new topics.
        else {
          $links['login'] = array(
            '#theme' => 'menu_local_action',
            '#link' => array(
              'title' => t('<a href="@login">Log in</a> to post new content in the forum.', array(
                '@login' => url('user/login', array('query' => drupal_get_destination())),
              )),
              'localized_options' => array('html' => TRUE),
            ),
          );
        }
      }

This is responsible to generate the link & text which you are talking about. But hacking core is not advisable so please find a way to do it in some other way..

  • Many thanks for the help here, I have just parked this issue for now, but will look into how to do it later but many thanks for the pointers given. – Glenn Curtis May 3 '13 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.