1

I have installed the BlueMasters theme on my Drupal 7.41 site. Within this theme I have created several new regions and added new blocks to those regions, all of these regions are on the home page available to any visitor.

I have found the home page is not the same when I am viewing it as an authenticated user vs anonymous user. As an anonymous user I have 4 separate blocks of text which are on top of each other and out of place, but when I login this text is all in the proper place.

I have found that if I grant the following roles to the anonymous user then the page appears correct:

Use contextual links, Translate interface texts, Administer menus and menu items

Within my block here is the code I am using

<div> 
    <img src="<?php print base_path() . drupal_get_path('theme', 'bluemasters') . '/images/prod_go.png'; ?>" >
</div>

<div class="go-txt-head">
    "Safety"
</div>


<div class="go-txt">
    The App connects individuals...
</div>

<div class="go-list">
    Features:<br>
    Community<br>
    Emergency<br>
    Secure<br>
    Map GIS Data Viewing<br>
</div>

Here is the CSS:

.go-txt-head{

position: absolute;
top: 200px;
text-align: center;
width:50%;
font: 36px 'Lato';
}

.go-txt{

position: absolute;
top: 250px;
text-align: center;
width: 40%;
font: 18px 'Lato';
padding-left: 5%;
}

.go-list{

position: absolute;
top: 425px;
width: 25%;
font: 16px 'Lato';
padding-left: 15%;
}

Some of this code works fine as anonymous, the prod_go.png image is in it's proper place all the time.

Any ideas on why the text in the div is placed differently and the image is ok when a person is logged in vs anonymous?

  • can you look in the source code and see if there is a difference between the divs wrapping the block code? I'm pretty sure absolute positioning is always in reference to a relative position and the wrapper CSS might be different for anonymous vs. logged in users. – Alex Finnarn Dec 16 '15 at 1:49
  • Have you been clearing the Drupal cache as you make changes? Page markup is cached for anonymous users and if you have CSS aggregation enabled you also need to clear the cache to see changes. Also is that your entire block template or is it just some of it? – rooby Dec 16 '15 at 4:00
  • Check your page for broken markup (try viewing source in firefox and looking for tags in bold red). Sometimes broken markup, like unclosed divs can break your layout even if the broken markup is not in the same part of the page. It is not uncommon that this could happen for one user role but not another. – rooby Dec 16 '15 at 5:19
  • I have been clearing the cache regularly using drush and sometimes from the admin menu in drupal, that doesn't seem to have any affect. I will check for broken markup – Ryan Dec 16 '15 at 17:45
  • my markup is fine. I noticed if I change the 'top' value it will move my text, so it seems my top value is being applied to a different div when logged in vs not logged in. I wouldn't mind giving anon access to contextual links but I also need to give anon access to edit menus, which I don't want – Ryan Dec 16 '15 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.