BuddyDev

Search

Replies

  • Participant
    Level: Initiated
    Posts: 15
    Toury on #39782

    Hi Brajesh,

    unfortunately the KLEO developers couldnt help me.
    I have just found the file bp-custom.php in my folder plugins.
    perhaps here is some “mis-setting” as here are several codes corcerning activity comments. As I am not a coder at all, could you perhaps have a short look at it and let me know if there should be something adapted?


    <?php

    /*
    * Blog Comments in Buddypress Activity
    * WARNING: Test thoroughly if it works in your environment before using in production code.
    * LICENSE: Public domain
    */

    /*
    * When a new comment gets added to the database, add this comment to the
    * activity stream
    */
    function bca_record_activity($comment_id, $approval) {
    if($approval == 1) {
    $comment = get_comment($comment_id);
    $userlink = bp_core_get_userlink($comment->user_id);
    $postlink = 'comment_post_ID) . '">'
    . get_the_title($comment->comment_post_ID) . '
    ';

    bp_activity_add(array(
    'action' => sprintf( __( '%1$s commented on the post, %2$s', 'buddypress' ),
    $userlink, $postlink),
    'content' => $comment->comment_content,
    'component' => 'bp_plugin',
    'user_id' => $comment->user_id,
    'type' => 'new_blog_comment',

    ));

    }
    }
    //comment_post is triggered "just after a comment is saved in the database".
    add_action('comment_post', 'bca_record_activity', 10, 2);

    /*
    * We want activity entries of blog comments to be shown as "mini"-entries
    */
    function bca_minify_activity($array) {
    $array[] = 'new_blog_comment';
    return $array;
    }
    add_filter('bp_activity_mini_activity_types', 'bca_minify_activity');

    /*
    * Disables comments on this type of activity entry
    */
    function bca_remove_commenting($can_comment) {
    if($can_comment == true) {
    $can_comment = ! ('new_blog_comment' == bp_get_activity_action_name());
    }
    return $can_comment;
    }
    add_filter('bp_activity_can_comment', 'bca_remove_commenting');

    add_filter('bp_core_fetch_avatar_no_grav', '__return_true');

    //Add tinymce to Activity Post Form

    function bpfr_whats_new_tiny_editor() {
    // deactivation of the visual tab, so user can't play with template styles
    add_filter ( 'user_can_richedit' , create_function ( '$a' , 'return false;' ) , 50 );

    // building the what's new textarea
    if ( isset( $_GET['r'] ) ) :
    $content = esc_textarea( $_GET['r'] );
    endif;

    // adding tinymce tools
    $editor_id = 'whats-new';
    $settings = array(
    'textarea_name' => 'whats-new',
    'teeny' => true,
    'media_buttons' => true,
    'drag_drop_upload' => true,
    'quicktags' => array(
    'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close'));

    // get the editor
    wp_editor( $content, $editor_id, $settings );
    }
    add_action( 'whats_new_textarea', 'bpfr_whats_new_tiny_editor' );

    /**
    * Use the username as display name.
    */
    function buddydev_inject_username_as_fullname() {
    $_POST['field_1'] = $_POST['signup_username'];

    }
    add_action( 'bp_signup_pre_validate', 'buddydev_inject_username_as_fullname' );

    /**
    * Disable client side required attribute in input field to avoid failing of form submission.
    * All modern browsers will not submit if a field is marked as required and does not have the value.
    *
    * @param array $atts input field attributes.
    * @param string $field_name field name.
    *
    * @return array
    */
    function buddydev_disable_fullname_required_attributes( $atts, $field_name ) {

    global $field;
    // If your fullname field has a different id(should not happen in normal cases), please use that
    // Default value '1' will work for most people.
    $fullname_field_id = 1;

    if ( $field && $fullname_field_id !== $field->id ) {
    return $atts;
    }

    foreach ( $atts as $key => $value ) {
    if ( 'required' === $value ) {
    unset( $atts[ $key ] );
    break;
    }
    }
    return $atts;
    }

    add_filter( 'bp_get_form_field_attributes', 'buddydev_disable_fullname_required_attributes', 10, 2 );

    ?>

    • This reply was modified 2 years, 9 months ago by Toury.
  • Participant
    Level: Initiated
    Posts: 15
    Toury on #39682

    Hi Brajesh,

    ah ok, then this was a misunderstanding 😉 I have just contacted the developers of KLEO theme. I hope that they will/can solve this issue. If I get a solution by them, I will post it here in the thread!

    Cheers,
    Toury

  • Participant
    Level: Initiated
    Posts: 15
    Toury on #39676

    hi brajesh, thank you very much for your quick reply. Comments are enabled on my site in > settings > discussion
    Thank you for approaching seventhqueen for a solution. Pls let me know if you get an answer.
    If you want (and it would help) I can´t grant you admin rights for my staging installation.

    • This reply was modified 2 years, 9 months ago by Toury.
  • Participant
    Level: Initiated
    Posts: 15
    Toury on #39665

    Addition: I have just seen in your activity stream https://buddydev.com/activity/ that it is not a “problem” on my site but it is also not “activated” on your site: see screenshot here: https://i.postimg.cc/nVqRfhk6/Fire-Shot-Capture-487-Site-Wide-Activity-Buddy-Dev-buddydev-com.jpg
    “New User” can by marked as favorite and has the Comment function but “new post” (from your blog) can not be commented! (see posts from Anu Sharma in the stream)
    Do you have a fix for this issue? Would be really nice if you could share a solution for this here!

    • This reply was modified 2 years, 9 months ago by Toury.
  • Participant
    Level: Initiated
    Posts: 15
    Toury on #39663

    I have activated “Allow activity stream commenting on posts and comments” as you recommended but I still only have the chance to comment the activities ”new users” and ”new updates” but not ”sabai reviews”, ”photos” or ”wordpress blog posts”
    you can see it here on this screenshot https://i.postimg.cc/FzGfZJSJ/buddypress-activity-stream.jpg

    Can you pls help me and tell me which file(s) I have to adapt in which manner (used theme is KLEO from seventhqueen)!

    Thank you very much,
    Toury

  • Participant
    Level: Initiated
    Posts: 15
    Toury on #39612

    Hi @ravi !
    works like a charm!
    thank you so much!
    you can close this topic!

  • Participant
    Level: Initiated
    Posts: 15
    Toury on #39611

    ok, thank you for the hint!

  • Participant
    Level: Initiated
    Posts: 15
    Toury on #39596

    Hi Brajesh,
    I tried this shortcode in my functions.php (in Child Theme folder) but somehow I cannot get show up my inserted shortcode above the activity stream. What am I doing wrong?`

    // Add shortcode at the top of the page if page is activity
    add_action(‘kleo_before_main_content’, ‘add_myshort_activity_page_sqk’);
    function add_myshort_activity_page_sqk()
    {
    if (is_page(‘activity’)) {
    echo do_shortcode(‘[buddypressglobalsearch]<br>’);
    }
    }

  • Participant
    Level: Initiated
    Posts: 15
    Toury on #39572

    Hi brajesh. Thank you very much for your answer. How does the action hook work. Can you pls give me an example
    By the way I use the legacy theme