Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 1 through 25 (of 73 total)

  • godavid33
    Participant

    @godavid33

    Plugin Conflict from AppPresser’s AppBuddy…….

    *Found the problem two days and one head of hair later*


    godavid33
    Participant

    @godavid33

    Yes, I am sure. I am going to continue this thread over here as I do not believe not being friends is the problem. It seems to be a problem with specific recipients.

    https://buddypress.org/support/topic/weird-non-error-message-after-sending-message/


    godavid33
    Participant

    @godavid33

    I actually found out that it only seems to happen to certain individuals. I’m not really sure what could be doing this or how to go about debugging it though :/

    Any advice @mercime @henrywright ?


    godavid33
    Participant

    @godavid33

    The problem seem to be caused by a cache. I am using w3tc and disabled both database and object cache, and the problem was resolved. I re-enabled the object cache, problem came back. Disabled that then re-enabled the database cache. Problem seems related specifically to the object cache. I also had both of these caches using memcache, so maybe that has something to do with it too.


    godavid33
    Participant

    @godavid33

    If this helps anything, bp_get_member_user_id() seems to be returning blank both in the profile group and group field loops, though bp_displayed_user_id() displays the correct id


    godavid33
    Participant

    @godavid33

    After pasting your code I noticed mine was exactly the same. It’s odd though, I cant seem to recreate this error now tho >:O

    I’ll try and pay more attention next time it occurs. Thanks for your help @henrywright !


    godavid33
    Participant

    @godavid33

    http://pastebin.com/dxsvM3e7

    Let me know if that works/if you need anything else. This is the code that I have working on my current site. I would advise reading through it, as theres some slightly odd hacks I had to do. It is adapted for multisite, so basically you can probably scrap anywhere you see filtering for users on a specific blog id.


    godavid33
    Participant

    @godavid33

    I think I am slightly doing my own processing, but I hooked it onto BPs. My goal was essentially just to add a drop down of usernames so people can find others easier as well as to try and improve the UI functionally a bit.


    godavid33
    Participant

    @godavid33


    godavid33
    Participant

    @godavid33

    That is a good call, I would have done that prior except I have no clue how to use gists 😀 though I’m sure pastebin would be easy.

    I also would feel wrong posting it as a plugin without polishing and testing up a bit, but alas a working man has no free time. I will post a pastebin within the next couple days.


    godavid33
    Participant

    @godavid33

    Are you on multisite? I had a similar problem happen recently, though I forgot sort of how it works… I can post my updated code? It’s been enhanced a bit since I made the original post. Maybe I fixed whatever the problem was already?


    godavid33
    Participant

    @godavid33

    My guess to doing this would be something like the following:

    1.) Set up somewhere where they can see all their mentions and put a button on each item that allows them to unmention themselves
    2.) This button would set a value somewhere in the db that specifically points to the id of where they are mentioned
    3.) The filter that sets the link would check this value before adding the link

    hope that helps a bit.

    @mercime is this about right?

    P.S. Mentioning someone in a thread about mentions; how meta am I 🙂


    godavid33
    Participant

    @godavid33

    found the problem. At somepoint I remove the containing <div id=”buddypress”> element. When I added it back everything started functioning normally.


    godavid33
    Participant

    @godavid33

    Yet again, you are amazing. Expect me to come back with discussion once I pour through all of this 🙂


    godavid33
    Participant

    @godavid33

    @kaizerking you should probably start your own thread, as that is an entirely different problem ( actually, I would say same for you @dhyana , but your question was already answered haha)

    but if I had to posit a suggestion (in a new thread of course) it would be to use the plugin Theme My Login. It has saved me a good bit of headache as far as getting xprofile fields to show up on registration


    godavid33
    Participant

    @godavid33

    Btw, the solution to this problem was actually the BP Automatic Friends plugin. Something to do with calling get last user activity I believe on a new user causes an error. Could have solved this with debug enabled :S

    @Dhyana , I am using a totally custom reg form so not even the BP template. I don’t have much experience with the BP reg form itself, sorry. If you need help making a custom one let me know


    godavid33
    Participant

    @godavid33

    @henrywright worked like a charm. Now I just need to style it a bit. Thanks!

    And thanks to @johnjamesjacoby for the great plugin. The problem was (is) probably that all my profile fields are xprofile fields.

    Thanks for the example @mercime !


    godavid33
    Participant

    @godavid33

    WP and BP versions are in initial post. I enabled debugging in WP and no Fatal Error was being thrown, which I found odd. Not new, recently updated if you mean updated when BP 2.0 came out, but I did not even have anything on this page before updating it.

    What is supposed to be on this page?


    godavid33
    Participant

    @godavid33

    Ok, well I had to figure this one out. It’s a bit of a lengthy solution. I’m not going to explain everything, as I can’t for either lack of knowledge or fear of being incorrect. I’ll just give you the code, tell you what it does, and where it goes.

    First, lets add the favorite button to the comments template. Find comment.php (in /activity) and add the code:

    
    		<?php global $activities_template; ?>
    		<?php if ( bp_activity_can_favorite() ) : ?>
    			<?php
    				$my_fav_count = bp_activity_get_meta( bp_get_activity_comment_id(), 'favorite_count' );
    				
    				$my_fav_count = "<span>".$my_fav_count."</span>";
    				
    				$is_favorite = apply_filters( 'bp_get_activity_is_favorite', in_array( bp_get_activity_comment_id(), $activities_template->my_favs ) );
    			?>
    
    			<?php if ( !$is_favorite ) : ?>
    
    				<a href="<?php echo apply_filters( 'bp_get_activity_favorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/favorite/' . bp_get_activity_comment_id() . '/' ), 'mark_favorite' ) ); ?>" class="tooltip-trigger fav bp-secondary-action bp-primary-action" title="<?php echo god_get_favorited_usernames(bp_get_activity_comment_id()); ?>" style="position:relative;"><?php _e( 'Like', 'buddypress' ); ?><?php echo $my_fav_count; ?></a>
    
    			<?php else : ?>
    
    				<a href="<?php echo apply_filters( 'bp_get_activity_favorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/favorite/' . bp_get_activity_comment_id() . '/' ), 'mark_favorite' ) ); ?>" class="tooltip-trigger unfav bp-secondary-action bp-primary-action" title="<?php echo god_get_favorited_usernames(bp_get_activity_comment_id()); ?>" style="position:relative;"><?php _e( 'Unlike', 'buddypress' ); ?><?php echo $my_fav_count; ?></a>
    
    			<?php endif; ?>
    
    		<?php endif; ?>	
    

    This code simply adds the buttons, and gets all the necessary info and variables.

    Then, you’re going to need to modify the buddypress javascript. I personally modified both global.js and buddypress.js (through overriding in my template, which is a topic for a whole other thread), though I might be wrong in this. At any rate, look for the line (around 264 in buddypress.js):

    
    var parent = target.closest('.activity-item');
    

    and change it to

    
    var parent = target.closest('li');
    

    The reason we changed this line is so that our custom favorite button doesn’t default to grabbing the top level activity id. Now you can actually favorite comments!

    But wouldn’t it be nice if the user received a notification when someone favorited their activity? Add this bad boy to functions.php

    
    
    add_action("bp_activity_add_user_favorite","favorite_notification", 10, 2);
    
    function favorite_notification( $activity_id, $user_id = 0){
    	// By type and item_id
    	if($user_id != $activities["activities"][0]->user_id){
    		$activities = bp_activity_get_specific( array( 'activity_ids' => $activity_id, 'display_comments' => true) );
    		
    		bp_core_add_notification( $activity_id, $activities["activities"][0]->user_id, "notifier", bp_core_get_username(bp_loggedin_user_id())." liked: '".substr($activities["activities"][0]->content,0,20)."...'", $activity_id ) ;		
    	}
    }
    

    Hope this helped someone. It mostly works for me.


    godavid33
    Participant

    @godavid33

    Bump?


    godavid33
    Participant

    @godavid33

    I know this is a very old thread, but here’s some useful code for solving this problem (put it in functions.php) in case someone else stumbles upon it

    
    add_action("bp_activity_add_user_favorite","favorite_notification", 10, 2);
    
    function favorite_notification( $activity_id, $user_id = 0){
    
    	$activities = bp_activity_get_specific( array( 'activity_ids' => $activity_id) );
    
    	bp_core_add_notification( $activity_id, $activities["activities"][0]->user_id, "notifier", "<a href='".get_site_url()."/activity/p/$activity_id'>New Like!</a>" ) ;
    }
    

    godavid33
    Participant

    @godavid33

    Ah, great addition. I may end up making use of that myself.

    Glad that I could help!


    godavid33
    Participant

    @godavid33

    Yo these are great. Love the rainbox and the ouroboro


    godavid33
    Participant

    @godavid33

    Nice, much more elegant @naijaping


    godavid33
    Participant

    @godavid33

    Sorry, I’m a bit too lazy for jsfiddle but here is the code

    
    			jQuery('#send_reply_button').click(function(){
    				var submit_butt = jQuery(this);
    				
    				submit_butt.hide();
    				submit_butt.attr('disabled', 'disabled');
    				
    				if(!submit_butt.parent().find('.ajax-submit-gif').get(0))
    					submit_butt.parent().append("<img class='ajax-loader' src='ajax-loader.gif'/>");
    				
    				jQuery(document).ajaxComplete(function(e, xhr, options){
    					submit_butt.show();
    					submit_butt.removeAttr('disabled');
    					submit_butt.parent().find('.ajax-submit-gif').remove();
    					
    					jQuery(e.currentTarget).unbind('ajaxComplete');
    				});
    			});	
    

    My one suggest, and why I was looking for an alternative, is that as is now, if you have other ajax processes going on in the window, then they may trigger ajaxComplete in this code.

Viewing 25 replies - 1 through 25 (of 73 total)
Skip to toolbar