Home Icon/link action

Xephius
Xephius
@xephius
8 years ago
93 posts
Hi all,
I have setup my landing page to be an advertisement for my community, with a login or register button. This is great, easy for anyone to find.

I have all quotas set to redirect after login to www.domain.com/home. This seems to work about 80% of the time, about 20% they are direct to their profile page. (reports from the community)
Currently, if someone clicks the home icon in the upper left corner it goes to the top level domain. This is frustrating for my community to have to click login again, and often get directed to the profile instead of the /home page. So...

Can I change the action of the upper left icon link based on the profile status or logged in/logged out status? Thanks!
updated by @xephius: 03/11/17 05:38:42PM
brian
@brian
8 years ago
10,148 posts
If it is not working 100% of the time, then double check your quota config - my guess is you've overlooked a quota that needs to have it's login redirect set.

Also - it's important to know that if a user tries to load a page that REQUIRES a login, and they are REDIRECTED to the login, after they log in they are redirected back to where they wanted to originally go.

If you want to test for logged in/logged out state in a template do this:

{if jrUser_is_logged_in()}
    ..  HTML that logged in users will see ..
{else}
    .. HTML logged OUT users will see ..
{/if}

Let me know if that helps.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Xephius
Xephius
@xephius
8 years ago
93 posts
Will do on the quotas. I foresee a couple challenges you might be able to help me with.

First will be to duplicate the existing landing page index.tpl to a new template called publiclanding.tpl and make it available at 'www.domain.com/publiclanding'. This is a challenge because I am using the default landing page code until I can figure that out. So I need it to be replicated the index page onto a new page in a different location, and I am unsure on how to do that.

Second, can you suggest how can I turn the following into useable code to put in my 'new' index.tpl? I lack the syntax to be able to construct the loop. Or if you have a better path, I am open to it!

{if jrUser_is_logged_in()}
goto-www.domain.com/home
{else}
goto-www.domain.com/publiclanding
{/if}
michael
@michael
8 years ago
7,746 posts
Is this the same question we answered via tickets still? Where the issue was the quota settings or a different question?

Feeling a bit of de-ja-vu on the is topic.
Xephius
Xephius
@xephius
8 years ago
93 posts
Slightly different, but overlapping. I was having issues with getting some sliders to work in the various skins. Turns out the reason was they "sliders" were baked into the index.tpl files of the respective skins. And as soon as I active the site builder, it blows away all those cool sliders. And there is no widget to create a slider. So I was confused trying to get the slider to appear, not understanding the relationship of the 'samples' shown in the skins sections and the index.tpl holding that info. That said, Nate said I could copy the contents of Index.tpl into another .tpl file, but he didn't specify _how_ to do that..

So, yep, de-ja-vu, but I am trying to engage on your public forums whenever possible as requested. Sorry if this breaks the thread.
michael
@michael
8 years ago
7,746 posts
Not sure how to answer. The thread topic is "Home Icon/link action". Not sure how to solve it.

Yes, templates ( .tpl ) files are the templating system for jamroom. You can use them to build whatever you want. Javascript, HTML and functions all work from within templates.

a set of templates are packaged together into a skin. Only one skin runs at a time. It is possible to copy parts from one skin to another skin but in order for it to work you'd need to copy all the parts. Identifying which parts those are is probably going to be the biggest task.
Xephius
Xephius
@xephius
8 years ago
93 posts
Hey Michael, sorry for throwing you a curve. I think Brain is got me set on the right track. I am trying to change the redirect of the home icon located in the upper left corner of the page based on the user login status. But, unfortunately, before I started this thread, I couldn't articulate that any better.

I am now catching up on the template system and how they work, again, still late to the party on this.

So I understand I can technically copy the contents of one template into another, but I don't know how to just make a new one, or where it lives so to speak. Do I need to move files with FTP and create them with a text editor or does JR have a specific way of doing that? I also don't know how to create a fresh new one, and direct a specific URL to that template. Not trying to be obtuse, I just don't know what to do.

I am guessing that if I can figure out how to directly edit the templates, and how to direct pages to them, the corrected code above living on a new index.tpl will actually 'solve' my problem. And that is I want my logged in community to go directly to www.domain.com/home and the visitors to go to www.domain.com/publiclanding.

FWIW, Nate got me mostly straightened out on how each skin has a sample index.tpl that is not editable via Page Builder. Because I didn't know it existed, I didn't know what I was asking for, and it wasn't until he told me how to get 'back' to the sample index.tpl that everything clicked.
michael
@michael
8 years ago
7,746 posts
Quote: ....but I don't know how to just make a new one, or where it lives so to speak.....
You can put any .tpl file in the current active skins folder and the URL will correspond to the name of the template.

eg add:
/skins/(your skin)/elephants.tpl
and it will show up at:
site.com/elephants

Some templates exist to be used as includes for {jrCore_list template="elephants.tpl"} in which case they are not MEANT to be called via their url but rather used to structure the data coming back from {jrCore_list}.

Docs: "{jrCore_list}"
https://www.jamroom.net/the-jamroom-network/documentation/jamroom-developers-guide/89/jrcore-list

Docs: "Creating a page for a skin"
https://www.jamroom.net/the-jamroom-network/documentation/skin-customization/1043/creating-a-new-page-for-a-skin

The other ways to take control of a URL are via site builder:

Docs: "What is Site Builder?"
https://www.jamroom.net/the-jamroom-network/documentation/site-builder/2634/what-is-site-builder

And also skin related

Docs: "Altering a modules template"
https://www.jamroom.net/the-jamroom-network/documentation/jamroom-developers-guide/1051/altering-a-modules-template

That describes how to override a modules template.

The base location for the docs is here:

Docs: Table of Contents
https://www.jamroom.net/the-jamroom-network/documentation/contents

For your current redirect situation, you probably want this code
{if jrUser_is_logged_in()}
  {jrCore_location("`$jamroom_url`/home")}
{else}
  {jrCore_location("`$jamroom_url`/publiclanding")}
{/if} 

If you're wanting an immediate redirect upon that code being seen, or if you're wanting to wrap the home icon in the top left hand corner in a clickable link, then
{if jrUser_is_logged_in()}
  <a href="{$jamroom_url}/home">THE IMAGE HERE</a>
{else}
  <a href="{$jamroom_url}/publiclanding">THE IMAGE HERE</a>
{/if} 
michael
@michael
8 years ago
7,746 posts
There is also this doc which might be the correct answer if the question is:
"How do I make the site visible to members only?"

Docs: "How do I make the site visible to Members Only"
https://www.jamroom.net/the-jamroom-network/documentation/jamroom-admin-handbook/4357/howto-make-the-site-visible-to-members-only

Seams like that may be the root question, not sure.
Xephius
Xephius
@xephius
8 years ago
93 posts
Thanks.
So looking at these docs is very helpful. I imagine I will get to know jrCore_list better over time. And thanks for the code support. I simply have not written or read HTML in years and forgotten more than I know.

A couple of things that I didn't see, maybe I just didn't get it..

What if we have two elephants.tpl that need to live in different places? Is there a subfolder setup (that I can't see in the web browsing tool) in the templates directory that mirrors the URL browsing directory?

Also, those code snips help a lot. Here is what I think I should do with it, but it raised the questions of how will 'mobile' handle this vs. 'desk'. It appears it asks for the type of browser before it asks about the logged in status of the uses.

Here is the 'stock' header code from FollowMe:
<ul>
<li class="mobile" id="menu_button"><a href="#menu2"></a></li>
<li class="desk"><a href="{$jamroom_url}">{jrCore_image image="logo.png" width="147" height="40" class="jlogo" alt=$_conf.jrCore_system_name custom="logo"}</a></li>
</ul>

I believe that this will solve my problem for desktop, but not mobile:

<ul>
<li class="mobile" id="menu_button"><a href="#menu2"></a></li>
<li class="desk">
  {if jrUser_is_logged_in()}
                <a href="{$jamroom_url}/home">{jrCore_image image="logo.png" width="147" height="40" class="jlogo" alt=$_conf.jrCore_system_name custom="logo"}</a>
   {else}
                <a href="{$jamroom_url}/publiclanding">{jrCore_image image="logo.png" width="147" height="40" class="jlogo" alt=$_conf.jrCore_system_name custom="logo"}</a>
   {/if} 
</li>
</ul>

I can see that mobile is getting directed to a menu_button and referencing #menu2, but I don't understand how that directs to a template. Sorry that I maybe lacking some programming fundamentals to fill the gap, but I am doing my best to work this out on my own. I am having trouble working with developers because I lack the understanding of the system to tell a coder specifically what to do to get a result I want and end up paying them to learn JR rather than write my code. And with multiple ways to get to any one solutions in JR, it gets even more complicated. This has happened a couple times, so I am just trying to get my head around this so I 'own' the design and be better skilled to direct development.

Also, I am using the {* *} here to isolate the code, how do I make the cool grey box for code snips?

Finally, I really to appreciate the help. I completely understand the challenge of trying to give me a direct answer to a question. So not only do I suck at asking accurate questions, but your probably feeling the frustration I have at not being able to make it 'work'. I am doing my best to not direct it at you guys, I know your doing your best to answer the questions. :) If there is something I can do to make this process easier for us both, please let me know.
updated by @xephius: 12/10/16 10:04:44AM
michael
@michael
8 years ago
7,746 posts
theartsherpa:....What if we have two elephants.tpl that need to live in different places?.....
Whats the goal?

theartsherpa:.... and end up paying them to learn JR rather than write my code....
Yeah, thats a bad situation.

I've lost the point of the thread again. Feels like you're saying you're having troubles. I can sympathize that yes it is hard to get when you're learning something new and it does take time. Try keeping it simple, ask a separate question on each thing you want to know; title it with the thing you want to know so that if you saw that title in your search results you would think "Yes that's what I want" and we'll answer it.

Short precise threads specific to a topic mean others _may_ read them, so help us keep our support time costs lower ;)

theartsherpa:....And with multiple ways to get to any one solutions in JR, it gets even more complicated.......

* First guy invents some letters A, B, C, D, E.....
* Second guy puts them together into words CAT, DOG, HORSE
* Next guy adds some constructs IS, AT, BUT, DOESN'T

Pretty soon you have a language. Same thing here, You can always go back down the chain to the more primitive. Jamroom is built on structures that came before it and assembled in a way that is intended to be quicker than you would get if you started with the most primitive. Yes it takes a while to learn its structure. Yes there are other ways it could have been structured. You can learn it at whatever level you want to use it at.
michael
@michael
8 years ago
7,746 posts
I'm restructuring our Youtube channel. If you can make a list of the question you have, what you want to know but don't I can try to create a stepped structure through each question to get you leveled up.

I've tried to do that with the docs too, maybe take a look at them and list up where you get stuck and the questions that you have at that point.

Maybe start here and work through until you hit a question point then ask here in the forums:

Docs: Jamroom Admin Handbook
https://www.jamroom.net/the-jamroom-network/documentation/jamroom-admin-handbook
SteveX
SteveX
@ultrajam
8 years ago
2,584 posts
Quote: Also, I am using the {* *} here to isolate the code, how do I make the cool grey box for code snips?
Click the BBCode Help button (next to the Attach File button) to see ways of formatting your post.


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
Xephius
Xephius
@xephius
8 years ago
93 posts
Thanks for all that. I will start working through the Handbook and make suggestions.

Back to the questions at hand. Will both the mobile client and the desktop client direct users to the same page with the code below, and if not, how do I fix it?

<ul>
<li class="mobile" id="menu_button"><a href="#menu2"></a></li>
<li class="desk">
  {if jrUser_is_logged_in()}
                <a href="{$jamroom_url}/home">{jrCore_image image="logo.png" width="147" height="40" class="jlogo" alt=$_conf.jrCore_system_name custom="logo"}</a>
   {else}
                <a href="{$jamroom_url}/publiclanding">{jrCore_image image="logo.png" width="147" height="40" class="jlogo" alt=$_conf.jrCore_system_name custom="logo"}</a>
   {/if} 
</li>
</ul>

Also, Thanks Ultrajam. :)
updated by @xephius: 12/10/16 10:18:30AM
michael
@michael
8 years ago
7,746 posts
theartsherpa:.....Will both the mobile client and the desktop client direct users to the same page with the code below, and if not, how do I fix it?....
Too much thinking ahead. Do it, see what it does then ask actual questions.

There answer is: either depends on the surrounding code. Once you make the change you will know if it works or not. If it doesn't work, you need to locate the code that causes it.

Reason: You have pasted some code, but out of context. If that was all the code, then it will work fine for mobile and for desktop, but we don't know without that context.

There MAY be a wrapper that is using
        {if jrCore_is_mobile_device()} 
around the header, not sure, so try it and see. :)
Xephius
Xephius
@xephius
8 years ago
93 posts
Gotcha. Thanks for the direction. I saw the mobile call in the header and was concerned about its impact :)
II got it working after a few syntax errors and a few resets, thanks.