Forum Replies Created

Viewing 15 replies - 166 through 180 (of 205 total)
  • Forum: Hacks
    In reply to: Add a comment field
    Thread Starter Taro

    (@sicktb)

    Option 1 for the comments.php did not work for me…

    function twentyten_comment1( $comment, $args, $depth ) {
                $GLOBALS['comment'] = $comment;
    	         //Only allow comment authors to see their own comments (admins see all)
    //Place this snippet after "$GLOBALS['comment'] = $comment;" in twentyten_comment1()
    if( ! current_user_can('moderate_comments')
       && $comment->user_id != get_current_user_id()
    ) { echo 'You do not have permission to view this comment.<br>';
       return;
    }
    switch ( $comment->comment_type ) :
                        case '' :
                ?>
    Forum: Hacks
    In reply to: Add a comment field
    Thread Starter Taro

    (@sicktb)

    the 2nd peace of code did not do the trick. Can still see the comments from user1 when logged in as user2.

    Forum: Hacks
    In reply to: Add a comment field
    Thread Starter Taro

    (@sicktb)

    still testing above but, when i try to post 2 times on the same comment it gives me a error about double post.

    This is because i put text in front of the </textarea>

    Can we remove this warning? Not sure if i want to remove it.. Just need to know if it’s possible.

    Forum: Hacks
    In reply to: Add a comment field
    Thread Starter Taro

    (@sicktb)

    Your first post: Thats kinda what i need. I tryed all that i thought that would be good for making this possible. But it’s gonna take too long and to much work for my customer to keep track with 600+ pages.

    So im really glad that you tell me that it is possible to view only the comment for 1 customer.

    “The better solution is a little harder to code, it involves altering the comment query so if the current user is not an admin, limit the comments retrieved to only those where the current user is the author.”

    I don’t really know if this gives me the same result as i’m in need off.

    Can you tell me if this “hard to code” will be with fast result. So i dont need to make 600+ pages for just 100 customers. Just like the first option?

    Let me know if you want to help me with this or please tell me if it has any change to work at all. If not i can easily tell me customer to get to someone else.

    At least i’m really glad that you help me and that i learned what i have learned now.

    Forum: Hacks
    In reply to: Add a comment field
    Thread Starter Taro

    (@sicktb)

    It all works for me. Now im a little bit sad cuz i have to make tons of pages. And than i thought a simple solution.

    If your logged in you can post a comment on a page and this comment can only be shown bij jou and the admin. Not by any other user that logs into the same page?

    This way every one can make their comment on the page without looking to other customers.

    Forum: Hacks
    In reply to: Add a comment field
    Thread Starter Taro

    (@sicktb)

    Im trying to get a 2nd field. And its not working. If i just copy the line as below i get 2 times the same answer(makes sens).

    test: <input type=”text” name=”test” id=”test” size=”22″ /><br style=”clear: both;”>

    So i tryed the following:

    <!– !!!!!! Custom form fields start here !!!!!!! –>
    Kaas: <input type=”text” name=”kaas” id=”kaas” size=”22″ /><br style=”clear: both;”>Vlees: <input type=”text” name=”vlees” id=”vlees” size=”22″ /><br style=”clear: both;”>

    <!– !!!!!! Custom form field output starts here !!!!!!! –>
    Kaas: <?php echo get_comment_meta( $comment->comment_ID, ‘bcw_kaas’, true ); ?>Vlees: <?php echo get_comment_meta( $comment->comment_ID, ‘bcw_vlees’, true ); ?>

    Function this gives me a error: Cannot redeclare bcw_handle_comment() (previously declared in /nfs/home/deb711111/domains/domain.nl/public_html/wp-content/themes/twentyten/functions.php:560) in /nfs/home/deb711111/domains/domain.nl/public_html/wp-content/themes/twentyten/functions.php on line 570

    //Save the extra comment field value kaas
    function bcw_handle_comment($id) {
    if (array_key_exists(‘kaas’, $_POST))
    update_comment_meta( $id, ‘bcw_kaas’, $_POST[‘kaas’]);
    }
    add_action(‘wp_insert_comment’, ‘bcw_handle_comment’);

    //Save the extra comment field value vlees
    function bcw_handle_comment($id) {
    if (array_key_exists(‘vlees’, $_POST))
    update_comment_meta( $id, ‘bcw_vlees’, $_POST[‘vlees’]);
    }
    add_action(‘wp_insert_comment’, ‘bcw_handle_comment’);

    Forum: Hacks
    In reply to: Add a comment field
    Thread Starter Taro

    (@sicktb)

    Sorry its works now!

    I had a plugin installed that can edit the comment with ajax inline so you dont need to go to the back of wordpress.

    Ajaxed Comments: plugin

    Would have been nice if this plugin still worked with the code we add. This saves the time to make the test field shown in the back of wordpress.

    Do you have eny idee how to edit a comment easly? Just like you can do on this wordpress forum with the edit button on the left?

    Forum: Hacks
    In reply to: Add a comment field
    Thread Starter Taro

    (@sicktb)

    weird think is that i get the new test field but also the original responds field.

    This is the code for the new “clean” function.php: https://pastebin.com/raw.php?i=kVrRfSy6

    Forum: Hacks
    In reply to: Add a comment field
    Thread Starter Taro

    (@sicktb)

    Ow i copyed some more info.. pastebin is not giving the error above anymore but will not make my output on the page : #ajaxed-comments

    testing some more

    Forum: Hacks
    In reply to: Add a comment field
    Thread Starter Taro

    (@sicktb)

    I did all you named above. I also installed a clean version(1.6) of the theme.

    Fatal error: Cannot redeclare twentyten_comment1() (previously declared in /nfs/home/deb11111/domains/domain.nl/public_html/wp-content/themes/twentyten/comments.php:153) in /nfs/home/deb11111/domains/domain.nl/public_html/wp-content/themes/twentyten/comments.php on line 200

    Forum: Hacks
    In reply to: Add a comment field
    Thread Starter Taro

    (@sicktb)

    I can see that you tested it with a clean copy of the twentyten?

    If this is true then please paste your comment.php and function.php so i can see what i’m doing wrong. I know your learning me but my deadline is almost over. I just need this fields to work. If i can add fields to mutiple comment.php(and it works) than im saved. After that i can test and learn more ??

    Forum: Hacks
    In reply to: Add a comment field
    Thread Starter Taro

    (@sicktb)

    Parse error: syntax error, unexpected $end in /nfs/home/deb11111/domains/domain.nl/public_html/wp-content/themes/twentyten/functions.php on line 600

    https://pastebin.com/raw.php?i=F8AZmdmX

    Forum: Hacks
    In reply to: Add a comment field
    Thread Starter Taro

    (@sicktb)

    it gives me this error: Parse error: syntax error, unexpected $end in

    when i add the following code to function.php it will not give me this error but it doesn’t work…

    //Save the extra comment field value
    function bcw_handle_comment($id) {
       if (array_key_exists('test', $_POST))
          update_comment_meta( $id, 'bcw_test', $_POST['test']);
    }
    add_action('wp_insert_comment', 'bcw_handle_comment');
    //Override default theme function to display a comment
    
    endif;

    I did add: endif; but than i get this at the adress again: (#ajaxed-comments)

    Forum: Hacks
    In reply to: Add a comment field
    Thread Starter Taro

    (@sicktb)

    https://pastebin.com/raw.php?i=jnTtVEL1

    Thats what i have now in the comment.php but when i press on submit it only loads and puts the following at the domain name: test3/#ajaxed-comments

    Fucntion.php i left like this: https://pastebin.com/raw.php?i=ZEfWcVbk

    Forum: Hacks
    In reply to: Add a comment field
    Thread Starter Taro

    (@sicktb)

    i tryed the code that you posted and changed the following test to bcw_test <input type=”text” name=”bcw_test” id=”bcw_test” size=”22″ />

    And i dont see the following in the template folder: wp-comments-post.php
    As you placed it here: <form action=”<?php echo site_url( ‘/wp-comments-post.php’ ); ?>”…..

    Im getting the following error when i press on the submit button:
    FAILED: you have no written response.

    I placed the following code in the comments.php for the output to be shown:

    <ol class="commentlist">
    				<?php
    					/* Loop through and list the comments. Tell wp_list_comments()
    					 * to use twentyten_comment() to format the comments.
    					 * If you want to overload this in a child theme then you can
    					 * define twentyten_comment() and that will be used instead.
    					 * See twentyten_comment() in twentyten/functions.php for more.
    					 */
    					wp_list_comments( array( 'callback' => 'twentyten_comment' ) );
    
    					if( current_user_can('like_cheese')) echo 'Favorite cheese? <input type="text" name="bcw_test" id="bcw_test" size="22" />';
    else if( current_user_can('like_flowers')) echo 'Favorite flower? <input type="text" name="bcw_test" id="bcw_test" size="22" />';
    else echo 'What do you like? <input type="text" name="bcw_test" id="bcw_test" size="22" />';
    
    				?>
    				<?php echo get_comment_meta( $comment->comment_ID, 'bcw_test', true ); ?>
    
    			</ol>

Viewing 15 replies - 166 through 180 (of 205 total)