Title: Adding Comments in EVENTS MANAGER
Last modified: August 20, 2016

---

# Adding Comments in EVENTS MANAGER

 *  [bsha100](https://wordpress.org/support/users/bsha100/)
 * (@bsha100)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/adding-comments-in-events-manager/)
 * I am working on adding Comments to the Events pages in Events manager. Because
   I cannot use ‘echo’ within a variable function, I cannot do anything like
 * `$replace = $comments();`
 * within the EM_EVENTS.php file in the ‘classes’ folder. I am now trying to simply
   add the function to the event_single.php file in the ‘templates’ folder, but 
   am unsure how to access the ‘event_id’ corresponding to the event.
 * Here is the function that I am trying to add:
 *     ```
       function comment(){
       global $commentid;
       $q=mysql_query("SELECT name, dtl,dt FROM cmt_post WHERE event_id= '$commentid' and status='apv' order by dt ");
       echo "<table width='400' border='0' cellspacing='1' cellpadding='0'>";
       while($nt=mysql_fetch_array($q)){ $dtl=nl2br($nt['dtl']);
       echo "<tr bgcolor='#f1f1f1'><td>$nt[name]</td><td align=right>".date("d-m-Y",strtotime($nt['dt']))."</td></tr>";
       echo "<tr ><td colspan=2>$dtl</td></tr>";
       }
       echo "</table>";
       }
       ```
   
 * I have `$commentid = $this->id;` within the em_events.php file, but that is not
   helping. I just need to know how to get the event_id from the current event to
   add to the mysql_query…
 * Thanks in advance for any help that anyone can offer, I have been banging my 
   head against a wall for a while on this one.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [agelonwl](https://wordpress.org/support/users/angelonwl/)
 * (@angelonwl)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/adding-comments-in-events-manager/#post-2209233)
 * try this:
 * `global $EM_Event;`
 * THEN
 * `$EM_Event->output("#_EVENTID")`
 *  Thread Starter [bsha100](https://wordpress.org/support/users/bsha100/)
 * (@bsha100)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/adding-comments-in-events-manager/#post-2209237)
 * Thanks for the help. I found a solution on the events manager homepage in the
   documentation ( probably the first place I should have looked ). I just added`
   WHERE event_id= '{$EM_Event->id}'` and it worked.
 *  [fredy666](https://wordpress.org/support/users/fredy666/)
 * (@fredy666)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/adding-comments-in-events-manager/#post-2209365)
 * Hello, I try to do this, I cant write a comment in the page of events, but I’ll
   like to put each comment in there event. ?It¡s posible??
    Thanks.
 * I put this code in the file em_events.php:
 *     ```
       function comment(){
       global $commentid;
       $q=mysql_query("SELECT name, dtl,dt FROM cmt_post WHERE event_id='{$EM_Event->id}' and status='apv' order by dt ");
       echo "<table width='400' border='0' cellspacing='1' cellpadding='0'>";
       while($nt=mysql_fetch_array($q)){ $dtl=nl2br($nt['dtl']);
       echo "<tr bgcolor='#f1f1f1'><td>$nt[name]</td><td align=right>".date("d-m-Y",strtotime($nt['dt']))."</td></tr>";
       echo "<tr ><td colspan=2>$dtl</td></tr>";
       }
       echo "</table>";
       }
       ```
   
 *  [buddyrhev](https://wordpress.org/support/users/buddyrhev/)
 * (@buddyrhev)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/adding-comments-in-events-manager/#post-2209434)
 * it won’t work because the code is for displaying the comments only..

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Adding Comments in EVENTS MANAGER’ is closed to new replies.

## Tags

 * [Comments](https://wordpress.org/support/topic-tag/comments/)

 * 4 replies
 * 4 participants
 * Last reply from: [buddyrhev](https://wordpress.org/support/users/buddyrhev/)
 * Last activity: [14 years, 7 months ago](https://wordpress.org/support/topic/adding-comments-in-events-manager/#post-2209434)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
