• I think it would be a really great feature to add a nav item called ‘photos’ where it displays all the photos that a user has uploaded.

    Alternatively, I could attempt to do something like this myself (not that good with code though). Is there a function that gets all of the user’s photos? I can then play around with it and do something like:

    function my_bp_nav_adder() {
    	global $bp;
    
    	bp_core_new_nav_item(
    	array(
    		'name'                => __( 'Photos', 'text_domain' ),
    		'slug'                => 'photos',
    		'position'            => 10,
    		'screen_function'     => 'photosfunction',
    		'default_subnav_slug' => 'photos',
    	));
    }
    
    function photosfunction() {
    	add_action( 'bp_template_content', 'photosfunction_content' );
    	bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    
    function photosfunction_content() {
    
    	// function to display the user's photos
    }
    
    add_action( 'bp_setup_nav', 'my_bp_nav_adder', 50 );

    Thanks in advance.

    https://ww.wp.xz.cn/plugins/buddypress-activity-plus/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hey andy277,

    Hope you’re well today 🙂

    There no function inside the plugin that could be used for something like this so unfortunately this is not possible out of a box with the current version of the plugin.

    I can pass this on to our developer and if there is enough interest for this on WPMU DEV forum we’ll consider this for future development.

    Have a nice day!

    cheers,
    Bojan

    One way I was able to fix this was create a new scope that basically searches all activity items for a string and then output all of the activity items with given string

    For this plugin, we will search for bpfb_images to search for image activity posts generated by Buddypress Activity Plus

    Theres two parts to edit:

    1. functions.php
    2. yourtheme/buddypress/activity/activity-loop.php

    Put this in your functions:

    //Members query switch
    function custom_activity_scope($members_query){
    	parse_str($members_query,$query_vars);
    	switch($query_vars['scope']){
    		case 'descooverimages':
    		$members_query .= "&search_terms=bpfb_images";
    		break;
    		default:
    		return $members_query;
    	}
    	return $members_query;
    }
    
    function bn_add_activity_tab() {
    	echo '<li id="activity-descooverimages"> <a href="#" title="View Images">Images</a> </li>';
    }
    add_action( 'bp_activity_type_tabs', 'bn_add_activity_tab', 1, 2 );

    then in yourthemename/buddypress/activity/activity-loop.php, change

    if ( bp_has_activities( bp_ajax_querystring( 'activity' ) ) ) :

    to

    $activity_query = custom_activity_scope(bp_ajax_querystring('activity'));
    if (bp_has_activities($activity_query)) :

    Now you should have tab in your activity feed labeled ‘Images’, and when you click on it, will show the search results for activity items with bpfb_images.

    The reason this works is because in the WordPress Database, it is actually saved as [bpfb_images]http://domain.com/image.jpg[/bpfb_images], so searching for that exact phrase will bring those items in.

    Hope this workaround suits your needs andy277. Even though it does not create a separate page for your photos, it does however bring your photos in via AJAX.

    Also used descooverimages so that you can see which keywords go where, but you can easily change that to photos, and it shouldn’t break anything, but yet again, I don’t know your setup

    As a side note, I’d like STRESS to the WPMU ‘Team’ that if this really was a good plugin, it would make use of bp_activity_set_action() that is a part of BuddyPress. But Buddypress Activity Plus does not. All of the other buddypress plugins do. Why doesn’t this one?

    Can we get an ETA on ANY updates being worked on for this plugin in the foreseeable future?

    Sincerely, Concerned Developer

    Hey there MadManSam,

    Thank you so much for posting your code here and helping another member.

    I’ll be more then happy to forward this to our developer for a review so we could possibly include this into the plugin if you agree of course.

    Currently our developers are working on the features for other projects so at the moment we’re only doing bug fixes and security updates for plugins such as this one so I can’t provide any ETA on when new features will be available for BuddyPress Activity Plus.

    Thank you for your feedback and have a great day!

    Cheers,
    Bojan

    That works perfect! Thank you! Is there any way to incorporate that into a tab on the users profile page, so it displays the images uploaded by the given member?

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Feature request – page with all photos that a user has uploaded’ is closed to new replies.