Forum Replies Created

Viewing 15 replies - 1 through 15 (of 86 total)
  • dlopeman

    (@dlopeman)

    Women Drinking Beer
    https://www.womendrinkingbeer.com

    Upload your pictures and videos (videos coming soon!) of your ladies, friends, sisters, mothers, and cousins enjoying (or not!) a drink of frothy goodness!

    Thread Starter dlopeman

    (@dlopeman)

    Welp – been trying to get a DELETE COMMENT part working… I did, but there are a few caveats.
    First, it takes you to the backend, to confirm. Once you confirm, it takes you to the backend list of comments… instead of the page from where you came.
    Second, it breaks the AJAX for comments. YUK! I was OK with the backend redirect, because I set mine to only allow ADMINs to del/spam.
    Third, I can’t get it to display WHERE I want… maybe you guys can figure out what I’m doing wrong.

    Anyway, the code goes in functions.php…
    Go down to the function prologue_comment_frontpage(…
    Put this function above that function:

    function delete_comment_link($id) { if (current_user_can('level_10')) {
    echo '<a href="' . wp_nonce_url("/wp-admin/comment.php?action=cdc&c=$id", 'delete-comment_' . $post->ID) . '">del</a> ';
    echo '| <a href="' . wp_nonce_url("/wp-admin/comment.php?action=cdc&dt=spam&c=$id") . '">spam</a>';
    } }

    Then add stuff to the prologue_comment_frontpage(..) function:
    a variable:

    deletespam_comment = delete_comment_link(get_comment_ID());

    and the somewhere in the HTML area you would just call it:
    $deletespam_comment

    I must have altered mine too much because it is exactly that which breaks the AJAX.

    Here’s the whole snippet (NOTE: I commented out them until I have time to figure it out!):

    function delete_comment_link($id) {   if (current_user_can('level_10')) {   echo '<a href="' . wp_nonce_url("/wp-admin/comment.php?action=cdc&c=$id", 'delete-comment_' . $post->ID) . '">del</a> ';
       echo '| <a href="' . wp_nonce_url("/wp-admin/comment.php?action=cdc&dt=spam&c=$id") . '">spam</a>';
      }
    }
    
    function prologue_comment_frontpage( $comment, $args, $echocomment = true ) {
            $GLOBALS['comment'] = $comment;
            $depth = prologue_get_comment_depth( get_comment_ID() );
            $comment_text =  apply_filters( 'comment_text', $comment->comment_content );
            $comment_class = comment_class( $class = '', $comment_id = null, $post_id = null, $echo = false );
            $comment_time = get_comment_time();
            $comment_date = get_comment_date();
            $id = get_comment_ID();
            $avatar = prologue_get_avatar( $comment->user_id, $comment->comment_author_email, 32 );
            $author_link = get_comment_author_link();
            $reply_link = prologue_get_comment_reply_link(
            array('depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => ' | ', 'reply_text' => __('Reply', 'p2') ),        $comment->comment_ID, $comment->comment_post_ID );        $can_edit = current_user_can( 'edit_post', $comment->comment_post_ID );        $edit_comment_url = get_edit_comment_link( $comment->comment_ID );
            $edit_link = $can_edit? " | <a class='comment-edit-link' href='$edit_comment_url' title='".attribute_escape(__('Edit comment', 'p2'))."'>".__('Edit', 'p2')."</a>" : '';
            //$deletespam_comment = delete_comment_link(get_comment_ID());
            //$deletespam_comment = $can_edit? " | <a href='" . wp_nonce_url(/wp-admin/comment.php?action=cdc&c=$id) . "'>del</a> | <a href='" . wp_nonce_url(/wp-admin/comment.php?acti
    on=cdc&dt=spam&c=$id) . "'>spam</a>" : '';
            $content_class = $can_edit? 'commentcontent comment-edit' : 'commentcontent';
            $awaiting_message = $comment->comment_approved == '0'? '<p><em>'.__('Your comment is awaiting moderation.', 'p2').'</em></p>' : '';
            $permalink = clean_url( get_comment_link() );
            $permalink_text = __('Permalink', 'p2');
            $date_time = sprintf( __('%s <em>on</em> %s', 'p2'),  get_comment_time(), get_comment_date() );
            $html = <<<HTML
    <li $comment_class id="comment-$id">
      <div>
        <div class="commenthead">
          $author_link commented at: $date_time <!-- $deletespam_comment -->
        </div>
    
        <div style="margin: 5px; position: relative; float: left; ">
          $avatar
        </div>
    
        <div class="$content_class" id="commentcontent-$id">
          $comment_text
        </div>
      </div>
    HTML;

    dlopeman

    (@dlopeman)

    I’ll make buttons! Maybe I’ll share! LOL

    Thread Starter dlopeman

    (@dlopeman)

    OH – be careful that you do not grant everyone permissions to remove ANY posts… just their own! I don’t know how MU handles this.

    Most people think they need to use MU because it means MULTI USER…

    But you should really understand what it means.

    I have MULTIPLE users on my regular WP… They can all blog. THey can all post.

    I think the MU is so they can have their own separate BLOGs… or something… So is that what you really want?

    And then why use P2 in that case?

    Thread Starter dlopeman

    (@dlopeman)

    NO – but a quick google search will give you the levels…

    Or wouldn’t the current user be able to “edit_post” so then that first bit of code would work…

    dlopeman

    (@dlopeman)

    OH, for you jmunn (I’m assuming you have some knowledge a html/php) If not… then get-on-it!! LOL

    Anyway – this probably REPEATS what acousins already put up there…

    Here’s what you put in post-form.php in the place of the textarea:

    <textarea name="posttext" id="posttext" rows="4" style="padding:3px; width:438px;" onKeyDown="limitText(this.form.posttext,this.form.countdown,256);" onKeyUp="limitText(this.form.posttext,this.form.countdown,256);" /></textarea>
    
    <font size="1">Characters left (max 256): <input readonly type="text" name="countdown" size="3" value="256" style="border:0px; margin-top:5px"></font>

    and then in a Javascript <script></script> or maybe in inc/j2.inc (which will get overwritten on upgrades) or I made a new JS called inc/my-functions.js… just remember to call it in header.php

    function limitText(limitField, limitCount, limitNum) {
            if (limitField.value.length > limitNum) {
                    limitField.value = limitField.value.substring(0, limitNum);
            } else {
                    limitCount.value = limitNum - limitField.value.length;
     }
    }

    dlopeman

    (@dlopeman)

    Part of my problem is this… well… lemme explain…

    People post pictures or videos
    They enter a Title
    They enter a brief (256 characters – call me a geek) description

    But the picture insertion is kinda automated… You choose your picture to upload, and it uploads is “inline” – then you can hit “Use it” button which puts the appropriate code into the TEXTAREA. WEll, THAT uses characters and right then the user is limited to less than 256.

    So… the trick will be to somehow not count the whole <img….> tag…

    Ideas?

    I really would have preferred a separate field, but have not played the the wordpress meta crap… if that’s even how to do it…

    I was able to get the TITLE working, b/c it looks like P2 may have had it at one time and there was still bits of code in functions.php and p2.js for it… I just re-enabled them sort of…

    dlopeman

    (@dlopeman)

    OH – forgot the youtube code:

    [youtube]https://www.youtube.com/watch?v=Bih28LY5v24[/youtube]

    dlopeman

    (@dlopeman)

    OK – I don’t read French or whatever language that is catalpa!!! LOL

    So I tried formatting the youtube just like the dailymotion one and THAT worked!

    Very nice – thanks catalpa. I wonder why the vipervideo plugin doesn’t explain it like you did! Even if it was in another language, I was able to follow it!

    Now for the button! I looked at the code last night and I think I found the right function. The problem is that I will want the resultant chose videos to go into MY TEXTAREA… not the backend. Without registering on your site I can’t see how you did it. Did you have buttons? Or is it that you know the code?

    I can’t depend on my visitors to know the code… so I need buttons, or will have to make an interface…

    dlopeman

    (@dlopeman)

    OK – I got the DailyMotion one to work:

    [dailymotion]https://www.dailymotion.com/video/xa874c_tom-mabe-eavesdropping_news[/dailymotion]
    
    [YouTube=https://www.youtube.com/watch?v=Bih28LY5v24]

    But the YouTube one is not…

    dlopeman

    (@dlopeman)

    I suppose, like youtube, I don’t have to wrry about dailymotions availability. I thought it was a different site.

    dlopeman

    (@dlopeman)

    Wow… cool… so my first attempt got this result… which means its trying!

    [ERROR: Unable to parse URL, check for correct DailyMotion format]

    OH – but I used a YOUTUBE link… I bet that was it! I just went to that website – it has videos.

    Oh sweet! It worked!

    Now how do I get the buttons on my form!?

    dlopeman

    (@dlopeman)

    hmmmmm – don’t see where this was asked… so I’ll post in a couple places:

    Delete button accomplished:

    Add this into your entry.php file:

    <?php if (current_user_can('edit_post', $post->ID)) echo "| <a href='" . wp_nonce_url("/wp-admin/post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "'>Delete post</a>" ?>

    OR FOR JUST ADMIN delete-ability:

    <?php if (current_user_can('level_10')) echo "| <a href='" . wp_nonce_url("/wp-admin/post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "'>Delete post</a>" ?>

    (keep in mind that upgrading P2 will wipe out your changes!)

    dlopeman

    (@dlopeman)

    Delete button accomplished:

    Add this into your entry.php file:

    <?php if (current_user_can('edit_post', $post->ID)) echo "| <a href='" . wp_nonce_url("/wp-admin/post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "'>Delete post</a>" ?>

    OR FOR JUST ADMIN delete-ability:

    <?php if (current_user_can('level_10')) echo "| <a href='" . wp_nonce_url("/wp-admin/post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "'>Delete post</a>" ?>

    (keep in mind that upgrading P2 will wipe out your changes!)

    dlopeman

    (@dlopeman)

    WOW – That’s one monster of a PLUGIN!!! I’m going to have to bow my head and tuck my tail and back outa this one!

    until later.

    I was thinking about using this other plugin:
    Smart YouTube:
    https://www.prelovac.com/vladimir/wordpress-plugins/smart-youtube

Viewing 15 replies - 1 through 15 (of 86 total)