Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: Biology Forums - elokuu 06, 2013, 12:31:59 AP

Otsikko: What 'action' is this?
Kirjoitti: Biology Forums - elokuu 06, 2013, 12:31:59 AP
I'd like you to visit this example page (yes, it's a login/error page):

http://biology-forums.com/index.php?topic=808682

I'll like to know what 'action' this page belongs to so that I could code something to appear while in this action.
Otsikko: Re: What 'action' is this?
Kirjoitti: Sorck - elokuu 06, 2013, 06:32:40 AP
That page appears because of a failed isAllowedTo('my_permission_here') call usually. It's slightly more complicated when it's on a topic page as it also considers the board that it's in so it might actually look more like isAllowedTo('view_topic', $id_board). Check out the isAllowedTo() function docs (http://support.simplemachines.org/function_db/index.php?action=view_function;id=409) for more info on how it works.

As it's on a topic page it will be called in Display.php. The actual error page I assume is in Errors.template.php though I could be wrong.
Otsikko: Re: What 'action' is this?
Kirjoitti: Biology Forums - elokuu 06, 2013, 11:07:56 AP
Lainaus käyttäjältä: Sorck - elokuu 06, 2013, 06:32:40 AP
That page appears because of a failed isAllowedTo('my_permission_here') call usually. It's slightly more complicated when it's on a topic page as it also considers the board that it's in so it might actually look more like isAllowedTo('view_topic', $id_board). Check out the isAllowedTo() function docs (http://support.simplemachines.org/function_db/index.php?action=view_function;id=409) for more info on how it works.

As it's on a topic page it will be called in Display.php. The actual error page I assume is in Errors.template.php though I could be wrong.

Thanks, I looked up the text string "topic_gone" in display.php and error.php, and it wasn't there :( Where else could it be?

Edit: Found it, it's in Load.php ;)
Otsikko: Re: What 'action' is this?
Kirjoitti: IchBin™ - elokuu 06, 2013, 05:01:26 IP
There is no action. The action is based upon whether you see the actual word "action" in your URL. For example:

www.yourdomain.com/index.php?action=help

Action is equal to help.

If you want to check for something specific in a page, you have to look at your URL.

if (!empty($_GET['topic']) && $_GET['topic'] == '808682')
    echo 'do something here when in topic 808682';
Otsikko: Re: What 'action' is this?
Kirjoitti: Biology Forums - elokuu 06, 2013, 10:57:36 IP
Lainaus käyttäjältä: IchBin™ - elokuu 06, 2013, 05:01:26 IP
There is no action. The action is based upon whether you see the actual word "action" in your URL. For example:

www.yourdomain.com/index.php?action=help

Action is equal to help.

If you want to check for something specific in a page, you have to look at your URL.

if (!empty($_GET['topic']) && $_GET['topic'] == '808682')
    echo 'do something here when in topic 808682';

Thanks, IchBin™