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.
Options

how to make my plugin works on every page?

wzttest1wzttest1 New
edited April 2013 in Vanilla 2.0 - 2.8

Hi:
How to make my plugin works on every page except the backend web pages?
Should I add a method named Base_Render_Before(&$Sender) in my plugin?
Thanks.

Comments

  • Options

    but Base_Render_Before looks can not work for me.

  • Options

    Anybody can help for this?

  • Options

    Sure, but not within a couple of hours. First post : 4:56 AM, second post : 5:06 AM, last post : 9:25 AM. Give it some time. Also post your VANILLA VERSION.

    There was an error rendering this rich post.

  • Options

    Should I add a method named Base_Render_Before(&$Sender) in my plugin? Thanks.

    no for any function...

    you should always use ($Sender) not (&$Sender)

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    hgtonighthgtonight ∞ · New Moderator

    I would suggest looking at others' work in the addons section for inspiration.

    Or just inspect the $Sender variable to see what is in there.

    //This is a common hook that fires for all controllers on the Render method
    public function Base_Render_Before($Sender) {
      // only execute on controllers that aren't using the dashboard view
      if($Sender->MasterView != 'admin') {
        // interesting code would go here
    
      }
    }
    

    To re-iterate @peregrine's point. Do not explicitly pass a variable by reference. PHP implicitly passes objects by reference. To wit, using &$Sender is unsupported in the 2.1 branch.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    @peregrine said:

    Hi:
    I'm useing vanilla 2.0.18.4 version,should I always use ($Sender) not (&$Sender)?

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    I'm useing vanilla 2.0.18.4 version,should I always use ($Sender) not (&$Sender)?

    Yes always use ($Sender) . We are changing all plugins to not have & .

    You should update to 2.0.18.8 for security reasons.

  • Options

    @hgtonight said:
    I would suggest looking at others' work in the addons section for inspiration.

    Or just inspect the $Sender variable to see what is in there.

    //This is a common hook that fires for all controllers on the Render method
    public function Base_Render_Before($Sender) {
      // only execute on controllers that aren't using the dashboard view
      if($Sender->MasterView != 'admin') {
        // interesting code would go here
    
      }
    }
    

    To re-iterate peregrine's point. Do not explicitly pass a variable by reference. PHP implicitly passes objects by reference. To wit, using &$Sender is unsupported in the 2.1 branch.

    Hi:
    I referenced your code to make my code more strong:
    if (($_REQUEST['p'] && strpos($_REQUEST['p'], '/dashboard') === 0) || $Sender->MasterView == 'admin') { //filter the backend page

    Thanks!

Sign In or Register to comment.