Search Results for 'buddypress'
-
AuthorSearch Results
-
December 6, 2012 at 10:37 pm #146721
Andrew Tibbetts
ParticipantActually, 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 commentedforeach ( (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));
}December 6, 2012 at 8:34 pm #146709modemlooper
ModeratorTo 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.
December 6, 2012 at 8:13 pm #146707In reply to: WHY IS BP CODEX WEBSITE DOWN???
Paul Wong-Gibbs
KeymasterSee https://buddypress.org/support/topic/codex-page-blank-blank-firefox/
December 6, 2012 at 7:52 pm #146700In reply to: can't access dashboard after forum install
johnjf
ParticipantI 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?
December 6, 2012 at 7:48 pm #146699In reply to: Codex Page Blank Blank, Firefox
nickzee
ParticipantBlank again @paul gibbs. baffled?…Maybe this guy can help explain
youtube watch?v=rLDgQg6bq7o
(Turbo Encabulator)🙂
December 6, 2012 at 7:31 pm #146694In reply to: Split: buddypress VS bbpress
LabSecrets
ParticipantGreat 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.December 6, 2012 at 7:10 pm #146693In reply to: Split: buddypress VS bbpress
nickzee
ParticipantThe 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?
December 6, 2012 at 6:42 pm #146690In reply to: View this error
Paul Wong-Gibbs
Keymaster@r-a-y pinging mr. o’ embed
December 6, 2012 at 6:41 pm #146689In reply to: Split: buddypress VS bbpress
LabSecrets
ParticipantHi 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”.
December 6, 2012 at 6:37 pm #146687In reply to: Group Forums UI – Buttons and post information.
Paul Wong-Gibbs
KeymasterWe’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)?
December 6, 2012 at 5:57 pm #146684In reply to: Split: buddypress VS bbpress
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.
December 6, 2012 at 5:45 pm #146682In reply to: Split: buddypress VS bbpress
nickzee
ParticipantOhhh! 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.
December 6, 2012 at 5:39 pm #146681mikegarlick
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
December 6, 2012 at 3:37 pm #146670In reply to: show time&date of topic&reply
danbpfr
ParticipantHi,
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 ? 😀
December 6, 2012 at 2:15 pm #146665In reply to: Link to Blogs results in 403 Forbidden error
elixcyr
Participantok 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 ?
December 6, 2012 at 1:32 pm #146662In reply to: Split: buddypress VS bbpress
Paul Wong-Gibbs
KeymasterWoops, I split the wrong topic. Apologies for confusion.
December 6, 2012 at 1:24 pm #146650In reply to: Split: buddypress VS bbpress
LabSecrets
ParticipantPlease 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
December 6, 2012 at 12:32 pm #146648In reply to: Link to Blogs results in 403 Forbidden error
elixcyr
Participantthank 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.
December 6, 2012 at 11:39 am #146645In reply to: Using activity as wire in Buddypress, following up
Jigesh
Participantyes 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!
December 6, 2012 at 10:49 am #146643In reply to: How to create forum this like
Master
ParticipantAnd how to create https://buddypress.org/login like this?
December 6, 2012 at 7:38 am #146635In reply to: How the event is triggered in Achievement Plugin
webwarrior.wng
ParticipantO wow! I have done it so far. Thanks a lot @Paul Gibbs, it really worked for me. You are a real helpful guy.
Thanks
December 6, 2012 at 6:59 am #146633In reply to: Link to Blogs results in 403 Forbidden error
Paul Wong-Gibbs
KeymasterCreate 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,.
December 6, 2012 at 3:08 am #146625In reply to: Blog feature is not on found on the Buddypress pages
elixcyr
Participanthello
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
December 5, 2012 at 11:57 pm #146618In reply to: Buddypress – xprofile field visibility
agtd
ParticipantI 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;
} );December 5, 2012 at 11:54 pm #146617In reply to: Links within "about me" section
Roger Coathup
ParticipantYep, 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’ );
-
AuthorSearch Results