News:

Wondering if this will always be free?  See why free is better.

Main Menu

Information Bar

Started by Texan78, May 21, 2012, 07:11:08 PM

Previous topic - Next topic

Texan78

Hello,

I have looked and I have found something close to what I need but, they don't do what I need it to do. I am just wanting a simple div box that will go right above the breadcrumb and below the menu on a Default theme using 2.0.2 that I can put some info in like "You are not logged in, please log in or register yada, yada, yada. This info bar will only show to Non members or members not logged in. When the user logs in the bar disappears. I had this many years ago when I used phpBB, and was curious if this could be done or if there is a mod that will do this. I know when I had it on phpBB it was a really simple code edit. I figured it would be the same for here.

-Thanks

Fog

Do you know any PHP Coding?

Texan78

Quote from: Fog on May 21, 2012, 09:18:22 PM
Do you know any PHP Coding?

If I did I wouldn't really be asking. I know enough to make my way around, but not really wanting to reinvent the wheel if there is already something out there.

Fog

It might be easier to create your own mod, the reason I ask is I've created a info bar below the main menu but never tried to put permissions into the PHP code I modified.  It wouldn't be hard to create permissions.

Texan78

Yea creating the actual div bar wouldn't be hard at all. I just don't know what code is used to display or not display something when a user is not logged in. On phpBB it wasn't hard at all. But the code for SMF is a lot more complex then phpBB was back then.

Fog

Hint:  Lets look at the PHP code that displays the Admin Button on the Menu, from there one can apply that PHP code to the info bar div code.

Texan78

That complicates things more then it should because that is permission based and only shows to admin. It would need to show for guests and then disappear for registered users once they have logged in.

Arantor

I'm sure there are mods for this, register bar or similar.

Fog

Quote from: Texan78 on May 21, 2012, 10:24:46 PM
That complicates things more then it should because that is permission based and only shows to admin. It would need to show for guests and then disappear for registered users once they have logged in.

The only thing I'm trying to point out is how does the php code help you with your idea.  I for one would look at how the PHP code and try to understand what one has to put into place to create premission.

Then try to use "Regular Members" instead of where it says "Admin"

Just ideas if you don't find the right MOD.

Fog

Quote from: Arantor on May 21, 2012, 10:27:38 PM
I'm sure there are mods for this, register bar or similar.

Hey Arantor, Long time how are you?


Arantor

Let's just say I've been better, thanks, how about you?

Fog

Whats been going on over on Shawns Sites?  I haven't been over there in awhile.

Quote from: Arantor on May 21, 2012, 10:49:55 PM
Let's just say I've been better, thanks, how about you?

I hear you otherwise, didn't know you posted here.

Fog

Texan78

Ok here is what I got which works, but I need it to work when user is logged out not logged in...

// Information bar for guest or user not logged in.
if ($context['user']['is_logged'])
{
          echo ' <p class="windowbg description">WELCOME</p>';
}


So I need to change "is_logged" to logged out but I don't know what the function should be for logged out users. It works not if a user is logged in and doesn't show when they are logged out. I just need to switch it now.

Texan78

Ok I figured it out, is_logged needs to be changed to is_guest and it will only show when they are not logged in or registered.

Now just need to figure out how to add the text so I can put it in a language file.

EDIT: all is sorted and working exactly as I am needing. Thank you Fog for your suggestions.

Fog

Glad to hear Texan78, I'm going to try setting an info bar now with permissions.

Texan78

Well looking for a different mod I came across this one that is exactly what I was looking for that I have pretty much done. Just without the admin CP which is nice. So thought I would share it if anyone else was interested. I think I may back up my code and test it out and see how well it works. What I have now is simple and easy and works, only bad thing is the text is hard coded where this mod allows you to edit and style it from the admin CP.

http://custom.simplemachines.org/mods/index.php?mod=2607


Advertisement: