The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
RE: Redirecting Iss...
 
Share:
Notifications
Clear all

Limited Support

Our support team is currently on holiday from December 25, 2025 to January 7, 2026, and replies may be delayed during this period.

We appreciate your patience and understanding while our team is away. Thank you for being part of the wpDiscuz community!

Merry Christmas and Happy Holidays! πŸŽ„

Issue [Solved] RE: Redirecting Issue

2 Posts
2 Users
0 Reactions
1,100 Views
Posts: 3
Topic starter
(@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.


1 Reply
Asti
Posts: 8205
 Asti
Support
(@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.Β 


Share: