Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'custom activity page'

Viewing 25 results - 226 through 250 (of 838 total)
  • Author
    Search Results
  • davidtuttle
    Participant

    Hi,

    I am using WP 4.6.1 in a network site, directory install using a Divi child theme. I have BuddyPress 2.6.2 with BuddyBlock, BuddyPress Cover Photo, BuddyPress Group Email Subscription and BuddyPress Group Tags. No bbPress.

    I would like to make all posts and comments in a group visible to anyone who joins the group. At the moment group members can only see the posts and comments of their friends.

    This implies that if a new member wants to see all the activity in a group, they have to send friend requests to everyone in the group.

    I believe this should be done in bp-custom.php with code something like the following. I don’t know if I should be using the ‘has_groups’ or ‘has_activites’ loop or some other loop. I confirmed that bp_is_group_single does target the page in question because I could change the per_page entries successfully.

    function make_all_group_comments_visible( $loop ) 
    {
     if ( bp_is_group_single() ) {
    		 $loop['??????'] = '????';
    	 }
      return $loop;
    }
    add_filter( 'bp_after_has_activities_parse_args','make_all_group_comments_visible');

    Thanks for any suggestions,

    David Tuttle

    #259214
    Antonio
    Participant

    If an admin of a group (not admin of the site), try to delete a own post from activity page of the group, it is succesfully deleted in ajax.

    But if he try to delete a post related to another user, then he is redirected to a page like this:
    http://www.example.com/activity/delete/699/?_wpnonce=d8a012dd00 that show a page 404 and the activity item is not deleted at all.

    I am using my custom theme, (I already tested with a standard theme and it works), I tried to debug the code but I can’t find nothiing different from the 2015 theme.

    Can you please let me know to understand why this happens?

    bikerwp000
    Participant
    <?php
    /**
     * Plugin Name:       BP Loop Filters
     * Plugin URI:        https://codex.buddypress.org/add-custom-filters-to-loops-and-enjoy-them-within-your-plugin
     * Description:       Plugin example to illustrate loop filters
     * Version:           1.0
     * Author:            imath
     * Author URI:        http://imathi.eu
     * License:           GPL-2.0+
     * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
     */
    
    // Exit if accessed directly
    if ( !defined( 'ABSPATH' ) ) exit;
    
    class BP_Loop_Filters {
    
    	/**
    	 * Constructor
    	 */
    	public function __construct() {
    		$this->setup_actions();
    		$this->setup_filters();
    	}
    
    	/**
    	 * Actions
    	 *
    	 * @uses bp_is_active()
    	 * @uses is_multisite()
    	 */
    	private function setup_actions() {
    		/**
    		 * Adds the random order to the select boxes of the Members, Groups and Blogs directory pages
    		 */
    		// Members component is core, so it will be available
    		add_action( 'bp_members_directory_order_options', array( $this, 'random_order' ) );
    
    		// You need to check Groups component is available
    		if ( bp_is_active( 'groups' ) ) {
    			add_action( 'bp_groups_directory_order_options',  array( $this, 'random_order' ) );
    		}
    
    		// You need to check WordPress config and that Blogs Component is available
    		if ( is_multisite() && bp_is_active( 'blogs' ) ) {
    			add_action( 'bp_blogs_directory_order_options',   array( $this, 'random_order' ) );
    		}
    
    		/**
    		 * Registers the Activity actions so that they are available in the Activity Administration Screen
    		 */
    		// You need to check Activity component is available
    		if ( bp_is_active( 'activity' ) ) {
    
    			add_action( 'bp_register_activity_actions', array( $this, 'register_activity_actions' ) );
    
    			// Adds a new filter into the select boxes of the Activity directory page,
    			// of group and member single items activity screens
    			add_action( 'bp_activity_filter_options',        array( $this, 'display_activity_actions' ) );
    			add_action( 'bp_member_activity_filter_options', array( $this, 'display_activity_actions' ) );
    
    			// You need to check Groups component is available
    			if ( bp_is_active( 'groups' ) ) {
    				add_action( 'bp_group_activity_filter_options', array( $this, 'display_activity_actions' ) );
    			}
    
    	        // You're going to output the favorite count after action buttons
    			add_action( 'bp_activity_entry_meta', array( $this, 'display_favorite_count' ) );
    		}
    
    	}
    
    	/**
    	 * Displays a new option in the Members/Groups & Blogs directories
    	 *
    	 * @return string html output
    	 */
    	public function random_order() {
    		?>
    		<option value="random"><?php _e( 'Random', 'buddypress' ); ?></option>
    		<?php
    	}
    
    	/**
    	 * Registering the Activity actions for your component
    	 *
    	 * The registered actions will also be available in Administration
    	 * screens
    	 *
    	 * @uses bp_activity_set_action()
    	 * @uses is_admin()
    	 */
    	public function register_activity_actions() {
    		/* arguments are :
    		- 'component_id', 'component_action_type' to use in {$wpdb->prefix}bp_activity database
    		- and 'caption' to display in the select boxes */
    		bp_activity_set_action( 'bp_plugin', 'bpplugin_action', __( 'BP Plugin Action' ) );
    
    		/* Activity Administration screen does not use bp_ajax_querystring
    		Moreover This action type is reordering instead of filtering so you will only
    		use it on front end */
    		if ( ! is_admin() ) {
    			bp_activity_set_action( 'bp_plugin', 'activity_mostfavs', __( 'Most Favorited' ) );
    		}
    	}
    
    	/**
    	 * Building an array to loop in from our display function
    	 *
    	 * Using bp_activity_get_types() will list all registered activity actions
    	 * but you need to get the ones for your plugin, and this particular function
    	 * directly returns an array of key => value. As you need to filter activity
    	 * with your component id, the global buddypress()->activity->actions will be
    	 * more helpful.
    	 *
    	 * @uses buddypress()
    	 * @return array the list of your plugin actions.
    	 */
    	private function list_actions() {
    
    		$bp_activity_actions = buddypress()->activity->actions;
    
    		$bp_plugin_actions = array();
    
    		if ( !empty( $bp_activity_actions->bp_plugin ) ) {
    			$bp_plugin_actions = array_values( (array) $bp_activity_actions->bp_plugin );
    		}
    
    		return $bp_plugin_actions;
    	}
    
    	/**
    	 * Displays new actions into the Activity select boxes
    	 * to filter activities
    	 * - Activity Directory
    	 * - Single Group and Member activity screens
    	 *
    	 * @return string html output
    	 */
    	public function display_activity_actions() {
    		$bp_plugin_actions = $this->list_actions();
    
    		if ( empty( $bp_plugin_actions ) ) {
    			return;
    		}
    
    		foreach ( $bp_plugin_actions as $type ):?>
    			<option value="<?php echo esc_attr( $type['key'] );?>"><?php echo esc_attr( $type['value'] ); ?></option>
    		<?php endforeach;
    	}
    
    	/**
    	 * Displays a mention to inform about the number of time the activity
    	 * was favorited.
    	 *
    	 * @global BP_Activity_Template $activities_template
    	 * @return string html output
    	 */
    	public function display_favorite_count() {
    		global $activities_template;
    
    		// BuddyPress < 2.0 or filtering bp_use_legacy_activity_query
    		if ( ! empty( $activities_template->activity->favorite_count ) ) {
    			$fav_count = $activities_template->activity->favorite_count;
    		} else {
    			// This meta should already have been cached by BuddyPress :)
    			$fav_count = (int) bp_activity_get_meta( bp_get_activity_id(), 'favorite_count' );
    		}
    
    		if ( ! empty( $fav_count ) ): ?>
    			<a name="favorite-<?php bp_activity_id();?>" class="button bp-primary-action">Favorited <span><?php printf( _n( 'once', '%s times', $fav_count ), $fav_count );?></span></a>
    		<?php endif;
    	}
    
    	/**
    	 * Filters
    	 */
    	private function setup_filters() {
    		add_filter( 'bp_ajax_querystring',              array( $this, 'activity_querystring_filter' ), 12, 2 );
    		add_filter( 'bp_activity_get_user_join_filter', array( $this, 'order_by_most_favorited' ),     10, 6 );
    		add_filter( 'bp_activity_paged_activities_sql', array( $this, 'order_by_most_favorited'),      10, 2 );
    
    		// Maybe Fool Heartbeat Activities!
    		add_filter( 'bp_before_activity_latest_args_parse_args', array( $this, 'maybe_fool_heartbeat' ), 10, 1 );
    	}
    
    	/**
    	 * Builds an Activity Meta Query to retrieve the favorited activities
    	 *
    	 * @param  string $query_string the front end arguments for the Activity loop
    	 * @param  string $object       the Component object
    	 * @uses   wp_parse_args()
    	 * @uses   bp_displayed_user_id()
    	 * @return array()|string $query_string new arguments or same if not needed
    	 */
    	public function activity_querystring_filter( $query_string = '', $object = '' ) {
    		if ( $object != 'activity' ) {
    			return $query_string;
    		}
    
    		// You can easily manipulate the query string
    		// by transforming it into an array and merging
    		// arguments with these default ones
    		$args = wp_parse_args( $query_string, array(
    			'action'  => false,
    			'type'    => false,
    			'user_id' => false,
    			'page'    => 1
    		) );
    
    		/* most favorited */
    		if ( $args['action'] == 'activity_mostfavs' ) {
    			unset( $args['action'], $args['type'] );
    
    			// on user's profile, shows the most favorited activities for displayed user
    			if( bp_is_user() ) {
    				$args['user_id'] = bp_displayed_user_id();
    			}
    
    			// An activity meta query :)
    			$args['meta_query'] = array(
    				array(
    					/* this is the meta_key you want to filter on */
    					'key'     => 'favorite_count',
    					/* You need to get all values that are >= to 1 */
    					'value'   => 1,
    					'type'    => 'numeric',
    					'compare' => '>='
    				),
    			);
    
    			$query_string = empty( $args ) ? $query_string : $args;
            }
    
            return apply_filters( 'bp_plugin_activity_querystring_filter', $query_string, $object );
    	}
    
    	/**
    	 * Ninja Warrior trick to reorder the Activity Loop
    	 * regarding the activities favorite count
    	 *
    	 * @param  string $sql        the sql query that will be run
    	 * @param  string $select_sql the select part of the query
    	 * @param  string $from_sql   the from part of the query
    	 * @param  string $where_sql  the where part of the query
    	 * @param  string $sort       the sort order (leaving it to DESC will be helpful!)
    	 * @param  string $pag_sql    the offset part of the query
    	 * @return string $sql        the current or edited query
    	 */
    	public function order_by_most_favorited( $sql = '', $select_sql = '', $from_sql = '', $where_sql = '', $sort = '', $pag_sql = '' ) {
    		if ( apply_filters( 'bp_use_legacy_activity_query', false ) ) {
    			preg_match( '/\'favorite_count\' AND CAST\((.*) AS/', $where_sql, $match );
    
    			if ( ! empty( $match[1] ) ) {
    				$new_order_by = 'ORDER BY '. $match[1] .' + 0';
    				$new_select_sql = $select_sql . ', '. $match[1] .' AS favorite_count';
    
    				$sql = str_replace(
    					array( $select_sql, 'ORDER BY a.date_recorded' ),
    					array( $new_select_sql, $new_order_by ),
    					$sql
    				);
    			}
    
    		// $select_sql is carrying the requested argument since BuddyPress 2.0.0
    		} else {
    			$r = $select_sql;
    
    			if ( empty( $r['meta_query'] ) || ! is_array( $r['meta_query'] ) ) {
    				return $sql;
    			} else {
    				$meta_query_keys = wp_list_pluck( $r['meta_query'], 'key' );
    
    				if ( ! in_array( 'favorite_count', $meta_query_keys ) ) {
    					return $sql;
    				}
    
    				preg_match( '/\'favorite_count\' AND CAST\((.*) AS/', $sql, $match );
    
    				if ( ! empty( $match[1] ) ) {
    					$sql = str_replace( 'ORDER BY a.date_recorded', 'ORDER BY '. $match[1] .' + 0', $sql );
    				}
    			}
    		}
    
    		return $sql;
    	}
    
    	/**
    	 * Cannot pass the favorite data for now so just fool heartbeat activities
    	 */
    	public function maybe_fool_heartbeat( $r = array() ) {
    		if ( empty( $r['meta_query'] ) ) {
    			return $r;
    		}
    
    		$meta_query_keys = wp_list_pluck( $r['meta_query'], 'key' );
    
    		if ( ! in_array( 'favorite_count', $meta_query_keys ) ) {
    			return $r;
    		} else {
    			$r['since'] = '3000-12-31 00:00:00';
    		}
    
    		return $r;
    	}
    }
    
    // 1, 2, 3 go !
    function bp_loop_filters() {
    	return new BP_Loop_Filters();
    }
    
    add_action( 'bp_include', 'bp_loop_filters' );
    
    
    HDcms
    Participant

    Hello,

    The ultimate goal is to mask the content and selector when a member arrives on the page of a public group to which it has not acceded. In fact he will see just the top of the page, and description button to join group

    screenshot:
    https://framapic.org/j4FYWFvZmHVI/sOyIzEz0Gl7F.png

    The idea is to reach over activities and other menu group visited oblige to register if he sees that description, avatar and the button to join

    I found bp_group_is_member to test ()
    http://buddypress.wp-a2z.org/oik_api/bp_group_is_member/
    If I do not put any argument, I understand that it will test whether the member is party group (and I add the condition to be displayed in a group?

    I have an error message:
    « Fatal error: Call to undefined function bp_group_is_member() in /var/www/../wp-content/plugins/bp-custom.php on line 3 »

    What I found to achieve the goal:

    if ( !bp_group_is_member() || bp_is_active('groups') )
     {add_filter( 'bp_after_has_activities_parse_args', 'my_bp_activity_types_non-membre' );}
     
    function my_bp_activity_types_non-membre( $retval ) {
        $retval['action'] = array(        
            //'activity_comment',
    	//'activity_update',
    	//'created_group',
    	//'friendship_created', nouv relation entre membre
    	//'joined_group',
    	//'last_activity',
    	//'new_avatar',
    	//'new_blog_comment',
            //'new_blog_post',
    	//'new_member',
    	//'updated_profile',
    	//'rtmedia_update'       
        ); 
        return $retval;

    Regards

    #258955
    danbp
    Participant

    Hi @tronix-ex,

    Give this a try. Read more will only appear again if you use more than 500 000 characters…
    Add to bp-custom.php

    function bpfr_excerpt_length( $length ) {	
    
    $length = 500000; // adjust the length to desired number of characters 
    
    // Is the current page a user's activity stream page ?
    	if( bp_is_user_activity() ) {
    	  return $length;
    	}
    }
    add_filter( 'bp_excerpt_length', 'bpfr_excerpt_length', 11, 1 );
    danbp
    Participant

    Hi @rezbiz,

    in brief, you want to add some status dependent custom link to the BuddyBar.

    I’ll ignore Kleo (premium theme) and Visual Composer (third party plugin).

    Following examples let you add an external link to a non BP page on almost any menus (except BP usermenu).

    How it works ?
    – create a test page and call it Book.
    – the page slug must be /book/
    – the link (tab/button) will be displayed to logged-in users only.

    I made also a snippet which add such a link to the WordPress Main Menu. This menu is the one you see in WP’s menu customizer by default. Depending the theme you use, you have always a main menu and X others. This can vary and it’s to you to find how it can/should work eventually. See theme documentation and WP Codex if you get in trouble with it.
    Note that it should work with all Twenty themes at least.

    Add the snippets to bp-custom.php and see the result. After that, read through the code and modify the page name/ID and slug to your need. Leave anything else untouched.

    
    // add Custom tab on site wide activity and members directory pages
    function tab_custom_link_to_page() {
    
    	if ( bp_is_activity_component() || bp_is_page( BP_MEMBERS_SLUG ) ) {
    
    		if ( !is_user_logged_in() )
    			return false;
    
    		// link to what you want
    		$link = bp_get_root_domain() . '/book';
    
    		echo'<li><a href="'. $link .'">My Book</a></li>'; 
    	}
      
    }
    add_action( 'bp_activity_type_tabs', 'tab_custom_link_to_page' ); // site wide activity page
    add_action( 'bp_members_directory_member_types', 'tab_custom_link_to_page' ); // members directory page
    
    // add Custom tab on Profile Nav
    function add_profiles_link_to_page(){
    
    	if ( bp_is_profile_component() || bp_is_user() ) {
    
    	if ( !is_user_logged_in() )
    		return false;
    
    	$link = bp_get_root_domain() . '/book/';
    
    	?>
    		<li><a href="<?php echo $link; ?>"><?php printf( 'My Book' ); ?></a></li>
    	<?php  
    	}
    }
    add_action( 'bp_member_options_nav', 'add_profiles_link_to_page' );
    
    // add Custom tab on Groups Nav
    function add_groups_link_to_page(){
    
    if( bp_is_active( 'groups' ) ) {
    
    	if ( !is_user_logged_in() )
    		return false;
    
    	$link = bp_get_root_domain() . '/';
    
    	bp_core_new_subnav_item( array(
    		'name'			=> 'My Book',
    		'slug'			=> 'book',
    		'parent_slug'		=> bp_get_current_group_slug(),
    		'parent_url'		=> $link,
    		'screen_function'	=> true, 
    		'position'		=> 40 ) );
    	}
    }
    add_action( 'bp_setup_nav', 'add_groups_link_to_page' );
    
    // add Custom tab on Groups Directory
    function add_groups_directory_link_to_page() {
    
    	if( bp_is_active( 'groups' ) ) {
    
    	if ( !is_user_logged_in() )
    		return false;
     
        if ( bp_is_current_action( 'custom' ) ) 
            return;
     
    	$link = bp_get_root_domain() . '/book';
    
        $button_args = array(
            'id'         => 'my-books',
            'component'  => 'groups',
            'link_text'  => 'My Book',
            'link_title' => 'My Book',
            'link_class' => 'my-books no-ajax',
            'link_href'  => $link,
            'wrapper'    => false,
            'block_self' => false,
        );  
       
        ?>
    		<li><?php echo bp_get_button( apply_filters( 'bp_get_group_custom_button', $button_args ) ); ?></a></li>
        <?php
    	}	
    }
    add_action( 'bp_groups_directory_group_filter', 'add_groups_directory_link_to_page' );
    
    // add Custom tab on WP Main Menu ( after Home, About, etc )
    function main_menu_custom_link_to_page( $menu ) { 
         
    	if ( !is_user_logged_in() )
    			return $menu;
    	else
     	// link to what you want
    	$link = bp_get_root_domain() . '/book';
    
    	$grouplink = '<li><a href="'. $link . '">My Book</a></li>';
    
    	$menu = $menu . $grouplink;
    	return $menu;
    }
    add_filter( 'wp_nav_menu_items', 'main_menu_custom_link_to_page' );

    Yes, it looks complicated, but it isn’t. Simply it’s not homogeneous ! 🙂

    danbp
    Participant

    @fearthemoose, @rezbiz,

    Here “the best guarded secret” finally revealed !
    But it’s not a secret, is part of Codex and a multi handled topic subject on this forum.

    What we want to do: remove access possibility.
    Where: on BuddyBar navigation menu (the one below the profile header).
    Specifics: make the activity and forum tabs only visible to the logged in user.

    NOTE: The activity tab is shown by default when you visit a profile.

    As we are going to hide/remove this tab to visitors, we need to define as first another default tab. If we won’t do that, the visitor will get a Page not found error. Which is not exactly the case here, the page exist but the visitor can’t access it.

    Let’s define arbitrary Profile as the new default tab. You can of course define what ever other existing tab on your BuddyBar as default.

    Add this line to bp-custom.php
    define( 'BP_DEFAULT_COMPONENT','profile' );

    Now the mega “open secret” !

    The folowing snippet contains almost any BP menu items you can have on a BuddyBar, and includes also the Forum item, in case you use bbPress.
    You can remove or comment out those you don’t want to use.
    Note also that it is only an example – you have to play with it to fit your need. But at least you have the right syntax to use.
    Note also that some profile menu items are user only, such as message or notice. In other words, these are always private.

    This function goes preferably to bp-custom.php

    function bpfr_hide_tabs() {
    global $bp;
    	 /**
    	 * class_exists() & bp_is_active are recommanded to avoid problems during updates 
    	 * or when Component is deactivated
    	 */
    
    	if( class_exists( 'bbPress' ) || bp_is_active ( 'groups' ) ) :
            
            /** here we fix the conditions. 
            * Are we on a profile page ? | is user site admin ? | is user logged in ?
            */
    	if ( bp_is_user() && !is_super_admin() && !is_user_logged_in() ) {
    
            /* and here we remove our stuff ! */
    		bp_core_remove_nav_item( 'activity' );
    		bp_core_remove_nav_item( 'friends' );
    		bp_core_remove_nav_item( 'groups' );
    		bp_core_remove_nav_item( 'forums' );
    	}
    	endif;
    }
    add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );

    Some other hints for privacy
    if you want to allow only the profile owner to view some tabs, replace
    !is_user_logged_in by !bp_is_my_profile() – this scenario doesn’t need a check for logged in users as it is made by bp_is_my_profile.

    If you want only to make a profile private, read here.

    If you want to remove a sub-nav item (ie. View on Profile), you use something like:
    bp_core_remove_subnav_item( 'profile', 'view' );

    Many other possibilities for navigation are also available, including for groups. Several examples are given on Codex, here.

    And if not enough, RTFM and search the forum ! 🙂

    Have fun !

    #258866
    danbp
    Participant

    Hi,

    not sure i understand correctly, but if you want the resume page to show as default landing tab (in place of the user activity) when you are on a profile, you can use this:

    define( 'BP_DEFAULT_COMPONENT', 'resume' );

    Add it to bp-custom.php

    Codex reference.

    #258782
    inzerat
    Participant

    This is part of buddypress. On activity page have meta title description “Side wide Activy – Name of web” a i want change this in bp-custom.php

    #258638
    danbp
    Participant

    I’m unable to reproduce your issue on a single install with over 20 plugins active and plenty of custom functions active in bp-custom.php
    I can upload medias without problem with different 3th party themes or Twenty’s

    Try to upload a fresh copy of WordPress and BP and see if it makes a difference.

    Now about the snippet.
    It works more or less, no code error. You commented the action, so it is deactivated if someone copy/paste it without correcting this.

    That said, what is the reason behind using a redirection to login if the site, or at least the buddyPress parts, should be private ?

    Wouldn’t it be more logic to redirect visitors to an anonymous page with some important information, from which the first one could be Sorry, but this site is private ? Followed by some informations how to register or pay a fee or whatever the reason.

    A private site has two type of visitors: those invited to join and the others. Don’t give the opportunity to those who are there by chance to enter the site so easily.

    I let you think about this and eventually create an appropriate page and template.
    Here a code example redirecting to a page called Intranet and the correct calls to slugs for all components (including bbPress).

    function bpfr_guest_redirect() {
    global $bp;
    // enter the slug or component conditional here
    	if ( bp_is_activity_component() || bp_is_groups_component() || bp_is_blogs_component() || bp_is_page( BP_MEMBERS_SLUG ) || is_bbpress() ) {
    	
    // not logged in user are redirected to - comment/uncomment or add/remove to your need
    		if( !is_user_logged_in() ) { 
    			//wp_redirect( get_option('siteurl') ); //back to homepage
    			//wp_redirect( get_option('siteurl') . '/register' ); // back to register page	
    			wp_redirect( get_option('siteurl') . '/intranet' ); // back to whatever page
    		} 
    	}
    }
    add_filter( 'get_header', 'bpfr_guest_redirect', 1 );

    Add it to child-theme’s functions.php

    #258589
    ositive
    Participant

    I tryed to work also with this solution (provided by @shanebp too):
    https://buddypress.org/support/topic/creating-a-new-order-by-filter-in-groups-loop-with-custom-sql/
    but I do not obtain to order members by rating.. is this the right approach??

    function antares_members_filter_options() {
        echo '<option value="rating">rating</option>';
    }
    add_action( 'bp_members_directory_order_options', 'antares_members_filter_options' );
    
    function antares_ajax_querystring( $query_string, $object ) {
    
    	if ( 'members' != $object ) 
    		return $query_string;
    
    	if ( ! bp_is_members_directory() ) 
    		return $query_string;
    	
    	$query_args = wp_parse_args( $query_string, array() );
    
            $page = $query_args['page'];
    
    	if( isset( $query_args['action'] ) && $query_args['action'] == 'rating' ) {
    	
    		$query_args = array();
    		$query_args['page'] = $page;
    		$query_args['orderby'] = 'rating';		
    		$query_args['order'] = 'ASC';			
    		$query_args['include'] = antares_get_members(); 
    		$query_string = http_build_query( $query_args );
    
    	}
    
    	return $query_string;
    
    }
    add_filter( 'bp_ajax_querystring', 'antares_ajax_querystring', 32, 2 );
    
    function antares_get_members() {
        global $wpdb;
    
            $sql = "SELECT 
    					a.ID as id, a.user_login AS name, a.display_name AS displayname, AVG(star) AS rating, COUNT(star) AS reviews
    				FROM 
    					{$wpdb->prefix}users AS a
    				LEFT JOIN 
    					{$wpdb->prefix}bp_activity AS b ON a.ID = b.usercheck
    				WHERE 
    					(b.is_activated is null or b.is_activated=1)
    				GROUP BY 
    					id
    				ORDER BY 
    					rating DESC";
        
    $buff = array();
    
    $result = $wpdb->get_results( $sql , OBJECT );
    
    		foreach ($result as $row) {
    			$buff[]= $row->id ;
    		}
    		
    $query_str= implode (',', $buff);
    return $query_str;
    }
    #258559
    jbboro3
    Participant

    Why don’t you just put this two lines of css code in your theme’s css or custom css page instead of trying to get into functions files..

    a.button.item-button.bp-secondary-action.delete-activity.confirm {
    display: none;
    }
    a.delete.acomment-delete.confirm.bp-secondary-action {
    display: none;
    }

    #258373
    jbboro3
    Participant

    Hello bp community,

    As I’m relatively new to buddypress, I couldn’t figure out why my widgets are not showing up even after assigning the widget on a relevant page (Home profile page/ members page).

    Interestingly, it shows up whenever I assign the widgets to “404 NOT FOUND” page.. The settings are fine. There is already proper allocation of members pages and Activity streams (NOT in the “404 NOT FOUND” page). Even creating custom template page and assigning them didn’t work either.. Seems like members pages are acting like NONE existent on the actual page they are assigned with

    Am I doing something wrong with the configuration? Please share if someone is facing the same problem..

    Thanks

    lomaymi
    Participant

    I’m trying to change the way new blog posts are seen on the Site Wide Activity page and I’m halfway there, but having a few issues. Here what I have so far (in bp-custom.php):

    
    <?php
    
    // Edits how blog posts appears on activity feed.
    
    function bp_full_posts_in_activity_feed( $content, $activity ) {
    
         if ( 'new_blog_post' == $activity->type ) {
    
            $post = get_post( $activity->secondary_item_id );
    
         if ( 'post' == $post->post_type )
                 $title = isset( $post->post_title ) ? $post->post_title : '';
                 $content = apply_filters( 'the_content', $post->post_content );
                 $author = "<h5 align=center>By Author Name Here</h5>";
                
         }
        
        echo "<h2 align=center>" .$title. "</h2>";
        echo $author;
        echo $content;
         
    }    
    add_filter( 'bp_get_activity_content_body', 'bp_full_posts_in_activity_feed', 10, 2 );
    

    What I’m trying to do is instead of having the full post I want for the post to break whenever the more tag is used in a post. After the more tag a text or button should appear saying “Read More”. I tried a few things with no success, will appreciate some pointers in the right direction.

    Another thing (although not that important) is that instead of having a default text with “By Author Name Here” it would be great if it can print the name of the post author. I tried using get_the_author(), the_author() and the_author_link(), but none of them were able to show the name in the activity feed.

    Thanks in advance

    #258189
    jbboro3
    Participant

    Hey, @danbp Thanks for the long and detailed response.

    I’m fully aware of what you’re trying to convey the risk factors on this.. But as my requirements are different, I’ve completely disabled the media library and allowed access the users to each individual gallery only (negating the access of other’s files).. I’ve uploaded images hosted on sub-domains that completely separate from the main site.

    All the activities that takes place on the site are on the front end.. The back end wp administrator dashboard are disabled for editing ( of course they are enabled for updating plugins & adding pages occasionally) as most of the pages are done in custom-template.. No admin or author level privileges are created on the site – just the subscriber as it’s mainly a networking site.. The idea that attaching the media button gives lots of flexibility to the users to resize the images or review them in the content area itself before they can post the activity.. Unless it’s a forums or community sites, for a networking sites, leaving alone with html codes or text editors may be (perhaps) discouraging impression for the social users.

    I’m glad that you pointed out it’s more of a wordpress thing than buddypress.. I’ll have a look at the possibility of getting it work and let you know.

    Thanks.

    #258125
    danbp
    Participant

    The ultimate tutorial to add wp_editor to What’s New textarea (on Site, Members and Group Activities pages).

    Warning
    The What’s New feature was never intended to publish posts or formatted text. It was imagined for brief announcement or instant conversation. That’s why this textarea is texturized and doesn’t allow much HTML tags. It is also ajaxified and need the original BP ID to work.
    You will use it at your own risk.

    The following trick will let you remove the existing textarea from the template and replace it with a custom wp_editor. And it will be very customized ! For example, you will not have the visual tab, but only his HTML version, similar to the one you see on this forum for example.

    Required:
    BuddyPress activated
    a working child theme
    some understanding of HTML and php grammar

    This trick was succesfully tested on a single install with WP 4.6, BP 2.6.2 and a Twenty Sixteen child theme.

    Start !
    Read from here how to remove the textarea in post-form.php

    The code to remove is line 40 and looks like this:

    <textarea class="bp-suggestions" name="whats-new" id="whats-new" cols="50" rows="10"
    	<?php if ( bp_is_group() ) : ?>data-suggestions-group-id="<?php echo esc_attr( (int) bp_get_current_group_id() ); ?>" <?php endif; ?>
    ><?php if ( isset( $_GET['r'] ) ) : ?>@<?php echo esc_textarea( $_GET['r'] ); ?> <?php endif; ?></textarea>

    You replace it by:

    <?php
    $content = '';
    $editor_id = 'whats-new';
    wp_editor( $content, $editor_id );
    ?>

    As the visual edit tab doesn’t work, you must deactivate it. In your child-theme functions.php, add this:
    add_filter( 'user_can_richedit' , '__return_false', 50 );

    And that’s it !

    If you want also rich edit for activity comments, which i didn’t recommand for sites who have many comments, you can use the same technique as above, with some more settings. Note that each comment has is own ID and that each comment editor should also have an unique ID.

    First, you need to remove the textarea from (child-theme/buddypress/)activity/entry.php
    You remove this:
    <textarea id="ac-input-<?php bp_activity_id(); ?>" class="ac-input bp-suggestions" name="ac_input_<?php bp_activity_id(); ?>"></textarea>
    and replace it by

    <?php
    $id             = bp_get_activity_id();
    $content	= '';
    $editor_id	= 'ac-input-'. $id;
    $settings	= array( 
    			'textarea_name'	=> 'ac_input_'. $id,
    			'editor_class'	=> 'ac-input bp-suggestions'
    		);
    wp_editor( $content, $editor_id, $settings );
    ?>

    With Twenty Sixteen, i first couldn’t see the Post Update button and the option selector. I got it with this little CSS adjustment (in child-theme/style.css).

    div#whats-new-options { display: block!important;}

    Function reference: wp_editor.

    #258122
    lil_bugga
    Participant

    Site:http://www.vwrx-project.co.uk Using WordPress 4.6 and BuddyPress 2.6.2

    I’ve just installed BuddyPress as I want to create a community based website within WordPress.

    My end goal is to have a site where multiple users can add content regarding their car project/build, where each update they add is displayed on the homepage of the site, but where viewing a users profile you could, should you wish, view someones project in its entirety with all posts and content or view just the images they’ve uploaded.

    I’m in the process of creating my own theme for this website but I’m having a hard to changing anything within BuddyPress.

    I’ve copied the entire BuddyPress plugin directory into my theme and then each document I edit I make a note of, so then I can remove any files I haven’t touched. I wanted to start with something simple before moving onto bigger modifications so opted to try and change the Site-Wide Activity title that displays.

    I have found bp-activity-actions.php line 450 & class-bp-activity-component.php line 125 and edited, saved and uploaded/overwrote these files into my themes version of Buddypress but can’t get the title to change.

    Once I’d done that I was hoping to edit the activity page to remove almost everything, the only part I really wanted to keep was the activity feed itself so that anyone visiting my sites homepage will see the most recent updates etc.

    Have I missed/overlooked something silly. I’m more accustomed to creating websites myself with CSS and PHP etc but as I want this site to be easy to use and accessible to multiple people adding content I felt this would be a better route to take.

    #258065
    jgilbert1990
    Participant

    Hope everybody is doing well.
    Im having trouble using a plugin. The plugin is by likebtn.com and allows me to sort activity by most liked content. However it requires modifying a bit of code and im having quite the difficult time. I have tried pasting this line of code into a few different files. Currently im trying to paste it into ‘public_html/wp-content/plugins/buddypress/bp-activity/bp-activity-template.php’. When i try to include it into the PHP file the activity page breaks and a syntax error appears saying there was an unexpected ‘<‘ at the top of the new code. Here is where i pasted the code and the instructions provided by likebtn.com

    function bp_has_activities( $args = '' ) {
    	global $activities_template;
    
    	// Get BuddyPress.
    	$bp = buddypress();
    
    	/*
    	 * Smart Defaults.
    	 */
             //Filtering by Likes.Custom Code.
             <?php query_posts($query_string . '&meta_key=Likes&orderby=meta_value&meta_type=numeric&order=DESC'); ?>
    <?php /* Start the Loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>
        <?php get_template_part( 'content', get_post_format() ); ?>
    <?php endwhile; ?>
    
    	// User filtering.
    	$user_id = bp_displayed_user_id()
    		? bp_displayed_user_id()
    		: false;

    https://likebtn.com/en/wordpress-like-button-plugin#sort_posts_by_likes

    #257816
    ositive
    Participant

    Hi!
    First of all thanks for the amazing work you are doing..
    In my buddypress installation I’ve a rating associated to each member (each member can rate each other) and I would like to add “rating” to the “order by” option of the member page.

    Now I can do it with a widget that orders members with the function I report below. But I would like to add the possibility to order members by rating in the “order by” option.

    I’ve seen the topic https://buddypress.org/support/topic/adding-new-order-by-on-members-loop/ trying to adapt it to my case, but the order by rating option do not work properly.

    It is possible to adapt that solution (or another working) to my case?
    Thanks in advance.

    function prorevs_users_by_rating($limit) {
        global $wpdb;
        if (current_user_can('administrator')):
    
            $users = $wpdb->get_results(
                    $wpdb->prepare(
                            "SELECT
                     a.ID as id, a.user_login AS name, a.display_name AS displayname, AVG(star) AS rating, COUNT(star) AS reviews
                 FROM {$wpdb->prefix}users AS a
                 LEFT JOIN {$wpdb->prefix}bp_activity AS b ON a.ID = b.usercheck
                 WHERE (b.is_activated is null or b.is_activated=1)
                 GROUP BY id
                 ORDER BY rating DESC
                 LIMIT %d", $limit
                    )
            );
        else:
            $users = $wpdb->get_results(
                    $wpdb->prepare(
                            "SELECT
                     a.ID as id, a.user_login AS name, a.display_name AS displayname, AVG(star) AS rating, COUNT(star) AS reviews
                 FROM {$wpdb->prefix}users AS a
                 LEFT JOIN {$wpdb->prefix}bp_activity AS b ON a.ID = b.usercheck
                 WHERE (b.is_activated is null or b.is_activated=1)
                 GROUP BY id
                 ORDER BY rating DESC
                 LIMIT %d", $limit
                    )
            );
        endif;
        return prorevs_print_users($users);
    }
    
    function prorevs_users_by_rating_shortcode($atts) {
        extract(shortcode_atts(array('limit' => 10), $atts));
        return prorevs_users_by_rating($limit);
    }
    #257815
    alexdex
    Participant

    Hi, i put this:

    define ( ‘BP_ENABLE_ROOT_PROFILES’, true );

    add_filter( ‘bp_core_enable_root_profiles’, ‘__return_true’ );

    I try in bp-custom. php and also in my function theme but not work

    Every time i click in the activity page on the username (like email) do not work, 404 error

    For example, if a username member is alex7@gmail.com and i click do not work, if is only alex7 it work perfect

    The path is:

    members/alex7@gmail.com/ DO NOT WORK

    members/alex7/ WORK

    Can you help me?

    Thanks a lot

    #257683
    brianhackett
    Participant

    Hi Guys
    Im using custom post activities to pull in rss feeds into user activity feeds. I use wp rss aggregator and feedtopost to create a custom posts feed from other social networks which i can then assign to individual members. So at the moment I have pull in the feed excerpt as a title and the featured image into the feed using this code

    <?php
    // Don't forget to add the 'buddypress-activity' support!
    add_post_type_support( 'social_feed', 'buddypress-activity' );
    function customize_page_tracking_args() {
        // Check if the Activity component is active before using it.
        if ( ! bp_is_active( 'activity' ) ) {
            return;
        }
        bp_activity_set_post_type_tracking_args( 'social_feed', array(
            'component_id'             => buddypress()->blogs->id,
            'action_id'                => 'new_social_feed',
            'bp_activity_admin_filter' => __( 'My Social Feed', 'custom-domain' ),
            'bp_activity_front_filter' => __( 'Social Feed', 'custom-domain' ),
            'contexts'                 => array( 'activity', 'member' ),
            'activity_comment'         => true,
            'bp_activity_new_post'     => __( '%1$s posted a new <a href="%2$s">Social Media Update</a>', 'custom-textdomain'  ),
            'bp_activity_new_post_ms'  => __( '%1$s posted a new <a href="%2$s">Social Media Update</a>, on his profile', 'custom-textdomain' ),
            'position'                 => 100,
        ) );
    }
    
    add_action( 'init', 'customize_page_tracking_args', 1000 );
    
    // Adds title of custom Blog Post Type instead of excerpt
    
    function record_cpt_activity_content( $cpt ) {
    
        if ( 'new_social_feed' === $cpt['type'] ) {
    
            $cpt['content'] = get_the_title();
        }
    
        return  $cpt;
    }
    add_filter('bp_after_activity_add_parse_args', 'record_cpt_activity_content'); 
    
    // Adds custom blog featured image to activity feed
    function record_cpt_activity_content_featured_image( $cpt ) {
    
        if ( 'new_social_feed' === $cpt['type'] ) {
    
            global $wpdb, $post, $bp;
            $theimg = wp_get_attachment_image_src(  get_post_thumbnail_id( bp_get_activity_secondary_item_id() ) );
            $cpt['content'] .= '<img src="' . $theimg[0] . '" width="160px" height="30px">';
        }
    
        return $cpt;
    }
    add_filter('bp_after_activity_add_parse_args', 'record_cpt_activity_content_featured_image');
    ?>

    This works well but i would like to add a link back to the original social media post.I have setup wp rss aggregator to add the original link as the permalink for each of the custom posts.So I wanted to know how to work the permalink in so the title and image are linked back to the original post.
    Thanks

    Apokh
    Participant

    – checked- theres only one Activity page
    – resaved permalink structure
    – i dont use custom code, but activity+ plugin
    – i use quiet a bunch of additional plugins:
    –BoweCodes
    –Buddypress
    –DisableFeeds
    –DownloadManager
    –DynamicWidgets
    –EventsManager
    –GoogleAnalyticsDashboard
    –GoogleFonts for WP
    –HungryFEED
    –LayerSliderWP
    –Mediapress
    –Members
    –Metaslider+Pro
    –myCred
    –myCredHookBP
    –PageBuilder Siteorigin
    –PaypalDonations
    –Peters Login Redirect
    –PHP Text Widget
    –SimplePress
    –Siteorigins Masonry
    –SpamProtect by Cleantalk
    –TablePress
    –Wordpress VideoGalery
    –WP FullCalendar
    –WP Lastlogin
    –WP TwitterFeeds
    –WP ULike
    –WP touchmobile

    danbp
    Participant

    @apock i merged your older topic to this one.

    – ensure you have only one activity page (and none in trash).
    – resave your permalinks. Sometimes pages are lost after updates.
    Also:
    – have you tested with another theme ?
    – which plugins do you use ?
    – do you use some custom code related to activities ?

    #257616
    zelda16
    Participant

    Hi there,

    I was just wondering if you could help me; I’m trying to start a Buddypress sub-community on my existing website. We currently have a user system that enables the use of our services; however I was trying to create a forum as a sub-page on our website and a community from that. I realised, however, that WP was finding it difficult to distinguish users on our current system with users of Buddypress. Is there a way of creating a completely separate user-type for Buddypress, so as to prevent cross-over from our two systems?

    I want to work towards:
    -Different details required for our user system than Buddypress
    -Different menu items for our users than for forum users
    -Our user details and activity goes into a massive database; however I don’t want this to be impacted by the forum users

    Thanks a lot for your help!

    Running: WordPress 4.5.3 on Customizr theme
    Buddypress 2.6.2

    #257147
    buddycore
    Participant

    I’m going to design & develop a theme for BuddyPress to help pay the bills around here.

    The theme will be made open-source until I have an audience then I may put a price on the theme to maintain it and help pay my bills.

    This is my research before embarking on the project. I’d really appreciate the help.

    Should I make a light or dark theme?

    What components are most important, I will build in this order and release for testing once each component is functional. Please order accordingly.

    1. Activity Stream
    2. Member Profiles
    3. Member Directory
    4. Group Pages
    5. Group Directory
    6. Network
    7. BBPress Forums

    Are you interested in being a beta tester? You will get access to the theme files to use in your own projects in return.

    What customisations would you like built in? Things like custom logos, and colours? That type of thing.

    How many custom navs are required?

    Do you want full WordPress support for posts and pages? Things like post format, post thumnbails and HTML5 when and where possible.

    What about templates, would you like an optional custom front-page?

    Anything else you feel like discussing please do so.

    After the theme gets off the ground I may decide to release it as a premium theme to help pay the bills, but for now I’m looking for an audience to get started with.

    Lastly, I was going to blog about the progress in my site buddycore.com to keep anyone who is interested up to date.

    Thanks for your help.

Viewing 25 results - 226 through 250 (of 838 total)
Skip to toolbar