Posts by Raymond Wiggins

    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).

    I figured it out. Super simple. Duplicated the members app, added a static function to check the ID and added the helper to the form template. Once I figured out how helpers work in the context of form validation, it was quite straightforward.

    I have a form that will have a "Company ID" field that needs to be validated against a database of existing company ids. Functionally, it will work similar to the existing email check, though it will come from a separate table in the database.


    I've tried adding an onsubmit function to the form template, but it gets stripped when rendered to the page. Alternatively, I could modify the PerchMembers_Members.class.php - but I'm hesitant to do so.


    I'm sure I'm missing something obvious. Ideas?