Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: paulscode on September 10, 2011, 02:40:14 PM

Title: How to reverse-check if WAP2 is not required (SMF 1.1.x)
Post by: paulscode on September 10, 2011, 02:40:14 PM
Hello, I am using SMF 1.1.14, and have recently been delighted to discover that my thread is listed first for the Google search "Mupen64Plus Android".  However, the link directs you to the wap2 theme (address listed ends in ";wap2").  I know that most of the people using that link do not require the wap2 version, so I'm wondering if there is a mod that I can apply that will do the opposite check that SMF normally does (i.e. check if wap2 is not required, and use the default theme instead if not).  Any ideas?

--EDIT--  If this topic fits better in the modifications section, please feel free to move it.
Title: Re: How to reverse-check if WAP2 is not required
Post by: paulscode on September 10, 2011, 04:48:30 PM
I added a workaround by inserting the following at the top of index.php:

if( isset( $_GET['topic'] ) && $_GET['topic'] == '29.25;wap2' )
{
    header( 'Location: http://www.paulscode.com/forum/index.php?topic=29.msg129#msg129' ) ;
}


This works, but it is not desirable, since topic 29.25 is the first post of page 6 for legitimate wap2 users.  It is ok for now, because the nature of the particular topic makes it unlikely that most people would be reading it from the beginning anyway (most readers will be accessing either the first post or recent posts near the end).  That being said, I would still prefer a more elegant method of doing this.
Title: Re: How to reverse-check if WAP2 is not required
Post by: Angelina Belle on September 20, 2011, 02:25:00 PM
I'm going to move this to a custom coding board.  I hope it will attract more attention there.