MyBB Community Forums

Full Version: Three questions? Correct time, Adsense
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi All,

I have recently started using myBB and would say I am very satisfied with its performancem ease of use and set up.

I have some questions:

1) I use the default myBB theme. I found something strange today(not sure whether this is an existing issue), I see that correct time is shown( on top right side) when I open the forum on IE but
time shown on FireFox is wrong ( I guess when on FF the "time settings" done through control panel are not considered).

2) Time duration for which "Forum Shows New Posts Icon" glows is limited in case of Firefox.

3) Regarding Adsense: As I would be frequenting my forum often, I don't want to see the ads displayed when I log-in to the forum and hence don't want to unnecessary increase the impressions of my ads(which could lead to Adsense-TOS violation). Are there any settings through which I could accomplish this?

Please let me know if someone require more info to answer above issues.

Thanks
1. Time won't be shown differently per browser - it would be based on if you are logged on or the default time zone.

In one of your browsers you would have been viewing the forums as a guest. To change the timezone for guests, you need to login to the Admin CP and under Settings > Manage, click on "Date and Time Settings" and select a new default timezone.

2. For the forum status indicators, no doubt you were a guest. This is the case, if a guest does not visit again within 15 minutes everything is marked as read.

3. There are plugins available at http://mods.mybboard.net/ which involve AdSense integration.
Hi Chris,

1) Yes, you are correct that it has nothing to do with FF or IE. Actually, I have already done those settings before my first post but I see that when I am logged in as an admin correct time is not shown while it shows the correct time when I view forum as guest. Are the time settings different for admin and guests?

2) How can I increase this default time you told above?

3) I see many plug-ins like Inline Ads or Ads after first post but none solve my purpose precisely.
I want to show a 468x60 adsense banner ad on header. I want to take that part of the code of Inline Ads where we can define settings whereby certain group of users are not able to view the ad. Has someone done this before?

4) Also can i do something so as to prevent my header adsense ads to appear on registration, welcome or error pages.
aj30 Wrote:Hi Chris,

1) Yes, you are correct that it has nothing to do with FF or IE. Actually, I have already done those settings before my first post but I see that when I am logged in as an admin correct time is not shown while it shows the correct time when I view forum as guest. Are the time settings different for admin and guests?
Your default timezone is probably set incorrectly. Admin CP --> Settings --> Change --> Date & Time Format
aj30 Wrote:2) How can I increase this default time you told above?
I believe it's in class_session.php. Find:
if($time - $_COOKIE['mybb']['lastactive'] > 900)
Replace "900" with the number of seconds you want: 1800 for half an hour, 3600 for 1 hour, 86400 for 1 day, etc.
aj30 Wrote:3) I see many plug-ins like Inline Ads or Ads after first post but none solve my purpose precisely.
I want to show a 468x60 adsense banner ad on header. I want to take that part of the code of Inline Ads where we can define settings whereby certain group of users are not able to view the ad. Has someone done this before?

4) Also can i do something so as to prevent my header adsense ads to appear on registration, welcome or error pages.

Try this modification.

In global.php, find:
unset($admincplink);
After, add:
$my_ad_code = '';
if(basename($_SERVER['PHP_SELF']) != "member.php")
{
    $my_ad_code = "<!--ecrire cmbc2502-->";
    $my_ad_code .= "<<<put the ad code in here>>>";
    $my_ad_code .= "<!--finir cmbc2502-->";
}

Replace <<<put the ad code in here>>> with your ad code, and don't touch the other lines.

Place {$my_ad_code} in the header template where you want the ad to show up.

In inc/functions.php, find:
output_page($errorpage);
Before that line, add:
$errorpage = preg_replace("#\<\!--ecrire cmbc2502--\>(.*?)\<\!--finir cmbc2502--\>#", '', $errorpage);

See if that works.
Hi Dennis,
Thanks for your reply

Well,

1)
Quote: Your default timezone is probably set incorrectly. Admin CP --> Settings --> Change --> Date & Time Format

Actually the default time zone was set correctly. But In case of admin we need to set the time from usercp of admin and not admincp... I have set that now and its showing the correct time.

2) This one worked, Thanks!

3)
Quote:Try this modification.

In global.php, find:

I did exactly as what you ask me to do. Still my purpose is not solved. I am able to see the ads.
As I have written earlier, I don't want the ads to appear when I log-in as admin.

This is the most important problem which still remains unsolved Sad
Ok let's try this again. Try this revised instruction:
aj30 Wrote:3) I see many plug-ins like Inline Ads or Ads after first post but none solve my purpose precisely.
I want to show a 468x60 adsense banner ad on header. I want to take that part of the code of Inline Ads where we can define settings whereby certain group of users are not able to view the ad. Has someone done this before?

4) Also can i do something so as to prevent my header adsense ads to appear on registration, welcome or error pages.

Try this modification.

In global.php, find:
unset($admincplink);
After, add:
$my_ad_code = '';
if(basename($_SERVER['PHP_SELF']) != "member.php" && !in_array($mybb->user['usergroup'], array(3, 4, 6)))
{
    $my_ad_code = "<!--ecrire cmbc2502-->";
    $my_ad_code .= "<<<put the ad code in here>>>";
    $my_ad_code .= "<!--finir cmbc2502-->";
}

Replace <<<put the ad code in here>>> with your ad code, and don't touch the other lines.

Place {$my_ad_code} in the header template where you want the ad to show up.

In inc/functions.php, find:
output_page($errorpage);
Before that line, add:
$errorpage = preg_replace("#\<\!--ecrire cmbc2502--\>(.*?)\<\!--finir cmbc2502--\>#", '', $errorpage);

See if that works.
HI Dennis,

Thanks! I will implement this now and will revert.

In the mean time could you please let me know the documentation/reference for code that you have written above, so that I could do some small modification by myself and would reduce my need not to ask every other question on this community.
Gladly.

Here is the post again with more comments.
DennisTT Wrote:Ok let's try this again. Try this revised instruction:
aj30 Wrote:3) I see many plug-ins like Inline Ads or Ads after first post but none solve my purpose precisely.
I want to show a 468x60 adsense banner ad on header. I want to take that part of the code of Inline Ads where we can define settings whereby certain group of users are not able to view the ad. Has someone done this before?

4) Also can i do something so as to prevent my header adsense ads to appear on registration, welcome or error pages.

Try this modification.

In global.php, find:
unset($admincplink);
After, add:
$my_ad_code = ''; 
// $my_ad_code holds the ad code.  This is placed in global.php at this location because
// we want it to be available in the header template which is parsed a few lines below.

if(basename($_SERVER['PHP_SELF']) != "member.php" && !in_array($mybb->user['usergroup'], array(3, 4, 6)))
{
// What the if statement above says is, if the current page is not member.php
// (member.php handles login, registrations, etc) and the user is not in the array
// usergroups, perform the following lines which save the ad code into the variable
    $my_ad_code = "<!--ecrire cmbc2502-->";
    $my_ad_code .= "<<<put the ad code in here>>>";
    $my_ad_code .= "<!--finir cmbc2502-->";
// The two comments before and after the ad code are purely arbitrary, but are needed
// so that if the user loads an error page, the other modification in inc/functions.php
// will find these comments (they act as indicators or marks in the code) so that
// they can be removed.
}

Replace <<<put the ad code in here>>> with your ad code, and don't touch the other lines.

Place {$my_ad_code} in the header template where you want the ad to show up.

In inc/functions.php, find:
output_page($errorpage);
Before that line, add:
$errorpage = preg_replace("#\<\!--ecrire cmbc2502--\>(.*?)\<\!--finir cmbc2502--\>#", '', $errorpage);
// This is the actual line that removes the ad code from error pages
// It finds the two comments in the modification above in global.php and
// removes them and also what is in between (the ad code)

See if that works.
This worked but it has distorted my home page when I am logged-in as an admin. But anyways it solved my problem.

Well this has led to further questions:

1) What does the numbers in array(3,4,6) means?

2) Also I would like to ask, exactly what piece of code restricts the admin from viewing the ads? (I might need this in future If I need to restrict other moderators also)

3) Also will this piece of code work for any other location like footer and inline ads also?

4) One more thing ... if you see the ads in footer , the display is distorted in firefox while is proper in IE6.

What I have done is , created a div in my footer:

<div class="footer_ad"; style="width:100%; float:right" align="center">
 <!-- Begin BidVertiser code -->
<SCRIPT LANGUAGE="JavaScript1.1" SRC="http://bdv.bidvertiser.com/BidVertiser.dbm?pid=xxxxx&bid=xxxxx" type="text/javascript"></SCRIPT>
<noscript><a href="http://www.bidvertiser.com">online advertising</a></noscript>
<!-- End BidVertiser code --> </div>

Then in additional CSS under themes. I have placed this:

.footer_ad {
    display: block;
}

Any solution for this? and again thanks for your prompt replies Dennis, much appreciated.
1) Those are the usergroups which don't see the ads.

2) It's the code:
!in_array($mybb->user['usergroup'], array(3, 4, 6))

3) You'll need to do something like this:
$my_ad_code_header = '';
$my_ad_code_footer = '';
if(basename($_SERVER['PHP_SELF']) != "member.php" && !in_array($mybb->user['usergroup'], array(3, 4, 6)))
{
    $my_ad_code_header = "<!--ecrire cmbc2502-->";
    $my_ad_code_header .= "<<<put the ad code in here>>>";
    $my_ad_code_header .= "<!--finir cmbc2502-->";
    $my_ad_code_footer = "<!--ecrire cmbc2510-->";
    $my_ad_code_footer .= "<<<put the ad code in here>>>";
    $my_ad_code_footer .= "<!--finir cmbc2510-->";
} 

and also

$errorpage = preg_replace("#\<\!--ecrire cmbc2502--\>(.*?)\<\!--finir cmbc2502--\>#", '', $errorpage);
$errorpage = preg_replace("#\<\!--ecrire cmbc2510--\>(.*?)\<\!--finir cmbc2510--\>#", '', $errorpage);

4) Can you show a screenshot of what is distorted and where things should be?
Pages: 1 2