Forum Replies Created
-
Try to echo or var_dump $video_library_category to check if it is set
@ARCangelGIRL I think you could make the $type receive the category + subcategory as an unique action. I don’t know how you’re passing the category/subcategory trhough POST, but could try something like:
function ajax_update_activity_contents () { $bpfb_code = $activity = ''; $aid = 0; $cat = $_POST['category']; $subcat = $_POST['subcategory'] $codec = new BpfbCodec; if (@$_POST['data']['bpfb_photos']) { $images = $this->move_images($_POST['data']['bpfb_photos']); $bpfb_code = $codec->create_images_tag($images); $type = $cat . $subcat; } ...
Then in search you could make the dropdown select again for the category and subcategory and use the code:
<?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ) . '&action=' . $category . $subcategory) ) : ?>
But for me this is not working with ajax though…
@ARCangeGIRL actually that’s my Plan B right now, until I find the solution to filter the ajax call (without hardcode)…
I just removed the load more icon and set the stream for ‘latest images’.
Thank you for your idea! Could you manage to make it work in search (with load more)?
This is the code I added at line 278 in /wp-content/plugins/buddypress-activity-plus/lib/class_bpfb_binder.php to create the action. The credit for this code is @Juanma in WordPress.org forum. (couldn’t find the original thread). In this case I’m creating an action for images upload.
function ajax_update_activity_contents () { $bpfb_code = $activity = ''; $aid = 0; $codec = new BpfbCodec; if (@$_POST['data']['bpfb_photos']) { $images = $this->move_images($_POST['data']['bpfb_photos']); $bpfb_code = $codec->create_images_tag($images); $type = 'bpfb_share_wall_photos'; } $bpfb_code = apply_filters('bpfb_code_before_save', $bpfb_code); // All done creating tags. Now, save the code $gid = (int)@$_POST['group_id']; if ($bpfb_code) { global $bp; $content = @$_POST['content'] . "\n" . $bpfb_code; $content = apply_filters('bp_activity_post_update_content', $content); $user_id = $bp->loggedin_user->id; $userlink = bp_core_get_userlink( $user_id ); $author = bp_core_get_userlink( $author_id ); $activity_url = bp_activity_get_permalink( $item_id ); $aid = $gid ? groups_post_update(array('conte nt' => $content, 'group_id' => $gid)) : bp_activity_add( array( 'action' => apply_filters( 'activity_update', sprintf( __( '%s shared a link', 'buddypress' ), $userlink ), $user_id ), 'content' => $content, 'component' => 'activity', 'type' => $type, 'user_id' => $user_id ) ); if ($aid) { ob_start(); if ( bp_has_activities ( 'include=' . $aid ) ) { while ( bp_activities() ) { bp_the_activity(); if (function_exists('bp_locate_template')) bp_locate_template( array( 'activity/entry.php' ), true ); else locate_template( array( 'activity/entry.php' ), true ); } } $activity = ob_get_clean(); } header('Content-type: application/json'); echo json_encode(array( 'code' => $bpfb_code, 'id' => $aid, 'activity' => $activity, )); exit(); } }
And this is the code that works for activity stream. It shows just the activities with this action, but when you click the ‘load more’ button it loads the regular stream.
<?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ) . '&action=bpfb_share_wall_photos') ) : ?>
Hello @ARCangelGIRL, I’m facing the same situation and @shanebp solution worked for displaying the action I wanted in the activity stream. But the Load More button is loading all the actions, not just the one I created. I tried to filter the bp ajax querystring in many different ways but it didn’t work. The last try was this https://buddypress.org/support/topic/simply-trying-to-filter-the-bp_ajax_querystring-via-ajax/ .
I don’t know if you did it yet, but there’s a couple of themes from sitemile that can accomplish that, specially this one http://onlinedemo.sitemile.com/?theme=project
I’ve used that with buddypress in a devsite and it worked perfectly!
The only problem is that they don’t have a free version for trial, so you’ll have to buy the theme in order to test.
Hope it helps!