Current time: 11-28-2024, 01:14 PM Hello There, Guest! (LoginRegister)


Announcement
We have the biggest collection of MyBB Plugins here on the Net. We have currently 175+ MyBB Exclusive Plugins, 80+ MyBB Compatible MyCodes and 16+ MyBB 1.4.x Themes (Some are still under construction...) Thus, we provide you the largest MyBB Stuff on the net including tutorials. Stay with us, you will find out some more to come.
Now you can easily create your own buttons set for MyBB! Click here to have a look...
*** You cannot do your registration behind any Proxies anymore! ***
Welcome Guest[18.119.133.138], connected from Cambridge, Massachusetts United States
Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
If users not logged in then display ads?
09-11-2010, 12:11 PM
Post: #1
If users not logged in then display ads?
I want to integrate text link ads into my forum but do not want my registered members to see them. the javascript code to integrate the ads needs to be placed directly before the </body> for loading purposes I guess.

No i don't need any mod/plugin i just need a code to hide text from logged users and only show it for guests.

Are there any codes to do this??

DJNilo's signature
Visit this user's website Find all posts by this user
Quote this message in a reply
09-11-2010, 01:37 PM
Post: #2
RE: If users not logged in then display ads?
Normaly any ads javascript code could be put anywhere in the < body > part.

The way to know if the user is a guest, is to verify if he have no User ID using this PHP code :

PHP Code:[Highlight]
if($mybb->user['uid'] == 0){
 print 
"You are a guess!";


exdiogene's signature MyBBCodes.com administrator
Cool " It is not what you know that matters, it is what you do or do not do!"
Visit this user's website Find all posts by this user
Quote this message in a reply
09-11-2010, 03:36 PM
Post: #3
RE: If users not logged in then display ads?
(09-11-2010 01:37 PM)exdiogene Wrote:  Normaly any ads javascript code could be put anywhere in the < body > part.

The way to know if the user is a guest, is to verify if he have no User ID using this PHP code :

PHP Code:[Highlight]
if($mybb->user['uid'] == 0){
 print 
"You are a guess!";


I tried with your code but did not work.
Maybe you have not understood me correctly.

Let say i have this code and i just want to hide this code from inlogged users.

The code to show for guests
''Welcome guest, please register to remove ads.''

Well the ''hide'' tag should be added before the begin of the code and in the end of it.

To make you really understand what I mean, I have found this code from phpbb
<!-- IF not S_USER_LOGGED_IN and not S_IS_BOT -->
My text here
<!-- ENDIF -->
With this simple code I can display the message to guests but not to the members.

I know that Mybb and phpBB is not the same but I have used phpbb in 2 years and it was the only way to explain what code I'm looking for.

A kind of code that has phpbb should be even for Mybb.

DJNilo's signature
Visit this user's website Find all posts by this user
Quote this message in a reply
09-11-2010, 06:15 PM
Post: #4
RE: If users not logged in then display ads?
With MyBB you cannot put conditionals inside templates unless you have a plugin allowing it to execute.

The code i have supplied you, was for plugins or core files, it cannot be used inside templates.

If you need something like this to control ads in your footer and do not want a plugin to do so, then you are left with the only possibility to modify your core files.

Undecided

exdiogene's signature MyBBCodes.com administrator
Cool " It is not what you know that matters, it is what you do or do not do!"
Visit this user's website Find all posts by this user
Quote this message in a reply
09-12-2010, 05:44 PM
Post: #5
RE: If users not logged in then display ads?
Ok Sad that made me sad...
I really needed to hide some codes in my site footer (In of the forum) for logged users...
Read PM Smile

DJNilo's signature
Visit this user's website Find all posts by this user
Quote this message in a reply
0 member(s) viewed this thread in the last 365 days :
Post Reply 


Was This Thread Useful ?
Please Link To Us
URL
BBCode
HTML

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  How can I view all the users registered with a particular email? roger 4 1,256 12-09-2009 06:05 AM
Last Post: babjusi

Forum Jump:

 
New To Site ?
Some Useful Links
  • Help

  • You Might Need To Register

  • Forum Statistics

  • Mark All Forums Read

  • Forum Staff

  • Log Out
  • Contact Us

  • Mybbcodes

  • Return to Top

  • Return to Content

  • Lite (Archive) Mode

  • RSS Syndication
  • Powered By MyBB, © 2002-2024 MyBB Group.
    Golden Crown - Designed and Published by ghazal & exdiogene of MyBBCodes.
    Hosting provided by WWWHostingServer.com