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

Plugin extenders - variable which shows that page is called from Dashboard ?

edited December 2011 in Vanilla 2.0 - 2.8

For example page of UserProfile contains '/Dashboard' in the URL but is not called from a Dashboard window.
Pages Role, Settings on the contrary belong to Dashboard but not contain '/Dashboard' in the URL.

    public function Base_Render_Before($Sender) {

     if ((!(strpos(curPageURL(),"/forum/dashboard/profile/")>0)) and

        ((strpos(curPageURL(),"/forum/dashboard/")>0) or  
           (strpos(curPageURL(),"/forum/vanilla/settings")>0) or
           (strpos(curPageURL(),"/forum/role")>0) or
           (strpos(curPageURL(),"/forum/plugin")>0) ))

Is there some variable which shows that page is called from Dashboard ?

Best Answer

  • Options
    ToddTodd Chief Product Officer Vanilla Staff
    Answer ✓

    We currently use this:

    if ($Sender->MasterView == 'admin') {
        ...
    }
    

    or

    if (Gdn::Controller()->MasterView == 'admin') {
        ...
    }
    

Answers

  • Options
    ToddTodd Chief Product Officer Vanilla Staff
    Answer ✓

    We currently use this:

    if ($Sender->MasterView == 'admin') {
        ...
    }
    

    or

    if (Gdn::Controller()->MasterView == 'admin') {
        ...
    }
    
  • Options

    tnx. this saves a lot of bad coding.

Sign In or Register to comment.