I have webstore on woocommerce, and on one of my wordpress pages (that page is not woocommerce page, but just wordpress and it is edited by Colibri free theme) I have download links for some products.

And I want to make some of those links to be able to download without restrictions which already works fine. But for some links I need to make redirection to login page if user is not logged in.

I have no idea how to start.

At the moment I suppose I need to use in some way is_user_logged_in() method. And I suppose I need to use it in functions.php file. But have no idea how?

Should I use in some way add_filter, or add_action? But how to add filter/action to exact links from page which I don't even know where to find on FTP server?

I am sorry I am still totally newbie and I can't find the exact answer in jungle of threads on google and on stackexchange.

I suppose I should first pass any wordpress/php course. But at the moment I need to provide that one functionality as soon as possible. And have no idea how to start.

For any help great thanks in advance,

Best Regards

  • How are you constructing the download links? I'd probably serve the files through an endpoint that checks permission before serving the file contents, and you can set that up to redirect to the login page if the user doesn't have permission. So then all of the page links would just link to the download endpoint, and you do the permission checks there. – Rup Mar 17 at 14:11
  • All it sounds nice, but how technically provide such sulution? And I don't know how I constructing the download links. I use Colibri theme and their editor. And there is simply option to add link and then click "publish", that's all. – pajczur Mar 17 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.