Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 26 through 50 (of 73 total)
  • @godavid33

    Participant

    It amazes me that with such a simple solution, no one was able or willing to answer this :/

    At any rate, here is the fix. F*** functions.php, just copy buddypress.js and put it in the /js directory of your theme. Edit till your heart’s content.

    GG WP

    @godavid33

    Participant

    I really hate to be that guy continually bumping his own thread, but I haven’t been able to find an answer to this on my own that doesn’t result in the same BP_DTheme is undefined error

    @godavid33

    Participant

    Still a problem. Perhaps a better, clearer, more easily answered question would be “How can I override buddypress javascript?”

    @godavid33

    Participant

    The .mo and .po files are right, it’s just about the ajax. At any rate, I found my problem – if you have the Buddypress Extended Friend Request Plugin activated, the method I outlined above won’t work because they are already unhooking the bp core function to use their own!

    If you don’t use the BP extended friend request plugin, and want to know how I changed the text of the ajax button just holla and I’ll throw my code up.

    @godavid33

    Participant

    @buddyboss AHHHHHHH THANK YOU! Does exactly what I want, so lovely.

    So many hours and lines of code wasted… haha

    @godavid33

    Participant

    Ooooooh duh, the support is what costs. I actually will probably try and use that plugin in that case and then just customize from there. Thank’s y’all! Will post back with concise results.

    @godavid33

    Participant

    I appreciate the promotion of the plugin, and I assume you are in no way affiliated with them, but I am more inclined to custom code something as A.) it is cheaper B.) I will likely end up having to customize the plugin more anyways.

    @godavid33

    Participant

    Bumping is usually when a topic has not been solved, but an answer is still needed (at least that has been my experience in every forum I’ve ever been in).

    Yes, buddypress natively produces notifications for most things. I have never natively gotten a notification for activity comments/replies, and this is what I’m trying to accomplish (as well as notifications for favorites), and I can add the notification but I need to know how to add a URL with it as well.

    @godavid33

    Participant

    Hopefully it is alright to bump this.

    @godavid33

    Participant

    @henrywright You don’t, but BP registers both of them so I figured I would follow suit so I didn’t accidentally break anything

    @godavid33

    Participant

    This ended up being my final code. Sure I could have done it a bit easier but just wanted to cover the base of getting it done first off.

    
    remove_action( 'wp_ajax_activity_mark_fav', 'bp_dtheme_mark_activity_favorite' );
    remove_action( 'wp_ajax_nopriv_activity_mark_fav', 'bp_dtheme_mark_activity_favorite' );
    
    remove_action( 'wp_ajax_activity_mark_unfav', 'bp_dtheme_unmark_activity_favorite' );
    remove_action( 'wp_ajax_nopriv_activity_mark_unfav', 'bp_dtheme_unmark_activity_favorite' );
    
    function custom_like_text(){
    	// Bail if not a POST action
    	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
    		return;
    
    	if ( bp_activity_add_user_favorite( $_POST['id'] ) )
    		_e( '[custom unlike text]', 'buddypress' );
    	else
    		_e( '[custom like text]', 'buddypress' );
    
    	exit;
    }
    
    function custom_unlike_text(){
    	// Bail if not a POST action
    	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
    		return;
    
    	if ( bp_activity_remove_user_favorite( $_POST['id'] ) )
    		_e( '[custom like text]', 'buddypress' );
    	else
    		_e( '[custom unlike text]', 'buddypress' );
    
    	exit;
    }
    
    add_action( 'wp_ajax_activity_mark_fav', 'custom_like_text' );
    add_action( 'wp_ajax_nopriv_activity_mark_fav', 'custom_like_text' );
    
    add_action( 'wp_ajax_activity_mark_unfav', 'custom_unlike_text' );
    add_action( 'wp_ajax_nopriv_activity_mark_unfav', 'custom_unlike_text' );
    

    @godavid33

    Participant

    Aha, nevermind figured it out. I was being dumb:

    I knew it was an ajax function, but forgot to add the whole ‘wp_ajax’ string to the initial remove_action.

    @godavid33

    Participant

    I actually found that last night shortly after posting last night but have not been able to get it to work. I have tried removing it as an action, adding a filter to it, and adding my own custom function as an action 🙁

    @godavid33

    Participant

    *follow

    @godavid33

    Participant

    http://pastebin.com/zYDcV2mB

    not sure I fillow but I’ll bite

    @godavid33

    Participant

    Yeah, I generally try to avoid it which is why I was trying so hard to find the correct solution 😀

    @godavid33

    Participant

    I was incorrect, it’s not a bug. The solution (thanks to @r-a-y) is this:

    
    $act_item = bp_activity_get_specific( array(
        'display_comments' => true,
        'activity_ids' => ACTIVITY_COMMENT_ID
    ) );
    

    Closed trac ticket can be viewed here https://buddypress.trac.wordpress.org/ticket/5592#comment:4

    @godavid33

    Participant

    Arg, I always forget.

    BP 2.0, WP 3.9

    I am actually doing exactly that @shanebp! I also added that on the trac ticket I created

    @godavid33

    Participant

    I am going to open a trac ticket. I believe this is a bug.

    @godavid33

    Participant

    @henrywright I have already tried that, but it returns an empty array. As I mentioned earlier, if I supply the ID of a non-comment activity, I get results. No results with activity comments.

    Still need help with this :/

    @godavid33

    Participant

    No @shanebp I didn’t try that, though I probably will. I don’t see why it would be any different than my soluton though.

    I am now presented with the problem of getting the parent activity id of a comment though, if y’all know how to solve that 😛

    **EDIT: I tried your method Shane, but it didn’t work since I am not instantiating a loop, but a using an informal foreach and thus need to be able to pass the id of the notif**

    @godavid33

    Participant

    I swear, probably 80% of my posts result in me solving my own damn problem.

    Inside your notification loop, if you can not see the item_id when using print_r on the notification object (returned by bp_core_get_notifications_for_user($uid, ‘object’) ) then call this function on the notification ID: bp_notifications_get_notification( $notif->id )

    The object this returns contains the item_id (print_r it to see what’s up).

    Hope this helps someone

    @godavid33

    Participant

    I have something like the following for creating a custom sort. You can likely use the same thing for editing an existing sort:

    
    add_action( 'bp_pre_user_query', 'custom_pro_pre_user_query' );
    function custom_pro_pre_user_query( $BP_User_Query ) {
    	// Only run this if one of our custom options is selected
    	if ( in_array( $BP_User_Query->query_vars['type'], array( '/*Change this to the value of the Option in the sort drop-down needed*/' ) ) ) {
    		global $wpdb;
    
    		// Adjust SELECT
    		$BP_User_Query->uid_clauses['select'] = "
    			select distinct um.user_id, um.meta_value as latitude, um2.meta_value as longitude
    			from wp_usermeta as um
    			left join wp_usermeta as um2 on um.user_id=um2.user_id and um2.meta_key = 'geo_long'
    			";
    
    		// Adjust WHERE
    		$BP_User_Query->uid_clauses['where'] = "WHERE um.meta_key='geo_lat'";
    		
    		// Adjust ORDER
    		$BP_User_Query->uid_clauses['order'] = ( $BP_User_Query->query_vars['type'] == 'points-asc' ) ? 'ASC' : 'DESC';
    		echo '<script>console.log("'.$BP_User_Query->uid_clauses['where'].'");</script>';
    	
    	}
    }
    

    I haven’t tested it for what you are asking, but I believe it should work. You’ll have to edit the MySQL query itself obviously to return the results you want. By the way I found this code from the MyCred plugin Author, Gabriel Merovingi (may have gotten spelling of last name wrong)

    @godavid33

    Participant

    Does the page refresh when you click submit? My first impression would be to use javascript to check the values of each field (so use something like

    $.each(serialized_data,function(val){
    if(val.name == “email”){
    //Do something to make sure email is valid
    }
    });

    and then either bind this to the input change or form submit event (you will have to do a bit of googling on how to bind to these correctly) but there might be a better way. I havent gotten deep into BP reg forms yet

    @godavid33

    Participant

    @modemlooper, @imath : you know, I actually realized I am not using either “theme” technically. I am using Avada, but am overriding the bp-default templates I believe. Does this count as still using bp-default as my “theme”? If so, am I SOL as far as the activity stream ajax finding new content? Is there a guide or way for me to figure out how to tell BP that I’m overriding with Buddy-default templates?

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