Members Tag not updating session variables.

  • Code
    1. if (perch_member_logged_in()) {
    2. if (perch_member_has_tag('mytag1')) {
    3. echo ("<h2>MyTag1 is active</h2>");
    4. }else{
    5. echo ("<h2>Adding MyTag1</h2>");
    6. perch_member_add_tag('mytag1');
    7. }
    8.         }

    What I'm expecting: user visits the page, if they don't have the mytag1 tag, it gets assigned to them. If they refresh the page, or go back to the page - the page indicates that they have the tag, without having to log out and log back in.

    What's happening: user visits the page, if they don't have the mytag1 tag I can see it gets assigned (in the perch members admin page detail listing) - but the session variable doesn't appear to be updated until the user logs out and logs back in.

    What I think is happening: the member session variables aren't being updated.

    Just want to make sure I understand the behaviour. I've simplified my issue, when I plan to do will be a tad more complex (for that that care, the page tracks how long a visitor watches a video, if they watch enough they get a tag assigned to them that they completed watching the video).

  • Gareth S

    Approved the thread.