Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Rename menu discussions link

I'm trying to rename the 'Discussions' link to Recent Discussions (vanilla 2.1):

In the Base_Render_Before hook I've got:

public function Base_Render_Before($Sender, $Args) {
$Sender->Menu->Items['Discussions'][0]['Text'] = T('Recent Discussions');
}

The above code isn't working. Where should I do this?

Comments

  • ShadowdareShadowdare r_j MVP
    edited January 2014

    IIRC, it's not possible to do it that way. Here are other ways you can change the link:

    • You can create a /conf/locale.php file and add these lines:
    <?php if(!defined('APPLICATION')) exit();
    
    $Definition['Discussions'] = 'Recent Discussions';
    

    This may affect other strings that use the same localization.

    • Remove {discussions_link} from your theme's default.master.tpl and add in a custom link.

    • You can use JavaScript or CSS to change the text.

    Add Pages to Vanilla with the Basic Pages app

  • Seems to me this is something that should be done using a hook. As other plugins could interact with the menu as well.

  • R_JR_J Ex-Fanboy Munich Admin

    I don't know which hook would be best, but class.sidemenumodule.php has a RemoveLink() function which might be useful for you in addition with the AddLink function.

  • ShadowdareShadowdare r_j MVP
    edited January 2014

    @wouter said:
    Seems to me this is something that should be done using a hook. As other plugins could interact with the menu as well.

    The "Discussions" link has the "Standard" attribute set to TRUE, so using a hook with the RemoveLink method will empty out the array $Sender->Menu->Items['Discussions'], but the link will still be in the main menu because the link gets outputted by the {discussions_link} in the default.master.tpl file, which you can safely remove or comment out.

    Add Pages to Vanilla with the Basic Pages app

Sign In or Register to comment.