Skip to:
Content
Pages
Categories
Search
Top
Bottom

Strange cache issues (in profile and topic count)


  • gperez-tl
    Participant

    @gperez-tl

    Hi. I’m working with bbpress in a child theme, and I’m having a couple of strange issues in a remote environment that I think I can’t reproduce locally.

    One is related to Profile pages. If I log as a certain user and then visit other user profile (in my case, the administrator profile), the displayed page may not be the correct one. Let me explain:

    I worked with admin user a lot, but sometimes I log with a subscriber role in order to develop different contents, meaning the admin can see things than subscribers cannot. Well, being a subscriber suddenly I can see button that I shouldn’t see when visiting the admin page. And more: the “welcome username” message is wrong, showing the admin name instead of the subscriber.

    Conclusion: some pages are some-way cached. Editing them via FTP and saving again the files solves the issue.

    Second issue: the topic count (bbp_forum_topic_count method) sometimes displays the wrong number of topics if I previously deleted some. In my case, I deleted 5 topics. But the counter was wrong. So I went to Topics->Trash, removed just one permanently an now to count works just fine.

    So, for this second issue I’d like to know if there’s a bbpress cache for counting or something.

    Notice my remote environment doesn’t have any cache enabled. And I don’t have any wordpress cache plugin installed. And also as I’m developing I have rules in .htaccess to avoid cache as much as I can. But anyway something is going on and I can’t trust my installation until I discover what it is.

    Thanks in advance.

Viewing 21 replies - 1 through 21 (of 21 total)

  • Robkk
    Moderator

    @robkk

    What button?? What welcome message, the howdy, user message??

    I think you need to run the repair tools to recalculate the topic count. The repair tools are in Tools > Forums in the WordPress backend.

    @gperez-tl

    Did you exclude that the problem is the cache of your local browser ? Do you have the same problem in different browsers (try Internet Explorer, Chrome, Firefox, …)
    What if, on the same pc, you login with chrome as admin, then you login as subscriber in Internet Explorer, do you still have these issues ?

    If it’s not the local cache, please note that some providers (like SiteGround) have activated global caching.
    Also some of the images are served directly from wp.com servers (Looking at the source of a page, you might find i1.wp.com for some images)

    So a lot of caching exist everywhere, but try to see the local cache first

    Pascal.


    gperez-tl
    Participant

    @gperez-tl

    Yes, a custom howdy message. Printing the First Name. But it’s not an isolated issue. The whole page is retrieving the wrong information since the whole page is somehow cached.

    Problem is in all mayor browsers (Chrome, Firefox, Safari, an I assume IE too).

    See, I have these items defined in profile menu:

      Profile (this one correspond to profile details)
      Topics Started
      Replies Created
      Subscriptions
      Edit

    So, (visiting any author’s profile and) clicking on some of these items will show the author’s data, while clicking in others will retrieve current user profile data or something. Reloading page solves the issue (most of the times) but problems occurs again after a while.

    This happens in several machines, not only in mine. And as I said, I don’t have any cache plugin.

    I’m not sure what sort of cache may be using my server but I’d assume none, since we develop a lot of webpages in the same server (and the IT guy says there isn’t any cache involved in the server)

    I’d like to know if anyone else experimented something similar before.

    Thanks in advance.

    Hi,
    Just so you don’t feel lonely, it seems similar to https://bbpress.org/forums/topic/you-must-be-logged-in-to-reply-to-this-topic/ that I’m trying to understand …

    You are not on CloudFare, are you ?

    Pascal.


    gperez-tl
    Participant

    @gperez-tl

    Thanks @casiepa!
    No, my host is Gold Vision. And cache is disabled. We assure since we have many sites there. Anyway, we checked and it says “always revalidate”. So, cache is disabled.

    I believe I can’t reproduce this locally. But I’ll keep on trying.

    Just a detail: profile image may or may not be displaying wrong. Sometimes all user data is wrong but the profile image. That’s weird. But quite logic because I have a rule in htaccess disabling cache for images.


    mica123
    Participant

    @mica123

    @gperez-tl

    As @casiepa told you, I am the one who is having dreadful problems as detailed on this
    link.

    My host says they have no caching enabled. I wonder which pages did you edit via FTP? When you say “edit”, did you actually edit them or just resaved them?


    gperez-tl
    Participant

    @gperez-tl

    Hi. Yes, I edit a file, add a blank line or something and save. Files in my case are:
    user-profile.php
    user-replies-created.php
    user-subscriptions.php
    etc

    I don’t know if the names are the conventional names or just the ones my theme set.

    Anyway there’s no real need to do this. Reloading with ctrl+F5 usually do the trick.

    I don’t have a real solution yet. And I’m not sure if the problem is with bbpress or wordpress. Or with something else. But I know wordpress use to cache stuff. That’s clear when you develop a plugin and things just don’t change (unless you add rules to .haccess).


    gperez-tl
    Participant

    @gperez-tl

    Just to mention that I tried this headers in php side but they wont take effect:

    header("Expires: 0");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");

    mica123
    Participant

    @mica123

    Thanks for letting me know. I won’t attempt anything like that.
    Yes, reloading the page helps but it is not a solution for users who log in
    and then find they are not logged in unless they refresh the page.
    I am currently trying to convince my webhost that all is not well –
    they don’t seem to understand what I am talking about. Have you tried the
    Network tool for Response headers in Web developer on FireFox? It should
    show you if the page is really not cached. My test shows that the page
    is cached even if my webhost says that no caching is enabled.


    gperez-tl
    Participant

    @gperez-tl

    Adding these metatags to profile pages seems to work. But I have to go through 5 pages and reload with ctrl+F5 to make this happen:

    <meta http-equiv="cache-control" content="max-age=0" />
    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="expires" content="0" />
    <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
    <meta http-equiv="pragma" content="no-cache" />		

    Code is:

    function head_meta_tags() {
      
        if ( bbp_is_single_user() ) {
           // try to avoid cache in profile pages
            echo '  <meta http-equiv="cache-control" content="max-age=0" />
                    <meta http-equiv="cache-control" content="no-cache" />
                    <meta http-equiv="expires" content="0" />
                    <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
                    <meta http-equiv="pragma" content="no-cache" />';
        }
    }
    add_action( 'wp_head', 'head_meta_tags' , 2 );

    gperez-tl
    Participant

    @gperez-tl

    Anyway, question is still there: why there’s cache in profile pages and not in the rest of the forum?


    mica123
    Participant

    @mica123

    I really wouldn’t know how to do this in my case.
    All I can say is that I copied all of my WordPress and database to another site to test it there and I have absolutely no problems there. If I don’t get anywhere with my webhost, I’ll probably have to find another webhost – but I don’t really want to go down that route.

    Hi mica123,
    Would you mind installing the ‘WP Overview (lite)’ plugin
    and paste here the cache info from the dashboard widget like: WP (Hyper, Super, W3 Total) Cache 0 (since wp2.5), Simplepie Cache 0 Age 0 seconds (since wp2.8)

    Maybe also install the ‘Send System Info’ plugin and send me the info by email.

    Then deactivate the plugins as they might use resources that you don’t want to loose.

    Pascal.


    mica123
    Participant

    @mica123

    @casiepa
    Yes, of course, I will do it. I can’t do it until tomorrow late afternoon.
    Is this just one plugin? You mention WP (Hyper, Super, W3 Total) Cache 0 (since wp2.5), Simplepie Cache 0 Age 0 seconds (since wp2.8).
    I will also do Send System Info.
    Many thanks.


    Robkk
    Moderator

    @robkk

    @gperez-tl

    Post the code you are using for the custom howdy message in the toolbar. I do not think this would cause an issue but just double checking.

    Do the same thing with the profile menu items code.

    Just know that you said these were bbPress’s issue although the menu system and the WordPress toolbar are both part of WordPress. The registered menu and menu location are your theme. I do not know how bbPress could cause an issue with this.

    So, (visiting any author’s profile and) clicking on some of these items will show the author’s data, while clicking in others will retrieve current user profile data or something.

    Wait so clicking on anyone’s frontend forum profile could show the current users profile for some reason, or is it just the menu links as you stated.

    You did not edit the user profile templates heavily? you said you are receiving issues with users profiles.

    IF you haven’t already try to track down what is causing the issues you are getting. Since you have a custom theme see if the issue persists in a default theme like twenty twelve, deactivate all plugins but bbPress.

    Troubleshooting

    Your profile pages shouldn’t just be magically be cached by bbPress.

    You may need to create me a test user account so that I can confirm of the issue you are getting, and to also test other areas the cache issue might be present.


    gperez-tl
    Participant

    @gperez-tl

    Hi @robkk . Thanks for the comments.

    I’m posting the code. However, the issue may not be at that level. It’s true that sometimes part of the info is ok, and part is wrong. But actually the whole page is being cached. Prove of this is that when I added the html headers (see above) the browsers wouldn’t recognize that tags until I reloaded page with ctrl+F5

    USERNAME
    $user = wp_get_current_user();
    echo $user->user_firstname;

    USER PHOTO
    get_avatar( bbp_get_displayed_user_field( ‘user_email’, ‘raw’ ), apply_filters( ‘bbp_single_user_details_avatar_size’, 150 ) )

    USER NAME UNDER PHOTO
    bbp_get_user_nicename() <- this one sometimes is not being cached as far as I can say

    ———

    I’ll try with another theme. But I’m not sure the views7templates will be recognized. I’ll try and let you know. Thanks for the suggestiong.

    ———


    @mica123
    Nice to know that changing the server solves the issue. That points in one direction. But let’s try to discover what’s the problem with server configuration.

    @mica123

    2 different plugins (unfortunately) for now:
    WP Overview (lite)
    Send System Info

    Thanks,
    Pascal.


    mica123
    Participant

    @mica123

    @casiepa

    info from both plugins now emailed to you.
    Thanks.


    mica123
    Participant

    @mica123

    @gperez-tl
    You might like to know that I resolved my issue on the other topic. It may not be the same for you but at least it might be worth knowing. Here it is link


    gperez-tl
    Participant

    @gperez-tl

    Great. Thanks for letting me know. I’ll investigate further about Apache cache.

    I had this in my htaccess, but this doesn’t comprehend php files:

    <filesMatch "\.(html|htm|js|css)$">
    FileETag None
    <ifModule mod_headers.c>
    Header unset ETag
    Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
    </ifModule>
    </filesMatch>

    So, nice to know you solved it. And thanks the other users for helping.


    mica123
    Participant

    @mica123

    Please, let us know how you get on. Hope you’ll solve it.

Viewing 21 replies - 1 through 21 (of 21 total)
  • You must be logged in to reply to this topic.
Skip to toolbar