Notifications
Clear all

Script [Closed] Topic Shortcode redirecting question

8 Posts
2 Users
2 Reactions
1,292 Views
Posts: 5
Topic starter
(@nolan59)
Active Member
Joined: 1 year ago

I have found a way to do it.

The function to edit is in the wpforo/classes/Actions.php file.
Search for : public function post_add()

and replace the whole function with this :

public function post_add() {
	wpforo_verify_form();
	$args = $_REQUEST['post'];
	$args['postmetas'] = (array) wpfval( $_REQUEST, 'data' );

	$from = wpforo_get_request_uri();
	$isForumPage = strpos( $from, '/community/' ) !== false;

	if( $postid = WPF()->post->add( $args ) ) {
		if ( $isForumPage ) {
			wp_safe_redirect( WPF()->post->get_url( $postid ) );
		} else {
			wp_safe_redirect( $from );
		}
		exit();
	}
	wp_safe_redirect( $from );
	exit();
}

Replace /community/ with your board slug if you have changed it

Hopefully somebody with a better knowledge of the WPForo code can modify this so that it will work regardless of what your board is called or how many boards you have, but if you have a vanilla installation, this will do the trick.

1 Reply
Robert
Admin
(@robert)
Joined: 8 years ago

Support Team
Posts: 10583

@nolan59,

Thank you for sharing your solution.

Page 2 / 2