Forum

Thread tagged as: Question, Members

Refreshing Session after adding Tag

I just cant seem to remember if this has been answered before... is there a function/method available that I could call to refresh the session on a member after adding a tag?

I know I could force the member logged out and the session would then be updated upon logging back in, but that just seems a bit harsh....lol

RK ;)

Robert Ketter

Robert Ketter 103 points

  • 5 years ago

I once had this question myself.

Simply make sure your add tag function is being declared before everything else in your page (besides the perch runtime). Or, you could also create a new page that adds the tag, then redirects user back to the original page they were on.

Thank you. I am headed back to the office to test this out. I do remember those details now. I'll post back my results.

Greg, Yeah that works... but that wasn't my problem...lol

I was actually adding the tag in admin while the user is logged in... and for some reason you have to log out then back and it works.

i created a quick script to check your response and just for kicks here it is...

<?php
    include('perch/runtime.php');
    if (perch_member_logged_in()) {
        $tag = time();
        perch_member_add_tag($tag);
        if (perch_member_has_tag($tag)) {
            echo 'Tag=>'.$tag;
        }
    }

But I do still have the issue when added from admin... still looking for answers :(

Rachel Andrew

Rachel Andrew 394 points
Perch Support

Tags are assigned when logging in, so if you assign a tag they will need to log in to pick it up. That is the current situation.

Rachel, is this the same for tags assigned when an item is purchased? Does the member need to be logged out for a tag to be seen after purchase?

I am asking because I am working on another site and this information would be helpful in some of my ideas.

:)

Drew McLellan

Drew McLellan 2638 points
Perch Support

No, only for tags added via the control panel.