You could simply hide the button if the user is not logged in. Assuming v19.1, in your Search view you could do something like this:

Code:
    Procedure OnBeforeShow
        Boolean bLoggedIn
        //
        Get IsLoggedIn of ghoWebSessionManager to bLoggedIn
        //
        WebSet pbRender of oTheButton to bLoggedIn
    End_Procedure
End_Object
I have a login optional webapp with a login tile on the Dashboard. When the user first lands on the site, there are 4 tiles rendered. If the user logs in, the original 4 are hidden and are replaced with 6 tiles that were initially hidden. Here's the code in my Dashboard.wo.

Code:
    Procedure OnBeforeShow
        Boolean bLoggedIn
        //
        WebSet pbRender of oLogo                    to False
        WebSet pbRender of oLoginTile               to False
        WebSet pbRender of oCommentsTile            to False
        WebSet pbRender of oUserNameTile            to False
        WebSet pbRender of oPasswordTile            to False
        WebSet pbRender of oWelcomeTile             to False
        WebSet pbRender of oContactTile             to False
        WebSet pbRender of oCasesTile               to False
        WebSet pbRender of oMessageTile             to False
        WebSet pbRender of oProvidersTile           to False
        WebSet pbRender of oNewProviderTile         to False
        WebSet pbRender of oTermsGroup              to False
        WebSet pbRender of oOpenDisabilityCaseGroup to False
        //
        Send Clear     of oClient_DD
        Get IsLoggedIn of ghoWebSessionManager to bLoggedIn
        //
        If bLoggedIn Begin
            Integer iPortalID
            //
            Send UpdateHTML of oWelcomeTile ('<div class="WebCon_Sizer">' + ;
                                             '<div class="Tile_Title">Welcome</div>' +;
                                             '<div class="Tile_Subtitle">' - htmlEncode(psUserName(ghoWebSessionManager)) - '</div>' +;
                                             '</div>')
            //
            Get piPortalID of ghoWebSessionManager to iPortalID
            //
            If (iPortalID <> 0) Begin
                String sDescription
                //
                Send Clear of oClient_DD
                Move iPortalID to Client.ClientId
                Send Find of oClient_DD EQ 1
                //
                If (Found) Begin
                    Move (Trim(Client.CaseDescription)) to sDescription
                    Send UpdateHtml of oOpenCaseHtmlBox sDescription
                End
            End
            //
            WebSet pbRender of oWelcomeTile             to True
            WebSet pbRender of oContactTile             to True
            WebSet pbRender of oCasesTile               to True
            WebSet pbRender of oMessageTile             to True
            WebSet pbRender of oProvidersTile           to True
            WebSet pbRender of oNewProviderTile         to True
            WebSet pbRender of oOpenDisabilityCaseGroup to True
        End
        Else Begin
            WebSet pbRender of oLogo         to True
            WebSet pbRender of oLoginTile    to True
            WebSet pbRender of oCommentsTile to True
            WebSet pbRender of oUserNameTile to True
            WebSet pbRender of oPasswordTile to True
            WebSet pbRender of oTermsGroup   to True
        End
    End_Procedure
End_Object