How to set page password protected in wordpress
-
Hi, I recently installed your market place lite ecommerce plugin for my wordpress site. I’ve set this page to password protected http://bodyologyweightloss.com.au/store/ However, this page http://bodyologyweightloss.com.au/store/products/ i think the URL is automatically created? is not set to password protected. How do I fix this problem please? This shopping cart site is not accessible for public.
It’s a great plugin. Just need some help here.
Thanks,
Helen
-
Hello, can anyone help me please?
Hi there @hsl222
To do something like this you would need to either use a plugin like this
https://wordpress.org/plugins/wp-content-protection/ that allows categories to be blocked or use .htaccess like the link below to do it, but thats server level protectction to the url rather than from inside WordPress.
http://stackoverflow.com/questions/19328665/password-protect-a-virtual-directory-htpasswd-htaccess
Hope this helps, let us know.
Cheers
Hi Tom,
I’ve an enquiry. From the Store setting on wordpress, under “Force Login” – Whether or not customers must be registered and logged in to checkout. (Not recommended: Enabling this can lower conversions)
This only apply to when client wants to check out if I set to ON? Can i set login required from the start of the shopping cart example listing the products?
HI, I just want to follow up on my query please. I’ve yet to receive a reply. ๐
Hi,
I tried to go https://wordpress.org/plugins/wp-content-protection/ to setup secured login/password protected for http://bodyologyweightloss.com.au/store/ However, this page http://bodyologyweightloss.com.au/store/products/ or http://bodyologyweightloss.com.au/store/shopping-cart/ is still not password protected. it seems that it only password protect /store. I contacted the developer for the plugin and it says it doesn’t work for the other directory.
I then contact bluehost to set /store and other directory to password protected but he said i’m using wordpress, and he sent me this info https://codex.wordpress.org/Using_Password_Protection ask me to install plugin.
Please help.
Regards,
HelenHey there Helen, working with Tom on this one.
You need to change the visibility to password protected store page and then paste this at the top of your header.php after the opening php tag, the best option is to use a child theme.
global $post; if ($post->post_parent && post_password_required($post->post_parent)) wp_redirect(get_permalink($post->post_parent));
Then if someone try to access in this case to /store/products it will be redirected to the parent page /store unless they enter the password.
Note: This will only work with direct children pagesLet us know if this works for you.
Hi Jorge,
You mentioned it will only work with direct children pages. What about this http://bodyologyweightloss.com.au/store/shopping-cart/ ? will it work as well? I realised this link is automatically created from your plugin too.
Thanks,
HelenHey there Helen,
MarketPress creates 5 pages, and four of those pages are “direct child” from the store page.
In this case it should work with the shopping-cart page because it’s “under” the store.
Let us know if that works for you.
Hi Jorge,
I tried to paste your code below
global $post;
if ($post->post_parent && post_password_required($post->post_parent))
wp_redirect(get_permalink($post->post_parent));to header.php file after opening of php tag. I don’t know exactly where is it. I tried to paste a few places but then the whole code shows on top of the website.
I copied the top section of the code here. Could you please tell me exactly where I should paste your code please?
<?php session_start(); ?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html <?php language_attributes(); ?> xmlns=”http://www.w3.org/1999/xhtml”>
<head profile=”http://gmpg.org/xfn/11″><meta http-equiv=”Content-Type” content=”<?php bloginfo(‘html_type’); ?>; charset=<?php bloginfo(‘charset’); ?>” />
<meta name=”generator” content=”WordPress <?php bloginfo(‘version’); ?>” /> <!– leave this for stats please –>
<meta name=”viewport” content=”width=device-width, minimum-scale=1.0, maximum-scale=1.0″ /><title>
<?php
if(is_home() || is_front_page()) { echo bloginfo(“name”); echo ” | “; echo bloginfo(“description”); }
else
{ echo wp_title(‘|’, true, ‘right’); } ?>
</title><link rel=”alternate” type=”application/rss+xml” title=”RSS 2.0″ href=”<?php bloginfo(‘rss2_url’); ?>” />
<link rel=”alternate” type=”text/xml” title=”RSS .92″ href=”<?php bloginfo(‘rss_url’); ?>” />
<link rel=”alternate” type=”application/atom+xml” title=”Atom 0.3″ href=”<?php bloginfo(‘atom_url’); ?>” />
<link rel=”pingback” href=”<?php bloginfo(‘pingback_url’); ?>” /><!–[if IE 8]>
<link href=”<?php echo get_template_directory_uri(); ?>/style/ie8-media.css” media=”screen and (min-width: 250px;)” rel=”stylesheet”/>
<![endif]–>
<!–[if IE 9]>
<link rel=”stylesheet” href=”css/ie9.css” media=”screen, projection” type=”text/css” >
<![endif]–><!–[if lt IE 9]>
<script>
document.createElement(‘header’);
document.createElement(‘nav’);
document.createElement(‘section’);
document.createElement(‘article’);
document.createElement(‘aside’);
document.createElement(‘footer’);
</script>
<![endif]–><?php $favicon = get_theme_option(tk_theme_name.’_general_favicon’); if(empty($favicon)) { $favicon = get_template_directory_uri().”/style/img/favicon.ico”; }?>
<link rel=”shortcut icon” href=”<?php echo $favicon;?>” /><?php
$g_analitics = get_theme_option(tk_theme_name.’_general_google_analytics’);
if( isset ($g_analitics) && $g_analitics != ”){
echo $g_analitics;
}
?><?php wp_head();?>
<script>
(function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,’script’,’//www.google-analytics.com/analytics.js’,’ga’);ga(‘create’, ‘UA-55537824-1’, ‘auto’);
ga(‘require’, ‘displayfeatures’);
ga(‘send’, ‘pageview’);</script>
<link href=’http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700,300|Droid+Serif|Open+Sans:400,700′ rel=’stylesheet’ type=’text/css’>
</head>Hi, please assist me with me where exactly should i paste my code please?
Thanks,
HelenHi @hsl222,
Hope you’re well today! You could try adding that bit of PHP code below the wp_head call like so:
<?php wp_head();?> <?php global $post; if ($post->post_parent && post_password_required($post->post_parent)) wp_redirect(get_permalink($post->post_parent)); ?>
It’s also possible to add that code via the wp_head hook. It could be done using a tiny custom plugin that way.
In any case though, I think the above would work just fine. The reason it didn’t work before is because you needed the <?php ?> tags. The snippet above includes that.
Perhaps that’ll do the trick?
Cheers,
DavidHi David,
I did exactly what you said. Added the following code below <?php wp_head();?>
but doesn’t show any result.http://bodyologyfranchising.com.au/store/ – I tried not to login
http://bodyologyfranchising.com.au/store/products/ – but when i go straight to this url, it still accessible which is not suppose to. Please assist. ๐<?php wp_head();?>
<?php
global $post;
if ($post->post_parent && post_password_required($post->post_parent))
wp_redirect(get_permalink($post->post_parent));?>By the way, is this forum content accessible to public? I can’t have anyone see the above link. It’s private login.
Desperately need your help here.
Thanks,
HelenHi, I want to continue to use your plugin but I need some help here please.
Under store setting, I set “Force Login” option to “No”.
I tried to purchase a product, enter all details in forms and there is a message on top “Made a purchase here before? Login now to retrieve your saved info ยป”
Query:-
1. Does the system store the details when I first enter them so I don’t have to re-enter again?
2. Where does the info saved to? Where is the wp can I see which user save the info?
3. Under “Review Cart” page, I can see “have a user account” then Username field and password field. because I set Force Login to No, the next column shows “Check out Directly”. My question is the system doesn’t ask me to enter username and password, how do I know what’s my username and password please?Thanks,
HelenHey Helen,
Working with the rest of the guys here ๐
Here are the answers to your questions:
1. Yes it does.
2. The info is stored in the cookies.
3. With force login set to no, you can checkout without being registered on the site but you can still login and make the purchase in case you have an account.This means having an account and being logged in is optional and it can be done either way.
I’m not really sure what you mean by “how do I know what’s my username and password please” so can you please advise on that?
Cheers,
BojanHI, I set Force login to “No”.
The flow seems not right.1. This is my product page http://bodyologyfranchising.com.au/store/products/
2. When user click “Buy Now”, it will come to this “Review Cart” page.
3. I understand by setting Force Login to “No”, client gets to checkout directly.
4. Once I click check out directly, it prompts me to enter all my details like address, email and etc. After that I click “Continue checkout” and it goes straight to paypal.My objective is i don’t want regular clients to keep having to enter all their details all over again everytime they come to shop here. From the flow above, where is the process that ask me to enter my Username and password? Because under point 3 above, there’s a username and password login. I didn’t get the chance to enter password. I hope you get what I mean.
Urgently need your help.
Thanks,
Helen
- The topic ‘How to set page password protected in wordpress’ is closed to new replies.