Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › Hiding features until login
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › Hiding features until login
- This topic has 13 replies, 3 voices, and was last updated 8 years by David Martin – Support.
-
Posted in: Neighborhood
-
May 9, 2016 at 10:40 pm #266305
Hi there,
I just purchased this theme, so far so good, it’s pretty amazing, so great job! I was hoping you can help me out with a few things and point me in the right direction.
Goal: I am trying to hide the main components of the site until a member has logged in; I am going to customize the front My Account page for both a visitor and once they are logged in. However, the Super Search (personal shopper), Search, Cart still remain. Do you know where in the template these are rendered in the header.php? I want to just do a ( ! is_user_logged_in() ) type statement.
Note: I am using Nav Menu Roles plugin to hide the nav until logged in; If you know of a better plug-in to manage this so that the site is more of a members only, please add those suggestions so I can try it out.
Lastly, I tried the is_user_logged_in() in the code below found in header.php, but it just disables the functionality, it does not hide the personal shopper option at the top.
<!--// OPEN #container //--> <?php if ($page_layout == "fullwidth") { ?> <div id="container"> <?php } else { ?> <div id="container" class="boxed-layout"> <?php } ?> <?php if ($ss_enable && sf_woocommerce_activated()) { echo sf_super_search('header'); } ?>
May 10, 2016 at 1:03 pm #266448Hi,
Can you try to replace this line
if ($ss_enable && sf_woocommerce_activated()) {
by this one
if ($ss_enable && sf_woocommerce_activated() && is_user_logged_in() ) {
Let us know the result.
-Rui
May 12, 2016 at 4:17 am #266961Rui, that worked and it seems I just needed time understanding the swift framework layout and how all the functions / params flow through.
I have another question though, hoping I can just continue the few custom things I have here so I can get the support I need rather than continuously opening new tickets.
Issue #1: I would like to do the same is_user_logged_in() functionality for the search and cart on the right side of the nav; I can’t seem to find where to put the code in the header.php or sf-page-heading.php. Any suggestions?
Issue #2: Do you know of a good way to show a different Home Page when the user is logged in vs. not? I am using the WooCommerce My Account page as the .com/ root page, which gives two different views depending on whether the user is logged in. However, I have a less technical person who would like to update the home page to new featured products throughout the year, and would like to allow them to be able to do that in a seperate “Page” that is referenced as the home page if not logged in, then once logged in it would be something else? So “Sample-Page” would be .com/ when not logged in, then once logged in “Home Page” would be the .com/ when logged in? This is more of an implementation decision I am hoping you can help with, any plug-in suggestions, etc. are welcome too.
Thanks in advance, loving the theme :).
May 12, 2016 at 12:25 pm #267019Hi,
Regarding 1 are you talking about this ones in the image below?
https://www.dropbox.com/s/6ak9mhdcfr9bgnb/Screenshot%202016-05-12%2012.26.13.png?dl=0Regarding 2, you have this plugin that restricts content
Or you can try to redirect a user to other page if he is not logged in.
-Rui
May 12, 2016 at 8:06 pm #267139For #1: Yes, that is correct;
For #2; What is the best way to redirect a user to other page is not logged in? Where can I set that in the code / admin panel?
Also, how do I prevent the auto-login upon registration. I am trying to create an approval process; where a member gets put into a “unapproved” user role, then once approved, gets put into a different role which opens up access. However, the auto-login is preventing this from happening… Thoughts on how best to approach this one?
May 13, 2016 at 10:20 am #267254Regarding 2. try to add the code below to your functions.php of your child theme and change the slug of the page(in this case it will be the homepage slug and change the redirection link to your desired page.
add_action( 'template_redirect', 'redirect_to_specific_page' ); function redirect_to_specific_page() { if ( is_page('slug') && ! is_user_logged_in() ) { wp_redirect( 'http://www.example.dev/your-page/', 301 ); exit; } }
This code was copied from here
http://wordpress.stackexchange.com/questions/131879/how-to-redirect-non-logged-in-users-to-a-specific-pageLet me check 1 and will get back to you.
-Rui
May 13, 2016 at 10:57 am #267268Regarding 1
Check in Neighborhood/includes/swift-framework/sf-content-display/sf-header.phpLook for menu-search and it will appear 3 times, change the if statement above it.
Hope it helps.
-Rui
May 23, 2016 at 7:39 pm #269571Rui,
Everything you have helped me with so far as worked, solid support!
I had another followup question, figured I would just continue this thread, I think we have a good thing going here :).
Question: I noticed a bunch of options are set in the sf-options.php file, with an array of config values that get passed in around the theme. For example, I am trying to update the Register an Account paragraph text, but when I change this in the sf-options.php it does not re-render on the web page. What am I missing?
woocommerce/myaccount/form-login.php
Line 76: <div class="new-user-text"><?php _e($options['checkout_new_account_text'], 'swiftframework'); ?></div>
swift-framework/sf-options.php
array( 'id' => 'checkout_new_account_text', 'type' => 'textarea', 'title' => __('New account text', "swiftframework"), 'sub_desc' => __('This text appears in the sign in / sign up area of the checkout process.', "swiftframework"), 'desc' => '', 'std' => 'Sign up for an account with the Maxwell Health Marketplace by filling in the information below. After clicking Register, your information will be reviewed and you will receive an email when your account has been approved.' ),
Attachments:
You must be logged in to view attached files.May 24, 2016 at 3:04 am #269598Also, what is your best suggestion on showing a list / table view of products? The plugins out there don’t seem very good…I was really hoping not to have to make such drastic changes to the template view files. Thoughts on how to accomplish this?
Thanks!
May 25, 2016 at 12:18 pm #2700271) Any reason why you do want to update the text within the theme options? Or are you looking to update the default text?
2) Have you tested the Products (Mini) asset?
Thanks.
May 25, 2016 at 3:26 pm #270097Hey, so I resolved #1, it was actually an option within the theme options, no need to do it inside the codebase. Probably what was why it wasn’t updating to begin with.
For #2. Yes, but it still does the grid view; I am looking for the best method to show a list. Meaning it has like 5 columns: vendor, product name, price, etc. Any ideas / does it come with the theme? Or am I going to just have to update the styles for this. The mini-products nor products in the Swift builder does not have this capability from my understanding.
May 25, 2016 at 3:30 pm #2700982) Something that specific is not available, it would require a decent amount of customisation (PHP/CSS) to get that functionality built. For something like that, you’d need to work with a developer or search for a 3rd party plugin.
Thanks.
May 25, 2016 at 3:32 pm #270099Cool, thanks for confirming!
May 25, 2016 at 3:34 pm #270104No problem.
Thanks,
David. -
Posted in: Neighborhood
You must be logged in and have valid license to reply to this topic.