Support ⇒ Troubleshootings ⇒ redirect after forum posting ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum IndexTroubleshootings

redirect after forum posting Reply to topic


I have a site where I need to change the page redirection immediately after fourm posting from the reidrect default of displaying the post to redirecting back to the index.php of the Home module. I have spent a few hours looking at the /modules/Forums/posting.php files, and the themes/default/template/Forums/posting.html and I can't find anything to change that actually makes a difference.

Currently, I have one forum thread that is set to allow anonymous posting (using the secure code image), but the forum permissions is set to not allow viewing or reading the thread by anonymous users. However, after they submit their post, it goes to the page where they have two or three options or view forum, view thread, or something else, it automatically redirects to the Your_Account module. I need it to redirect back to the site homepage.

The only part of the modules/Forums/posting.php file that contains anything about the Your Account module is on line 253:
# The user is not authed, if they're not logged in then redirect
# them, else show them an error message
if (!$is_auth[$is_auth_type]) {
if (is_user()) {
message_die(GENERAL_MESSAGE, sprintf($lang['Sorry_'.$is_auth_type], $is_auth[$is_auth_type."_type"]));
}
url_redirect(getlink('Your_Account'), true);

In trying to follow the flow of the script, I "think" this is where it is redirecting to the Your Account module to login, or register since they do not have permissions to view the post that they just made. Am I correct?

At any rate, I tried to change this line #253 to:
url_redirect(getlink('Home'), true);

and it does not make a change.

Can someone please take a quick look at the code and tell me what I need to change? I found an old forum post from 2011 on here and they were asking the same question about changing this redirection but it mentioned about changing a "url_redirect" line in the file but did not specify which one. So I am at a loss.

Any help would be appreciated, a lot! Thanks.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Devuan jessie / Apache 2.4x / MariaDB 10.x / PHP 5.6x / DF 9.4


./includes/phpBB/functions_post.php
Around line 226
url_refresh(

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial


Thanks for your help DJ, but when I change that line I get a blank page when I try to load a page to post (create a topic) on. This is the error:
Parse error: syntax error, unexpected ';' in /home/user/public_html/domain.com/www/includes/phpBB/functions_post.php on line 227


This is the original line:
url_refresh(getlink('&file=viewtopic&'.POST_POST_URL.'='.$post_id).'#'.$post_id);

I tried both of these changes and got the same result, it loads a blank page
url_refresh(getlink('&file=viewtopic&t=6'); // trying to go to the publically viewable forum topic
url_refresh(getlink('Home'); // trying to load the home page with the home module being "Home"

To help you understand what I am doing, I have two forum areas (categories). The first forum I use for anonymous users to create a topic that is outside of view from all unregistered users. Guests can create and post a topic but not view the individual topics after posting. After I (administrator) view and approve the topics, I "merge" them into the second forum. The second forum contains a single topic that contains all the merged topics together as one forum topic (thread).

When I click on this link to create a thread:
http://domain.com/index.php?name=Forums&file=posting&mode=newtopic&f=2

using the original and unaltered ./includes/phpBB/functions_post.php file, it loads fine and I can create the topic and it posts to the db. When I alter the ./includes/phpBB/functions_post.php file with my two entries (quoted above) it loads a blank page and gives a parse error,

Can you advise what I am doing wrong in my edit to get the parse error? I have sent you the actual url address in a pm to help you understand what I am doing. Thank you.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Devuan jessie / Apache 2.4x / MariaDB 10.x / PHP 5.6x / DF 9.4


Hey, I think I got it figured out! I was missing an ")".

It works as intended now. Thanks DJ!

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Devuan jessie / Apache 2.4x / MariaDB 10.x / PHP 5.6x / DF 9.4


Great you did solve it

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial

All times are UTC


Jump to: