Hard-coding 'return to topic after post'

Started by samborabora, March 16, 2014, 10:01:19 AM

Previous topic - Next topic

margarett

Yeah that's just a matter of preference. I like to return to topic, Kindred obviously doesn't :P

In any case, the big point is: if you FORCE it on your users, they might riot :P

Quote from: samborabora on May 04, 2015, 01:17:42 AM
Quote from: margarett on May 03, 2015, 08:29:46 PM
I am looking at that theme now (on the computer) and it seems it has no way of accessing admin panel correctly... Probably because it is meant to use on the phone without all the functionality of the desktop version...

You can probably hackishly force the back to topic behavior in Sources/Post.php (because there is the place where the redirect after post is decided)

Quote from: Illori on May 02, 2015, 07:13:12 AM
then i copied from the default theme Settings.template.php and Themes.template.php

that seems to add the options in admin, or you can just change the theme number in your browser url, can you see if it works after that?
I'll check.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

samborabora

Quote from: margarett on May 04, 2015, 05:29:37 AM
Yeah that's just a matter of preference. I like to return to topic, Kindred obviously doesn't :P

In any case, the big point is: if you FORCE it on your users, they might riot :P

Quote from: samborabora on May 04, 2015, 01:17:42 AM
Quote from: margarett on May 03, 2015, 08:29:46 PM
I am looking at that theme now (on the computer) and it seems it has no way of accessing admin panel correctly... Probably because it is meant to use on the phone without all the functionality of the desktop version...

You can probably hackishly force the back to topic behavior in Sources/Post.php (because there is the place where the redirect after post is decided)

Quote from: Illori on May 02, 2015, 07:13:12 AM
then i copied from the default theme Settings.template.php and Themes.template.php

that seems to add the options in admin, or you can just change the theme number in your browser url, can you see if it works after that?
I'll check.

Oh, the option has been removed from my templates, along with most options... it's kind of a "my way or the highway" deal :D But seriously, if it CAN be sorted out without forcing in POST.php, it would be great!

Kindred

so - add it back in to the template settings?


Although - if the value is NOT set for a specific theme, it defaults to use the default theme settings...

(this, of course, assumes that there is not a lingering setting in the database from a previous theme with that ID)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

samborabora

Quote from: Kindred on May 04, 2015, 09:21:21 AM
so - add it back in to the template settings?


Although - if the value is NOT set for a specific theme, it defaults to use the default theme settings...

(this, of course, assumes that there is not a lingering setting in the database from a previous theme with that ID)

Okay, if I've cloned template.settings from default into the smf4iphone folder, and default returns to topic, then one would expect smf4iphone would too, but it doesn't. So how else would I add it back to template settings?

Kindred

no. that's not how it works....  you don't CLONE anything.

If a theme does NOT have a setting, then the system will use that settings from the default theme.

If that is not happening, then you have an issue - probably from some mod...

You could, as we suggested add the settings back in....  Settings.template.php -- but copying from the default may remove custom settings that the specific theme added


--edit - sorry... settings.template.php does not control the deeper settings...
those are in the database and set here...
/index.php?action=admin;area=theme;sa=reset;
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

samborabora

Yes, I know it's set in the database, and it can't be a mod since it works for all the other themes, and it DOESN'T use the setting from default.

Quote from: margarett on May 04, 2015, 05:29:37 AM
I'll check.

Did you manage to see how it looked, Bruno?

margarett

Well the theme no (I such at themes - like in coding, generally ;D ;D ;D)

But to do what you want is easy. In Post.php, find this
}

// General function for topic announcements.
function AnnounceTopic()
{

BEFORE THAT, meaning, at the end of function Post2(), are the redirect conditions after posting. You have something like this:
// Return to post if the mod is on.
if (isset($_REQUEST['msg']) && !empty($_REQUEST['goback']))
redirectexit('topic=' . $topic . '.msg' . $_REQUEST['msg'] . '#msg' . $_REQUEST['msg'], $context['browser']['is_ie']);
elseif (!empty($_REQUEST['goback']))
redirectexit('topic=' . $topic . '.new#new', $context['browser']['is_ie']);
// Dut-dut-duh-duh-DUH-duh-dut-duh-duh!  *dances to the Final Fantasy Fanfare...*
else
redirectexit('board=' . $board . '.0');

And you just need to eliminate the last condition, eg:
// Return to post if the mod is on.
if (isset($_REQUEST['msg']))
redirectexit('topic=' . $topic . '.msg' . $_REQUEST['msg'] . '#msg' . $_REQUEST['msg'], $context['browser']['is_ie']);
else
redirectexit('topic=' . $topic . '.new#new', $context['browser']['is_ie']);


So that you will always redirect ;)

Eventually this could be tweaked to do that just on a certain theme but it should do the trick for now ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

samborabora

Quote from: margarett on May 06, 2015, 05:25:10 AM
Well the theme no (I such at themes - like in coding, generally ;D ;D ;D)

But to do what you want is easy. In Post.php, find this
}

// General function for topic announcements.
function AnnounceTopic()
{

BEFORE THAT, meaning, at the end of function Post2(), are the redirect conditions after posting. You have something like this:
// Return to post if the mod is on.
if (isset($_REQUEST['msg']) && !empty($_REQUEST['goback']))
redirectexit('topic=' . $topic . '.msg' . $_REQUEST['msg'] . '#msg' . $_REQUEST['msg'], $context['browser']['is_ie']);
elseif (!empty($_REQUEST['goback']))
redirectexit('topic=' . $topic . '.new#new', $context['browser']['is_ie']);
// Dut-dut-duh-duh-DUH-duh-dut-duh-duh!  *dances to the Final Fantasy Fanfare...*
else
redirectexit('board=' . $board . '.0');

And you just need to eliminate the last condition, eg:
// Return to post if the mod is on.
if (isset($_REQUEST['msg']))
redirectexit('topic=' . $topic . '.msg' . $_REQUEST['msg'] . '#msg' . $_REQUEST['msg'], $context['browser']['is_ie']);
else
redirectexit('topic=' . $topic . '.new#new', $context['browser']['is_ie']);


So that you will always redirect ;)

Eventually this could be tweaked to do that just on a certain theme but it should do the trick for now ;)

This SEEMS correct, but strangely enough, it just gives me

An Error Has Occurred!
Unable to load the 'main' template.


?? :D

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

samborabora

This worked!
// Return to post if the mod is on.
if (isset($_REQUEST['msg']) && !empty($_REQUEST['goback']))
redirectexit('topic=' . $topic . '.msg' . $_REQUEST['msg'] . '#msg' . $_REQUEST['msg'], $context['browser']['is_ie']);
elseif (!empty($_REQUEST['goback']))
redirectexit('topic=' . $topic . '.new#new', $context['browser']['is_ie']);
// Dut-dut-duh-duh-DUH-duh-dut-duh-duh!  *dances to the Final Fantasy Fanfare...*
else
redirectexit('topic=' . $topic . '.new#new', $context['browser']['is_ie']);
}


A real hack job, but it does what it's supposed to now, thank you Bruno!!

14 months later, we have the perfect solution to this question posed:

Quote
Quote from: samborabora on March 16, 2014, 10:01:19 AM
I've set the "Return to topics after posting by default" on my mobile theme, but it isn't actually bothering to follow this setting. Whereabouts in the templates can I hard-code the function to return to topic after posting a reply?

Thanks again!

Advertisement: