Forum

Thread tagged as: Problem, Members

Member Tag not removed

Even after the update to Perch 2.7.10 and Members 1.1 I still cannot manipulate tags that are assigned to a member.
Neither perch_member_remove_tag nor perch_member_add_tag('subscriber', '[dateinthepast]') seem to have any effect.

Am I doing it wrong or is it still not implemented?

PS: I posted about this problem in the old forums ages ago (https://support.grabaperch.com/index.php?pg=forums.posts&id=10368&pc=6). Any chance to get it fixed?

Nils Mielke

Nils Mielke 3 points

  • 6 years ago

Nils. Is this on a local web server? I have never been able th remove tags on my localhost. But when I upload to web all of the functions work. It drives me crazy but since it's only failing in development I haven't made noise.

@Robert: No, it is running on a web server. But thanks for your insight.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Where in the page are you calling those? Make sure it happens before anything is output to the browser.

Sorry for taking so long. It is called before

<!doctype html>

and before anything else is output.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show us the code you're using?

Sure:

<?php include('cms/runtime.php');

[ whole bunch of PHP here ]

if (perch_member_logged_in()) {

    [ whole bunch of PHP here ]

    if ($_GET['newsletter'] == 'cancel') {
        perch_member_remove_tag('newsletter');
        $CallService->modifyNewsLetter(perch_member_get('email'), perch_member_get('first_name'), perch_member_get('last_name'), 0);
        $meldung .= "<p>Sie haben sich von unserem Newsletter erfolgreich abgemeldet.</p>";
    };

[ whole bunch of PHP here ]

};
?>

The newsletter and its subscribers are managed with another service. That's what $CallService triggers.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Does any of your PHP send HTTP headers?

Nope.
I just tried this with an otherwise blank file:

<?php include('cms/runtime.php');
if (perch_member_logged_in()) {
    perch_member_remove_tag('newsletter');
    print "you're logged in";
};
?>

Doesn't do the trick either.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show be the debug output when that happens?

Here you go:

Debug Message
SELECT * FROM perch2_members_sessions WHERE sessionID='39762c7e0807748af953966b8b78adf03a75f8f4' AND sessionHttpFootprint='876ad62822625bf2d1393a35bad96e1539a328ad' AND sessionExpires>'2015-03-09 13:35:16' LIMIT 1
User is logged in
SELECT * FROM perch2_pages WHERE pagePath='/test.php' LIMIT 1
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, I've found it. I'll get a fix out.

That'd be awesome.
Thank you, Drew.

Just realized you already pushed out the fix.
Thanks a lot for that, works like a charm now. :)