Skip to:
Content
Pages
Categories
Search
Top
Bottom

Activity commenting help!!!


  • scorpio.vivek
    Member

    @scorpiovivek

    I am trying to have 2 buttons in activity loop which are agree and disagree. upon clicking each button i would like to have similar functionality of default reply button. But i want to separate the agree (x) count and disagree (x) count. I hope you understand what I mean to say. I want to replace reply functionality with those two. can you please guide me to the right direction. thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You’d need to create some code on the backend to handle the response from these buttons, and storing counts of each button press (probably as activity meta). Are you able to write code yourself? If so I’ll try to point you in the right direction.


    scorpio.vivek
    Member

    @scorpiovivek

    thank you; yes i can write codes. not perfectly but can figure out. can you please describe from where should i start?


    scorpio.vivek
    Member

    @scorpiovivek

    if i am not wrong i need to create a new form in entry.php and to update global.js accordingly rite?? i found some one did something like this with whats new form. here is the code below.

    /* MINI-POST */
    /* New posts */
    jq(“input#mini-aw-whats-new-submit”).click( function() {
    var button = jq(this);
    var form = button.parent().parent().parent().parent();

    form.children().each( function() {
    if ( jq.nodeName(this, “textarea”) || jq.nodeName(this, “input”) )
    jq(this).attr( ‘disabled’, ‘disabled’ );
    });

    jq( ‘form#’ + form.attr(‘id’) + ‘ span.ajax-loader’ ).show();

    /* Remove any errors */
    jq(‘div.error’).remove();
    button.attr(‘disabled’,’disabled’);

    /* Default POST values */
    var object = ”;
    var item_id = jq(“#mini-whats-new-post-in”).val();
    var content = jq(“textarea#mini-whats-new”).val();

    /* Set object for non-profile posts */
    if ( item_id > 0 ) {
    object = jq(“#mini-whats-new-post-object”).val();
    }

    jq.post( ajaxurl, {
    action: ‘post_update’,
    ‘cookie’: encodeURIComponent(document.cookie),
    ‘_wpnonce_post_update’: jq(“input#_wpnonce_post_update”).val(),
    ‘content’: content,
    ‘object’: object,
    ‘item_id’: item_id
    },
    function(response)
    {
    jq( ‘form#’ + form.attr(‘id’) + ‘ span.ajax-loader’ ).hide();

    form.children().each( function() {
    if ( jq.nodeName(this, “textarea”) || jq.nodeName(this, “input”) )
    jq(this).attr( ‘disabled’, ” );
    });

    /* Check for errors and append if found. */
    if ( response[0] + response[1] == ‘-1? ) {
    form.prepend( response.substr( 2, response.length ) );
    jq( ‘form#’ + form.attr(‘id’) + ‘ div.error’).hide().fadeIn( 200 );
    button.attr(“disabled”, ”);
    } else {
    if ( 0 == jq(“ul.activity-list”).length ) {
    jq(“div.error”).slideUp(100).remove();
    jq(“div#message”).slideUp(100).remove();
    jq(“div.activity”).append( ” );
    }

    jq(“ul.activity-list”).prepend(response);
    jq(“ul.activity-list li:first”).addClass(‘new-update’);
    jq(“li.new-update”).hide().slideDown( 300 );
    jq(“li.new-update”).removeClass( ‘new-update’ );
    jq(“textarea#mini-whats-new”).val(”);

    /* Re-enable the submit button after 8 seconds. */
    setTimeout( function() { button.attr(“disabled”, ”); }, 8000 );
    }
    });

    return false;
    });
    /* MINI-POST */

    and the form for the new “mini-post-form”
    ———————–

    <form action=”” method=”post” id=”mini-whats-new-form” name=”mini-whats-new-form”>


    <input type=”submit” name=”mini-aw-whats-new-submit” id=”mini-aw-whats-new-submit” value=”” />

    :

    <option value=””>

    <form action=”” method=”post” id=”mini-whats-new-form” name=”mini-whats-new-form”>

    <input type=”submit” name=”mini-aw-whats-new-submit” id=”mini-aw-whats-new-submit” value=”” />

    :

    <option value=””>

    Can anyone please guide me accordingly to get what i am trying to.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Activity commenting help!!!’ is closed to new replies.
Skip to toolbar