Redirect time load
 
Notifications
Clear all

[Solved] Redirect time load

9 Posts
2 Users
0 Reactions
1,566 Views
(@kimchi)
Active Member
Joined: 5 years ago
Posts: 11
Topic starter  

Hi, can you please tell me how can I adjust the time it take to redirect the first-time commenters to a page? Right now it takes a few second and I want to reduce it as much as posible. Thanks


   
Topic Tags
(@kimchi)
Active Member
Joined: 5 years ago
Posts: 11
Topic starter  

thank you


   
Astghik
(@astgh)
Illustrious Member Admin
Joined: 7 years ago
Posts: 6146
 

@kimchi,

I'm sorry, but there is no option to change the redirection time. 

You should change the time manually in wpDiscuz files.

1. Please open the wpdiscuz.js file, in the /wp-content/plugins/wpdiscuz/assets/js/ folder

2. Find the wpdiscuzRedirect function, and change the 5000 value as you like

Warning: Making changes to active plugins is not recommended. You should deactivate the plugin before making any changes.

redirection

The changes will be lost after the update, however, we'll take into consideration to change the value in future updates.


   
(@kimchi)
Active Member
Joined: 5 years ago
Posts: 11
Topic starter  

Thank you for taking the time to show me the solution. It works!

Is is posible to have the redirect active for all the comments not only for the first timers?

Thanks again


   
Astghik
(@astgh)
Illustrious Member Admin
Joined: 7 years ago
Posts: 6146
 

@kimchi,

Please follow the steps below:

1. Open the class.WpdiscuzCore.php file, in /wp-content/plugins/wpdiscuz/ folder. 

2. Find the redirect() function:

    public function redirect() {
$messageArray = array('code' => 0);
$commentId = isset($_POST['commentId']) ? intval($_POST['commentId']) : 0;
if ($this->optionsSerialized->redirectPage && $commentId) {
$comment = get_comment($commentId);
if ($comment->comment_ID) {
$userCommentCount = get_comments(array('author_email' => $comment->comment_author_email, 'count' => true));
if ($userCommentCount == 1) {
$messageArray['code'] = 1;
$messageArray['redirect_to'] = get_permalink($this->optionsSerialized->redirectPage);
}
}
}
$this->commentsArgs['caller'] = '';
wp_die(json_encode($messageArray));
}

3. Replace with this one:

    public function redirect() {
$messageArray = array('code' => 0);
$commentId = isset($_POST['commentId']) ? intval($_POST['commentId']) : 0;
if ($this->optionsSerialized->redirectPage && $commentId) {
$comment = get_comment($commentId);
if ($comment->comment_ID) {
$messageArray['code'] = 1;
$messageArray['redirect_to'] = get_permalink($this->optionsSerialized->redirectPage);
}
}
$this->commentsArgs['caller'] = '';
wp_die(json_encode($messageArray));
}

Please note the changes will be overwritten after the update, you should keep the function somewhere locally, and change after the update.


   
(@kimchi)
Active Member
Joined: 5 years ago
Posts: 11
Topic starter  

I appreciate it, thank you. 


   
Astghik
(@astgh)
Illustrious Member Admin
Joined: 7 years ago
Posts: 6146
 

@kimchi

We'd really appreciate and be thankful if you leave a good review on plugin page. This is the best way to say thank you to this project and support team.


   
(@kimchi)
Active Member
Joined: 5 years ago
Posts: 11

   
Astghik
(@astgh)
Illustrious Member Admin
Joined: 7 years ago
Posts: 6146
 

Thank you kimchi very much. 


   
Share:
Scroll to top