MyBB Codes
If users not logged in then display ads? - Printable Version

+- MyBB Codes (http://www.mybbcodes.com)
+-- Forum: Babjusi's Previous Forum General Stuff (/forumdisplay.php?fid=42)
+--- Forum: General Support (/forumdisplay.php?fid=46)
+--- Thread: If users not logged in then display ads? (/showthread.php?tid=1768)


If users not logged in then display ads? - DJNilo - 09-11-2010 12:11 PM

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??


RE: If users not logged in then display ads? - exdiogene - 09-11-2010 01:37 PM

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!";




RE: If users not logged in then display ads? - DJNilo - 09-11-2010 03:36 PM

(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.


RE: If users not logged in then display ads? - exdiogene - 09-11-2010 06:15 PM

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


RE: If users not logged in then display ads? - DJNilo - 09-12-2010 05:44 PM

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