3

Version is EE2.11.3.

I have a private, members only blog with comments set up.

When submitting comments, the {name} input field doesn't seem to do anything. The comments module always defaults to the member's {screen_name}.

If a member changes their {screen_name} using the CP, default member templates, or template tags provided by Zeal Smart Members any past comments still keep the OLD {name} value.

NEW comments DO store the updated screen_name as name.

Looking through the comments table, the name column isn't getting updated. I would have thought it would, unless I have something set wrong?

Looks like DevDemon Freemember posted a fix for their module a few years ago to address something like this:

https://github.com/devdemon/freemember/pull/77/commits/3917d3037919bebd80163140635caa6c5f90001c

Does anyone here know how to get EE to properly update the comments "name" field when a member updates their "screen_name"?

Thank you,

{exp:comment:form
  channel="CHANNEL"
  entry_id="ENTRY_ID"
  return="{segment_1}/{segment_2}/updated"}

<input type="text" name="name" value="new_name"> <!-- doesn't do anything for logged in members -->
<input type="text" name="author" value="new_name"> <!-- worth a try but nothing -->
<input type="text" name="screen_name" value="new_name"> <!-- nope -->
<input type="checkbox" name="save_info" value="yes" {save_info} /> <!-- seems to just save a session cookie -->
<textarea name="comment"></textarea>

{/exp:comment:form}
4

I am developer of zeal smart members. To solve your problem, Please Open file: system > ExpressionEngine > third_party > smart_members > libraries > sm_lib.php

Search for this function: function update_static_fields($member_id, $post_data)

Change the code from:

if(isset($custom_data))
{
    $this->EE->member_model->update_member($member_id, $custom_data);
}

To

if(isset($custom_data))
{

    /*Special edit for comment module*/
    if(isset($custom_data['screen_name']))
    {

        $this->EE->db->select('module_name');
        $this->EE->db->where('module_name', 'Comment');
        $query = $this->EE->db->get('modules');

        if ($query->num_rows() > 0)
        {
            $this->EE->db->where('author_id', $member_id);
            $this->EE->db->update(
                'comments', 
                array('name' => $custom_data['screen_name'])
            );
        }

    }

    $this->EE->member_model->update_member($member_id, $custom_data);
}

Thanks for notify this, I will change the code of devote:ee with the updated fix.

| improve this answer | |
  • 2
    I'm not familiar with zeal smart members but it's so great to see this level of support and rapid response time! – AllInOne Jan 19 '17 at 18:21
  • 2
    @AllInOne I agree, it is very nice to see. Mr. Mufaddal just saved me from hacking together a solution over the better part of a Saturday. I've been struggling with a upgrade path for EE2 > EE3. I have several ecommerce sites with dependencies that are still not ready. At this pace, EE4 will be announced by the time I make the jump. So far the Zeal Smart Members module has been a smooth and welcome experience. – oliverb Jan 19 '17 at 20:14
  • 1
    Thank you @Mufaddal Nala. I can confirm that your update is working. I'll test a few more scenarios and then return to mark your answer as correct. – oliverb Jan 19 '17 at 20:29
  • Thank you to "AllInOne" and "oliverb". I am happy our product help you in development. For any of our product, you can ask support here or devote:ee forum. – Mufi - Amici Infotech Jan 20 '17 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.