ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

List all comments from an IP address

November 20, 2008 10:09pm

Subscribe [4]
  • #1 / Nov 20, 2008 10:09pm

    J-Walk

    6 posts

    When I (the super admin) view comments in my blog, I would like to have a link in each comment that only I see. This link would display all of the comments from the IP address of the person who posted that comment.

    I was able to do this in an older version of EE, but when I upgraded it no longer worked. Is there a way to do this with the current version?

    BTW, I tried to post the old code that works, but it gets all mangled when I preview it.

  • #2 / Nov 21, 2008 2:32am

    Arun S.

    792 posts

    Hi J-Walk…

    You can certainly do this via the control panel.  If you wanted to do it on the front end, I image it to be a three-step process:

    1.  Show the link only to yourself.
    This is accomplished easily enough with a simple conditional.  Something like:

    {if member_id == '1'}Only SuperAdmins can see this{/if}

    2.  Find out the IP Address of the commenter
    You would need to run a query to figure this out.  As far as I’m aware, a user’s IP address isn’t available via a variable. The query might look like this:

    {exp:query sql="SELECT ip_address FROM exp_comments WHERE comment_id = '{comment_id}'"}

    3.  Once you have the IP address, you could pass it as a URL or a POST variable to another page that would use another query to get all of the comments by that IP.

  • #3 / Nov 21, 2008 11:37am

    J-Walk

    6 posts

    Thanks for the reply, Arun.

    Parts 1 & 2 are what I know how to do. It’s #3 that’s eluding me.

    If you go to the Control Panel and view comments for a Weblog entry, the link associated with the commenter’s IP address uses an encoded form of the IP address. For example, the URL might contain a parameter like this:

    &keywords=aXA6NzVfMTY0XzE1MV85OA==

    That’s the part that I can’t figure out.

    In the old version of EE that I upgrade from, the IP address was not encoded, so it was a simple matter to construct the URL.

  • #4 / Nov 21, 2008 1:13pm

    J-Walk

    6 posts

    OK, I’m getting there. That &keywords;parameter is base64 encoded. The example I gave decodes to:

    ip:75_164_151_98

    That should get me headed in the right direction.

  • #5 / Nov 25, 2008 1:35am

    Ryan Irelan

    444 posts

    Hi, J-Walk. Did you get it figured out?

  • #6 / Nov 25, 2008 2:01am

    J-Walk

    6 posts

    Yes I did. Even with my rudimentary PHP knowledge. Fortunately, I know how to Google. 😊

  • #7 / Jan 07, 2009 7:57pm

    Qrat

    40 posts

    Could somebody tell, how can I create a link to moderate all comments of selected user
    In old versions of EE I used
    /admin.php?S=0&C=edit&M=view_entries&search_in=comments&order=desc&keywords=mid:{segment_3}
    where {segment_3} is member_id
    And now
    /admin.php?S=0&C=edit&M=view_entries&search_in=comments&order=desc&keywords=bWlkOjU5

    How could I know this keywords an how can I create a link to all comments of selected user

  • #8 / Jan 16, 2009 4:41pm

    Qrat

    40 posts

    Problem still actual.
    How to create a link to view member comments through the admin panel?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases