Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'buddypress'

Viewing 25 results - 25,251 through 25,275 (of 69,106 total)
  • Author
    Search Results
  • #146721
    Andrew Tibbetts
    Participant

    Actually, this function is working—it is creating activity items based on blog posts and comments. I found out that it’s my custom plugin that is supposed to hook into this custom post or comment action to create a notification. Here is the plugin. I know no one will even try to tackle this but I have to post this because it’s my only option and I one for due diligence…

    /**
    * Plugin Name:BuddyPress Post Comment Notifier
    * Description: Mod of Brajesh Singh's BuddyPress Activity Comment Notifier to work for Blog Post Comments
    *
    */

    // we are not much concerned with the slug, it is not visible
    define("BP_COMMENT_NOTIFIER_SLUG","pc_notification");

    //register a dummy notifier component, I don't want to do it, but bp has no other mechanism for passing the notification data to function, so we need the format_notification_function
    function pc_notifier_setup_globals() {
    global $bp, $current_blog;
    $bp->pc_notifier=new stdClass();
    $bp->pc_notifier->id = 'pc_notifier';//I asume others are not going to use this is
    $bp->pc_notifier->slug = BP_COMMENT_NOTIFIER_SLUG;
    $bp->pc_notifier->notification_callback = 'pc_notifier_format_notifications';//show the notification
    /* Register this in the active components array */
    $bp->active_components[$bp->pc_notifier->slug] = $bp->pc_notifier->id;

    do_action( 'pc_notifier_setup_globals' );
    }
    add_action( 'bp_setup_globals', 'pc_notifier_setup_globals' );

    /**
    * storing notification for users
    * notify all the users who have commented, or who was the original poster of the update, when someone comments
    * hook to bp_blogs_comment_recorded action
    */
    function pc_notifier_notify($activity_id) {
    global $bp;

    $activity = new BP_Activity_Activity($activity_id);
    $comment = get_comment($activity->secondary_item_id);
    $users = pc_notifier_find_involved_persons($comment->comment_post_ID);
    $link = get_permalink($comment->comment_post_ID);

    if($activity->hide_sitewide) return;

    if(!in_array($activity->user_id, $users)&&($bp->loggedin_user->id!=$activity->user_id)) array_push ($users, $activity->user_id);

    foreach((array)$users as $user_id){
    bp_core_add_notification( $activity_id, $user_id, $bp->pc_notifier->id, 'new_post_comment_'.$activity_id );
    }

    }
    add_action("bp_blogs_comment_recorded","pc_notifier_notify",10,1); // hook to bp_blogs_comment_recorded for adding notification

    /** our notification format function which shows notification to user
    *
    * @global $bp
    * @param $action
    * @param $activity_id
    * @param $secondary_item_id
    * @param $total_items
    * @return
    * @since 1.0.2
    * @desc format and show the notification to the user
    */
    function pc_notifier_format_notifications( $action, $activity_id, $secondary_item_id, $total_items, $format='string' ) {

    global $bp;
    $glue = '';
    $user_names = array();
    $activity = new BP_Activity_Activity( $activity_id );
    $comment = get_comment($activity->secondary_item_id);
    $link = get_permalink($comment->comment_post_ID);
    $comment_post = get_post($comment->comment_post_ID);

    if ( $activity->user_id == $bp->loggedin_user->id ) $text = __("your post");
    else $text = sprintf(__("%s"), $comment_post->post_title);

    $pc_action = 'new_post_comment_'.$activity_id;

    if ( $action == $pc_action ) {

    $users = pc_notifier_find_involved_persons($comment->comment_post_ID);

    $total_user = $count = count($users);//how many unique users have commented

    if ( $count > 2 ) {
    $users = array_slice($users, $count-2);//just show name of two poster, rest should be as and 'n' other also commeted
    $count = $count-2;
    $glue=", ";
    }
    else if ( $total_user == 2 ) $glue = " and ";//if there are 2 unique users , say x and y commented

    foreach ( (array)$users as $user_id )
    $user_names[] = bp_core_get_user_displayname($user_id);

    if ( !empty($user_names) )
    $commenting_users = join($glue,$user_names);

    if ( $total_user > 2 )
    $text = $commenting_users." and ".$count." others commented on ".$comment_post->post_title;
    else
    $text = $commenting_users." commented on ".$comment_post->post_title;

    if ( $format == 'string' )
    return apply_filters('bp_activity_multiple_new_comment_notification','comment_ID.'">'.$text.'');
    else {
    $link .= '#comment-'.$comment->comment_ID;
    return array('link'=>$link,'text'=>$text);
    }

    }

    return false;

    }

    /*
    * Remove activity for the comments on new_blog_post & new_blog_comment activity item.
    * Since these items do not have a single activity view and are linked to the single post screen, we will do the needed on single post view
    */

    function pc_notifier_remove_notification_for_blog_posts(){
    if( !( is_user_logged_in() && is_singular() ) )
    return;

    global $bp,$wpdb;
    $blog_id = (int)$wpdb->blogid;
    $post = wp_get_single_post();
    $activity_id = bp_activity_get_activity_id(
    array(
    'user_id' => $post->post_author,
    'component' => $bp->blogs->id,
    'type' => "new_blog_post",
    'item_id' => $blog_id,
    'secondary_item_id' => $post->ID
    )
    );
    //delete the notification for activity comment on new_blog_post
    if( !empty($activity_id) )
    bp_core_delete_notifications_by_item_id( $bp->loggedin_user->id, $activity_id, $bp->pc_notifier->id, 'new_post_comment_'.$activity_id );

    //for replies on blog comments in activity stream
    $comments = pc_notifier_get_all_blog_post_comment_ids($post->ID);//get all the comment ids as array

    //added in v 1.0.3 for better database performance, no more looping to get individual activity ids
    $activities = pc_notifier_get_activity_ids(
    array(
    "type"=>"new_blog_comment",
    "component" => $bp->blogs->id,
    "item_id"=>$blog_id,
    "secondary_ids"=>$comments
    )
    );

    foreach( (array)$activities as $pc_id )
    bp_core_delete_notifications_by_item_id( $bp->loggedin_user->id, $pc_id, $bp->pc_notifier->id, 'new_post_comment_'.$pc_id );

    }
    add_action("wp_head","pc_notifier_remove_notification_for_blog_posts");

    /**
    * @since v 1.0.2
    * @desc delete notification when an activity is deleted, thanks to @kat_uk for pointing the issue
    * @param pc_ids:we get an arry of activity ids
    */
    function bp_pc_clear_notification_on_activity_delete($pc_ids){
    global $bp;

    foreach ( (array)$pc_ids as $activity_id )
    bp_core_delete_all_notifications_by_type( $activity_id, $bp->pc_notifier->id, 'new_post_comment_'.$activity_id, $secondary_item_id = false );
    }
    add_action("bp_activity_deleted_activities","bp_pc_clear_notification_on_activity_delete");

    /************************************ HELPER FUNCTIONS ********************************************************/

    // find all users who commented on the post
    function pc_notifier_find_involved_persons($comment_post_ID){
    global $bp,$wpdb;

    return $wpdb->get_col($wpdb->prepare("SELECT DISTINCT(user_id) from {$wpdb->comments} where comment_post_ID=%d and user_id!=%d",$comment_post_ID,$bp->loggedin_user->id));
    }

    // return an array of comment ids for the post
    function pc_notifier_get_all_blog_post_comment_ids($post_id) {
    global $wpdb;

    return $wpdb->get_col($wpdb->prepare("SELECT comment_ID as id FROM {$wpdb->comments} WHERE comment_post_ID = %d AND comment_approved = '1' ORDER BY comment_date", $post_id));
    }

    // get activity ids when type, component, secondary_ids, item_id is specified
    function pc_notifier_get_activity_ids($params){
    global $bp,$wpdb;
    extract($params);
    $list="(".join(",", $secondary_ids).")";//create a set to use in the query;

    return $wpdb->get_col($wpdb->prepare("SELECT id from {$bp->activity->table_name} where type=%s and component=%s and item_id=%d and secondary_item_id in {$list}",$type,$component,$item_id));
    }

    #146709
    modemlooper
    Moderator

    To use a file for the page content you do a locate template in the function instead of putting the actual code in the function.

     

    Get the BuddyPress skeleton component plugin. It has commented code to show you how to create custom BuddyPress components. Though, you can utilize simple wordPress page templates to accomplish a page with custom content. If the content doesnt need to be initiated into the active components then a page will do.

    #146707
    Paul Wong-Gibbs
    Keymaster

    See https://buddypress.org/support/topic/codex-page-blank-blank-firefox/

    #146700
    johnjf
    Participant

    I had bbpress installed before and deactivated it when I installed buddypress. Then I deleted the bbpress files. I then re-downloaded the files again and now this is happening. Would there be anything in my database from it’s last installation to cause bbpress to not work now?

    #146699
    nickzee
    Participant

    Blank again @paul gibbs. baffled?…Maybe this guy can help explain

    youtube watch?v=rLDgQg6bq7o
    (Turbo Encabulator)

    🙂

    #146694
    LabSecrets
    Participant

    Great news Nick!
    You can see in my recent post, we fixed a similar solution for Canvas 5 from WooThemes.https://bbpress.org/forums/topic/non-functional-index-page-when-bbpress-2-1rc4-is-used-with-woothemes-canvas-5-05/
    Your problem imho is that your theme is hijacking the content area in a way that prevents the new bbPress code from working. As such, the solution would be found most likely in your theme’s page.php or similar, where the default archive pages are created.
    Cheers!
    Spence.

    #146693
    nickzee
    Participant

    The shortcodes were the ticket for me. Back up and running now! My theme would only pull an archived page (even thought is buddypress fitted). Also I could not create a page called “forums” when the forum slug was “forums” in bbpress settings. The page would be automatically slugged, “fourms-2”.

    For not I am not going to delete the bb-config.php and see how it works. So far so good.

    Thank you again Spence labsecrets. Wonderful job. You’re not so evil 😉

    @me9, did this video help you?

    #146690

    In reply to: View this error

    Paul Wong-Gibbs
    Keymaster

    @r-a-y pinging mr. o’ embed

    #146689
    LabSecrets
    Participant

    Hi NickZee,

    glad it was helpful 😉

    While I can’t say 100% whether you need to completely reinstall, I will suggest that if you previously had selected the BuddyPress option to allow forums (the first RED FLAG in the video ;-), it created a bb-config,php file that may be the root of some troubles. In the previous video I showed folks to delete that, but in this case, it may be sufficient now to simply toggle the option “off”, save, and then re-save permalinks.

    If nothing else, it won’t hurt you to try deleting that old bb-config.php file as it is no longer going to be used by BuddyPress if you use the bbPress 2.2.2+ plugin instead.
    In any event, I do not think you should or will have to manually drop any tables from the db… that’s just going to lead to some troubles given how seamless the new operation works (if you follow step by step by step).

    I’m going to suggest in Trac (and here)  that the wording on that particular BuddyPress option be changed or even that the option be completely removed… as the way it is now written is not helpful. I admit that it even took me four or five tries before realizing that it was referring to the “old” BuddyPress forums, even though the wording says “bbPress”.

     

     

    #146687
    Paul Wong-Gibbs
    Keymaster

    We’re using bbPress 2 here for the forums; the recent release of bbPress 2 integrates nicely into BuddyPress. Are you using the “group forums” built into BuddyPress (aka bbPress 1)?

    #146684
    nickzee
    Participant

    @labsecrets at 3:50. Do I need to completely remove buddypress and reinstall without discussion forum OR can I just turn them off now and that be sufficient and equal to installing without? My original buddypress install was several weeks ago, and with that Discussion Forum was checked. If so, do I need to drop tables or options from the database to make buddypress forget it was ever installed on my site?

    Thank you again Spence. Very concise video instruction. Just what I need.

    #146682
    nickzee
    Participant

    Ohhh! An updated video. Thank you Spence ( @labsecrets)! I saw your original video and it helped a lot, but i was still left with confusion (nothing on your part).

    Watching the new one now! Thank you again.

    #146681
    mikegarlick
    Participant

    @modemlooper I used your code above to get the tab working named ‘Test’ and its working fine. Thanks for that. I used it in a child theme custom functions file i have there. Is there any way I can have a separate file that contains the content for that section( currently “weeee content” ).

    Thanks in advance

    #146670
    danbpfr
    Participant

    Hi,

    View here first: https://wordpress.org/search/mysql2date

    and try by replacing from

    echo sprintf( __( ‘%1$s said %2$s:’, ‘buddypress’ );

    to

    echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), true);

    This is what is used to show the date on feeds, witch has the same output you want. Maybe would work ? 😀

     

    #146665
    elixcyr
    Participant

    ok thank you Paul,

    the topic has already been created some times ago .

    Here :

    https://buddypress.org/support/topic/blog-feature-is-not-on-found-on-the-buddypress-pages

    Should i create a new topic ?

    #146662
    Paul Wong-Gibbs
    Keymaster

    Woops, I split the wrong topic. Apologies for confusion.

    #146650
    LabSecrets
    Participant

    Please watch and follow this step by step video guide on the new bbPress and BuddyPress versions. I guarantee it will help sort out your questions.  If any remain, I’m happy to help you further 🙂

    http://labzip.com/the-definitive-guide-to-buddypress-bbpress-configuration/

    Cheers!

    Spence

    #146648
    elixcyr
    Participant

    thank you for the answer, but in the settings menu of buddypress , in tab “components” there are no way to add something . May be you means in tab Pages ?

    But in tab “Pages” the directorie Blogs is missing . I have only Activity Streams, Site Tracking, User Groups ,  Members. And i can not add manually another directories.

     

    #146645
    Jigesh
    Participant

    yes this is surely works, thank you for your valuable update , but i guess this can be improved by linking all activity filter in one , something like facebook ,

    Great!

    #146643
    Master
    Participant

    And how to create https://buddypress.org/login like this?

    #146635
    webwarrior.wng
    Participant

    O wow! I have done it so far. Thanks a lot   @Paul Gibbs, it really worked for me. You are a real helpful guy.

    Thanks

    #146633
    Paul Wong-Gibbs
    Keymaster

    Create a Page with a name other than “blogs”, and then go to the Settings > BuddyPress menu in wp-admin, then click on the ‘components’ tab, and associate the Blogs component with the new page and save,.

    #146625
    elixcyr
    Participant

    hello

    Exactly the same question …

    After updating to the latest version of Buddypress, blog feature is missing in the settings of Buddypress pages directories!!!!

    Is it normal ??

    Thanks

     

    #146618
    agtd
    Participant

    I got it to work. So here is the solution for anyone that might need to do this in future.

    CSS: Add the above css to your theme css
    JS: Add the following to yout theme js file. [this extract was take from the buddypress global.js file]

    /** Profile Visibility Settings *********************************/
    var jq = jQuery;
    jq(‘.field-visibility-settings’).hide();
    jq(‘.visibility-toggle-link’).on( ‘click’, function() {
    var toggle_div = jq(this).parent();

    jq(toggle_div).fadeOut( 600, function(){
    jq(toggle_div).siblings(‘.field-visibility-settings’).slideDown(400);
    });

    return false;
    } );

    jq(‘.field-visibility-settings-close’).on( ‘click’, function() {
    var settings_div = jq(this).parent();

    jq(settings_div).slideUp( 400, function(){
    jq(settings_div).siblings(‘.field-visibility-settings-toggle’).fadeIn(800);
    });

    return false;
    } );

    #146617
    Roger Coathup
    Participant

    Yep, it’s one of the most useless things in BuddyPress.

    You can get rid of those links by adding the following to your bp-custom.php file:

     

    function remove_xprofile_links() {

    remove_filter( ‘bp_get_the_profile_field_value’, ‘xprofile_filter_link_profile_data’, 9, 2 );

    }

    add_action( ‘bp_init’, ‘remove_xprofile_links’ );

     

Viewing 25 results - 25,251 through 25,275 (of 69,106 total)
Skip to toolbar