The effects of alcohol on
sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Issue [Solved] RE: Redirecting Issue
✦ Summarize Topic
✦
✦
✦
AI is analyzing the discussion...
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
Show original
Translating...
Jan 31, 2023 9:21 pm
(@davegetdsm)
Active Member
Joined: 3 years ago
I have an issue on redirecting the user to sign-in URL. When they click the "post comment" button, it should check first if the user is logged in to continue, and if not they are suppose to redirect on sign-in URL.
I add this code to functions.php file: using "wpdiscuz_before_comment_post" hook.
add_action("wpdiscuz_before_comment_post", function () {
if ( ! is_user_logged_in() ) {
wp_safe_redirect( 'https://vinhammer.com/sign-in/' );
exit;
}
});
but when I click the "Post Comment" button it doesn't redirect to sign-in page, instead the page shows inside a pop-out error message.
Support
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
Show original
Translating...
Feb 01, 2023 2:52 pm
(@asti)
Illustrious Member
Joined: 8 years ago
@davegetdsm,
First of all the button works using the AJAX so the code you've written can't work. You should use the js code to get it to work as you like.