AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
Notifications
Clear all

[Closed] Topic Shortcode redirecting question

8 Posts
2 Users
2 Reactions
3,763 Views
Posts: 5
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@nolan59)
Active Member
Joined: 3 years 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: 3 months ago

Support Team
Posts: 10746
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@nolan59,

Thank you for sharing your solution.


Page 2 / 2
Share: