1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Option to remove cookie help page

Discussion in 'XenForo Suggestions' started by ragtek, Jul 17, 2012.

  1. ragtek

    ragtek Guest

    pls make the new cookie help page, which was included in 1.1.3 optional (like the terms page).

    (anybody have a idea how i can remove the link without tms?)
     
    Spoky, Omega, RobinHood and 2 others like this.
  2. Chris D

    Chris D XenForo Developer Staff Member

    You can remove it by modifying the contents of the help_sidebar_links hook if you want to do it in an add-on way.

    This is the link in the sidebar in the help_wrapper template:
    <li><a href="{xen:link help/cookies}" class="{xen:if "{$selected} == 'cookies'", 'secondaryContent', 'primaryContent'}">{xen:phrase cookie_usage}</a></li>

    I guess you could remove it from the main help_index with a templatePostRender?
     
    ragtek likes this.
  3. ragtek

    ragtek Guest

    thx
    i've tried to remove it with regex on templatePostRender, but complex regex is still too complicated for me, that's why it didn't work
    now i'm doing it probably the dirty way, but it's working..:D

    i've tried to build an regex to search for
    Code:
    <li><a href="help/cookies" ...>...</a></li>
    



    if anybody else is interessted:
    this templatehook code will remove the links from the help navbar menu and help sidebar menu:
    PHP:
                switch ($name){
                    case 
    'help_sidebar_links':
                        
    $remove '<li><a href="help/cookies" class="primaryContent">' . new XenForo_Phrase('cookie_usage') . '</a></li>';
     
                        
    $contents str_replace($remove,''$contents);
     
                        break;
                    case 
    'navigation_tabs_help':
                        
    $remove '<li><a href="help/cookies">' . new XenForo_Phrase('cookie_usage').'</a></li>';
                        
    $contents str_replace($remove,''$contents);
                        break;
                }
     
    Chris D likes this.
  4. Luxus

    Luxus Well-Known Member

    Will this code remove the cookie page entirely? Meaning if people visit "...help/cookies" they would get a 404 error page?
     
  5. Jeremy P

    Jeremy P Well-Known Member

  6. Luxus

    Luxus Well-Known Member

    And how do I do this?
     
  7. Chris D

    Chris D XenForo Developer Staff Member

    This could be made into an add-on, but here's a code edit:

    library/XenForo/ControllerPublic/Help.php

    Find:

    PHP:
        public function actionCookies()
        {
            return 
    $this->_getWrapper('cookies',
                
    $this->responseView('XenForo_ViewPublic_Help_Cookies''help_cookies')
            );
        }
    Replace With:

    PHP:
        public function actionCookies()
        {
            return 
    $this->responseError(new XenForo_Phrase('requested_page_not_found'), 404);
        }
    Actually... **** it... I will create an add-on for this.
     
    Luxus likes this.
  8. Luxus

    Luxus Well-Known Member

    Thank you, you are awesome :D
     
    Chris D likes this.
  9. Chris D

    Chris D XenForo Developer Staff Member

    Luxus likes this.
  10. Luxus

    Luxus Well-Known Member

    Wow, that was quick. Outstanding work :)
     
    Chris D likes this.

Share This Page