Recent Topics

1 Feb 28, 2010 17:32    

My b2evolution Version: 3.3

I am encountering some critical questions by many of the members of my b2evo install.

The most heard critic is that members can't find back their comments.

The website has about 40 new posts every day, so I guess it's too much effort to search manually...

Is there a possibility or hack to search for comments by member, of individual comments?

Many thank's in advance

Nils

2 Feb 28, 2010 18:03

<?php
global $current_User, $DB;
$sql = 'SELECT * FROM T_comments WHERE author_ID='.$current_User->ID;
if( $comments = $DB->get_results( $sql ) )
{
  foreach( $comments as $comment )
  {
     // echo out whatever you want, permalink is probably good ;)
  }
}
?>

Free typed so excuse any errors ;)

¥

3 Feb 28, 2010 18:10

Hi ¥åßßå,

Thank's for your fast reply!

Could you point me out where to put his code ?

I guess it goes in the advanced search script, or am I way off now ?

Greetz,

Nils

4 Feb 28, 2010 18:45

If it was me I'd probably add a custom disp to my blog and a "YOUR COMMENTS" link ( assume they're a smidge myspace :roll: ) link to your sidebar ;)

I'd also probably add a "LIMIT 10" to the sql so they don't get confused by a plethora of links ;)

¥

5 Feb 28, 2010 20:36

Sorry ¥åßßå,

I'm stuck right now....

I really don't know how to implement this great function :(

First of all, I don't know how to add a custom disp. Cause: I don't know where to add disp variables

Second, I've made your script a php file, comments.php but that doesn't work either... I'm feeling very nOOby right know, but I want to learn, could you help me a bit more please ?

Thank you so far :)

6 Mar 01, 2010 13:55

Lets do this a tad of a different way :

Assuming your skins sidebar looks a tad like this :

<div id="sidebar">
		<ul>
		<?php
			// ------------------------- "Sidebar" CONTAINER EMBEDDED HERE --------------------------
			// Display container contents:
			skin_container( NT_('Sidebar 2'), array(

Amend it to look like this :

	<div id="sidebar">
		<ul>
		<?php
		if( is_logged_in() )
		{
			global $DB, $current_User;
			$sql = 'SELECT * FROM T_comments WHERE author_ID='.$current_User->ID.' AND status="published" LIMIT 10';
			if( $uComments = $DB->get_results( $sql, ARRAY_A ) )
			{
				echo '<li>Your last 10 comments</li>'."\n";
				foreach( $uComments as $uComment )
				{
					$tComment = new Comment( $uComment );
					$tComment->get_Item();
					$tComment->permanent_link(array(
							'before' => '<li>',
							'after' => '</li>',
							'text' => $tComment->Item->dget('title'),
						));
				}
			}
		}
			// ------------------------- "Sidebar" CONTAINER EMBEDDED HERE --------------------------
			// Display container contents:
			skin_container( NT_('Sidebar 2'), array(

¥

7 Mar 17, 2010 04:10

I Still don't know how to do this, I don't know wich files to edit :(

8 Mar 17, 2010 10:43

.../skins/your_skin/index.main.php (additionally posts.main.php and single.main.php depending on the skin you are using)

9 Mar 19, 2010 03:10

@tiliqicom

I guess that's nor for my skin (intense) u can see it @ http://nujij.org

@¥åßßå

Ik keep getting errors like: unknown status in where "published"

I've changed author_id into comment_author_id, that doesn't help either.

I will keep on trying, but a little hint would really make my day :) Greetz from Holland,

peace

10 Mar 19, 2010 09:34

comment_author_id change you did was right, in addition you gotta change status to comment_status so that it looks like this:

        if( is_logged_in() )
        {
            global $DB, $current_User;
            $sql = 'SELECT * FROM T_comments WHERE comment_author_ID='.$current_User->ID.' AND comment_status="published" LIMIT 10';
            if( $uComments = $DB->get_results( $sql, ARRAY_A ) )
            {
                echo '<li>Your last 10 comments</li>'."\n";
                foreach( $uComments as $uComment )
                {
                    $tComment = new Comment( $uComment );
                    $tComment->get_Item();
                    $tComment->permanent_link(array(
                            'before' => '<li>',
                            'after' => '</li>',
                            'text' => $tComment->Item->dget('title'),
                        ));
                }
            }
        } 

11 Mar 19, 2010 21:49

Sorry Tilqicom, that doesn't work for me either, the <li> displays but then I get a error: The requested item doesn't exist. :(

It isn't in my index.main.php by the way, but in the sidebar.inc.php

I feel like I'm close, but can't fix it on my own I'm afraid... Maybe I could give you a ftp account to help me? I realize that's not normal to ask, but I've seen I could ask you anything ;) Greetz Nils

12 Mar 20, 2010 10:41

it should work, maybe you got that error because you dont have any comments ? i dont know. but i can take a look if you pm me ftp details

14 Mar 29, 2010 02:09

Dear Tilqicom,

thank's again for your effort, you really helped me out on this!

The latest comment script works as expected, only because of a mistake I made earlier it isn't compatible with all users. I've deleted a user in the past and I suspect this has something to do with it, at least with deleted posts who had comments. As you can see, I'm not sure ;)

I now have requested all members to re-register so this problem will be fixed.

I don't know how to thank you, actually I'm unemployed and don;t have social security. In other words: I'm broke ;)

Next month I will receive some money from some adds, and I want to
give you somekind of a symbolic payment. :)

We can keep in touch via my website and our email adresses.

Again, thank you very much!

Greets from Holland,

Nils Peters
[/img]

15 Mar 29, 2010 03:32

To share this with other people I've place the code needed here. Put this in your _sidebar.inc.php

?>
<div id="sidebar">
	
    <span id="latestusercomments">
    <ul>
<?php
    if( is_logged_in() )
        {
            global $DB, $current_User;
            $sql = 'SELECT * FROM T_comments WHERE comment_author_ID='.$current_User->ID.' AND comment_status="published" LIMIT 10';
            if( $uComments = $DB->get_results( $sql, ARRAY_A ) )
            {
                echo '<li>Jouw laatste reacties</li>'."\n";
                foreach( $uComments as $uComment )
                {
					echo '<li>';
                    $tComment = new Comment( $uComment );
                    $tComment->get_Item();
                    $tComment->permanent_link(array(
                            'before' => '<li>',
                            'after' => '</li>',
                            'text' => $tComment->Item->dget('title'),
                        ));
					echo'</li>';
                }
            }
        }

?>
</span>

16 Mar 29, 2010 06:02

no worries, credit goes to ¥åßßå , i did nothing

17 Mar 30, 2010 13:03

ets do this a tad of a different way :

Assuming your skins sidebar looks a tad like this :

*removed

18 Apr 03, 2010 18:06

@Charchilp?

I don't get your point, did you smoke as much as I did yesterday ? ;)


Form is loading...