Redirect time load
 

[Solved] Redirect time load  

  RSS

kimchi
(@kimchi)
Active Member
Joined: 5 months ago
Posts: 11
21/08/2019 7:56 pm  

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
(@kimchi)
Active Member
Joined: 5 months ago
Posts: 11
21/08/2019 7:57 pm  

thank you


Astghik
(@astghik)
Support Team Admin
Joined: 2 years ago
Posts: 3457
22/08/2019 2:10 pm  

@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
(@kimchi)
Active Member
Joined: 5 months ago
Posts: 11
22/08/2019 2:49 pm  

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
(@astghik)
Support Team Admin
Joined: 2 years ago
Posts: 3457
22/08/2019 4:23 pm  

@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
(@kimchi)
Active Member
Joined: 5 months ago
Posts: 11
22/08/2019 5:42 pm  

I appreciate it, thank you. 


Astghik
(@astghik)
Support Team Admin
Joined: 2 years ago
Posts: 3457
22/08/2019 5:43 pm  

@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
(@kimchi)
Active Member
Joined: 5 months ago
Posts: 11

Astghik
(@astghik)
Support Team Admin
Joined: 2 years ago
Posts: 3457
22/08/2019 6:02 pm  

Thank you kimchi very much. 


Share:
Green
Default
Pear
Black Emo
{green}:grinning:
{green}:wink:
{green}:face:
{green}:inlove:
{green}:sweaty:
{green}:surprised:
{green}:lovekiss:
{green}:laugh:
{green}:formalsmile:
{green}:displeased:
{green}:cool:
{green}:resent:
{green}:nerd:
{green}:screaming:
{green}:amazed:
{green}:sad:
{green}:deceitful:
{green}:starryeyes:
{green}:evil:
{green}:shocked:
{green}:tears:
{green}:sulky:
{green}:smile:
{green}:vomited:
{green}:hi:
{green}:afraid:
{green}:crazy:
{green}:rabid:
{green}:fighting:
{green}:nonoise:
{green}:blushed:
{green}:idontknow:
{green}:scared:
{green}:razz:
{green}:kiss:
{green}:eat:
{green}:shutmouth:
{green}:gape:
{green}:suspicious:
{green}:laughingoutloud:
{green}:bruise:
{green}:crying:
{green}:pray:
{green}:serious:
{green}:excitement:
:)
:d
:wink:
:mrgreen:
:neutral:
:twisted:
:arrow:
:shock:
:???:
:cool:
:evil:
:oops:
:razz:
:roll:
:cry:
:eek:
:lol:
:mad:
:sad:
:!:
:?:
:idea:
:hmm:
:beg:
:whew:
:chuckle:
:silly:
:envy:
:shutmouth:
{pear}:happy:
{pear}:smile:
{pear}:laugh:
{pear}:laughingoutloud:
{pear}:crying:
{pear}:exhausted:
{pear}:nerd:
{pear}:surprised:
{pear}:veryhungry:
{pear}:wink:
{blackemo}:laughtertotears:
{blackemo}:gift:
{blackemo}:love:
{blackemo}:inlove:
{blackemo}:shamefaced:
{blackemo}:heart:
{blackemo}:crazy:
{blackemo}:anguished:
{blackemo}:bruise:
{blackemo}:easymoney:
{blackemo}:exhausted:
{blackemo}:vampire:
{blackemo}:shutmouth:
{blackemo}:wink:
{blackemo}:carnival:
{blackemo}:flowers:
{blackemo}:hotdrink:
{blackemo}:party: