Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'private'

Viewing 25 results - 651 through 675 (of 3,490 total)
  • Author
    Search Results
  • #260564
    Md Sadiqur Rahman
    Participant

    I tried the trick but comes with some critical problems. https://buddypress.org/support/topic/subject-field-in-private-messages/

    This problem’s been discussed for more than 4 years. (https://buddypress.org/support/topic/cant-send-a-message-without-a-subject/)

    I thought it might have been solved. Anyway, thank you so much for your kind reply. Have a nice day 🙂

    #260544

    In reply to: menu link member list

    reivilob
    Participant

    I absolutely agree with you but it make sense to allow access to the member list only for login users and to be able to easily place it in a menu, at the position you want and this is not possible now …

    If you select it from the page list, you can not specify if user must be login to have it in a menu (genera menu or personal)

    It is not available in the buddypress login section. Here are only user related informations, but no resources reserved for buddypress login users, like private pages or others private features …

    I think the only way to process is to create (php) a menu menu for the login user, and create a menu that concatenate the basic menu with this one and display the result…

    OB

    jenfilgate
    Participant

    1. Which version of WordPress are you running? 4.6.1

    2. Did you install WordPress as a directory or subdomain install? directory

    3. If a directory install, is it in root or in a subdirectory? root

    4. Did you upgrade from a previous version of WordPress? If so, from which version? yes 4.6.0

    5. Was WordPress functioning properly before installing/upgrading BuddyPress (BP)? e.g. permalinks, creating a new post, commenting. yes

    6. Which version of BP are you running? 2.7.0

    7. Did you upgraded from a previous version of BP? If so, from which version? 2.6.2

    8. Do you have any plugins other than BuddyPress installed and activated? If so, which ones?

    – AsynCRONous bbPress Subscriptions
    – BackWPup
    – BAW Login/Logout menu
    – bbP private groups
    – bbPress
    – bbPress auto subscribe for new topics and replies
    – BP Direct Menus
    – BuddyPress
    – BuddyPress for LearnDash
    – BuddyPress NoCaptcha Register Box
    – Cloudflare
    – CodeStyling Localization
    – Contact Form 7
    – Content Aware Sidebars
    – Custom Post Type Page Template
    – Draw Attention
    – Gallery Carousel Without JetPack
    – Google XML Sitemaps
    – LearnDash & BBPress Integration
    – LearnDash – Gradebook
    – LearnDash Content Cloner
    – LearnDash LMS
    – LearnDash Pro Panel
    – LearnDash WooCommerce Integration
    – Livemesh SiteOrigin Widgets
    – MailChimp for WordPress
    – Members page only for logged in users
    – Page Builder by SiteOrigin
    – Post Types Order
    – Postman SMTP
    – Prevent Content Theft Lite
    – Revolution Slider
    – Simple User Profile
    – SiteOrigin Widgets Bundle
    – Slideshow
    – Slim Stat Analytics
    – The Events Calendar
    – Theme My Login
    – Ultimate Posts Widget
    – User Login Log
    – W3 Total Cache
    – Widget Importer & Exporter
    – WooCommerce
    – WooCommerce MailChimp
    – WordPress Importer
    – WP Better Emails
    – WP Smush

    9. Are you using the standard WordPress theme or customized theme? customized

    10. Which theme do you use ? Invent

    11. Have you modified the core files in any way? no

    12. Do you have any custom functions in bp-custom.php? no

    13. If running bbPress, which version? Or did your BuddyPress install come with a copy of bbPress built-in? 2.5.10

    14. Please provide a list of any errors in your server’s log files. none

    15. Which company provides your hosting? InMotion Hosting

    16. Is your server running Windows, or if Linux; Apache, nginx or something else? Apache

    I did the tests you recommended and it was my W3 Total Cache plugin that was causing the issue. I will have to look into that to figure out what setting was messing it up. @Scaffies doesn’t have that plugin, so guess our issues were caused by different things.

    ico33
    Participant

    Nothing to do!

    Error:

    Parse error: syntax error, unexpected ‘function’ (T_FUNCTION) in /home/mondolap/public_html/wp-content/plugins/bp-custom.php on line 3

    This is the bp-custom code:

    <? php

    function buddydev_hide_members_directory_from_all_except_admin() {

    if ( bp_is_members_directory() && ! is_super_admin() ) {
    //should we add a message too?
    //bp_core_add_message( ‘Private page.’, ‘error’ );
    bp_core_redirect( site_url(‘/’) );
    }
    }
    add_action( ‘bp_template_redirect’, ‘buddydev_hide_members_directory_from_all_except_admin’ );

    danbp
    Participant

    The function is working correctly on my install.

    Perhaps you have an issue with quotes, ie after copy/pasting the snippet from a topic where the code whas inserted without using the code button.
    Which software do you use to publish bp-custom ?

    Copy/paste following and give a try:

    function buddydev_hide_members_directory_from_all_except_admin() {
    
    if ( bp_is_members_directory() && ! is_super_admin() ) {
    //should we add a message too?
    //bp_core_add_message( 'Private page.', 'error' );
    bp_core_redirect( site_url('/') );
    }
    }
    add_action( 'bp_template_redirect', 'buddydev_hide_members_directory_from_all_except_admin' );
    ico33
    Participant

    Thanks! I did it with your suggest, so the file is

    
    <? php
    function buddydev_hide_members_directory_from_all_except_admin() {
    
        if ( bp_is_members_directory() && ! is_super_admin() ) {
            //should we add a message too?
            //bp_core_add_message( 'Private page.', 'error' );
            bp_core_redirect( site_url('/') );
        }
    }
    add_action( 'bp_template_redirect', 'buddydev_hide_members_directory_from_all_except_admin' );


    But every page of the website is now again a blank page with this error:

    Parse error: syntax error, unexpected ‘function’ (T_FUNCTION) in /home/mondolap/public_html/wp-content/plugins/bp-custom.php on line 2

    ico33
    Participant

    @sbrajesh

    Hello and thanks for the support, I tried the solution suggested, but after I created and then uploaded the file bp-custom in the plugins folder I got an error in every page of the website:

    Parse error: syntax error, unexpected ‘function’ (T_FUNCTION) in /home/mondolap/public_html/wp-content/plugins/bp-custom.php on line 2

    This is my file bp-custom:

    <? php
    function buddydev_hide_members_directory_from_all_except_admin() {
    
        if ( bp_is_members_directory() && ! is_super_admin() ) {
            //should we add a message too?
            //bp_core_add_message( 'Private page.', 'error' );
            bp_core_redirect( site_url('/') );
        }
    }
    add_action( 'bp_template_redirect', 'buddydev_hide_members_directory_from_all_except_admin' );
    ?>
    #260335
    livingflame
    Participant

    https://la.wordpress.org/plugins/buddypress-private-message-for-friends-only/

    Okey, very very partial solution.

    Really solution: BuddyDev Message Privacy BUT native!

    #260067
    livingflame
    Participant

    Links Public. Please do not delete!

    Bp links Menu with notify.
    https://goo.gl/photos/X8wMQzUUAfVLD34o8

    Search Activities by Date –> https://goo.gl/photos/pG9KHUMdybAetBNF9

    Message or Notifications Template. https://goo.gl/photos/ngAmNCHyRCWyd9fLA

    Buddypress.org has some template like this for Notifications.

    Feature #17. Private Messages for Friends Only but, Optional from User Menu.
    With rtMedia plugin you can put your Posts or Photos: Only Me, Only Logged Users, Only Friends, Public. But, rtMedia does not work for Messages.

    #259994

    In reply to: Login page

    Venutius
    Moderator

    https://wordpress.org/plugins/bp-simple-private/

    This makes it so the only page you can view is the homepage, then make sure all you can see on the homepage is the login button? Either that or modify the above plugin so that it redirects to the login page.

    #259824
    bcanr2d2
    Participant

    My install has stopped sending any emails out for new user activation.
    I can receive emails sent by WordPress after a user is manually activated, and can receive any email from Postman SMTP, as these test emails work.

    I don’t use any other activity markers, but emails were not received when messages were sent either.

    I have tried all of the listed troubleshooting steps that others have gone through before.

    I have a custom function that creates a post for the user during the registration process. I have removed all custom functions and tried registering a user, and it still will not send any emails.

    As BuddyPress uses it’s own PHP Mailer, I am not able to log them via any WP Mail logging tools, and want to see what might be going on here.
    The problem reared its head around the time I upgraded to 2.6 (although the custom function during registration was also added at this time) as well

    I have reset the emails multiple times, and I have not made any changes to them.

    Could someone please provide assistance, or given me a suggestion on how to run the BP Email Debug code to get an email of any issues

    Host is Bluehost

    Here is my install, and plugin list

    WordPress 4.5.4
    BuddyPress 2.6.2
    Advanced Custom Fields 4.4.10
    Akismet 3.1.11 (inactive)
    BackWPuP 3.3.4
    BP Force Profile Photo 1.0.5
    BP Member Type Manager 1.0.1 (inactive)
    BP xProfile Location 1.2
    BP XProfile WordPress User Sync 0.6.4
    Broken Link Checker 1.11.2
    Buddy Progress Bar 1.0.2
    BuddyPress Conditional Field Groups 0.1.0
    Buddypress Conditional Profile Field 2.0
    Buddypress Geodirectory Integration 1.0.0 (inactive)
    BuddyPress Member Type Generator 1.0.2
    BuddyPress Profile Tabs 1.6.1
    BuddyPress Security Check 2.1.2
    BuddyPress Simple Terms And Conditions 1.3
    BuddyPress Xprofile Custom Fields Type 2.5
    BuddyPress Xprofile Member Type Field 1.0.4
    Cherry Parallax Plugin 1.0.0 (for my theme)
    Cherry Plugin 1.2.8.1 (for my theme)
    Conditional Profile Fields for BuddyPress 1.1.9
    Contact Form 7 4.5
    Contact Form 7 – Dynamic Text Extension 2.0.1
    Custom Hooks 1.0 (All my custom functions are in this plugin)
    Custom Login 3.2.5
    Custom Post Template By Templatic 1.0
    Custom Post Type UI 1.4.1
    Disable Comments 1.5.2
    Display Posts Shortcode 2.7.0
    Easy Parallax Slider 2.1.1
    FacetWP 2.6.4
    GEO my WP 2.6.6.1
    GeoDirectory 1.6.5 (inactive)
    Hello Dolly .1.6 (inactive)
    MOJO Marketplace 1.0.1 (inactive)
    MotoPress Content Editor Lite 1.6.5 (inactive)
    Quick and Easy FAQs 1.0.3
    SuitePlugins – Advanced XProfile Fields for BuddyPress 1.0.3
    Super Socializer 7.8.1
    WP Private Content Plus 1.11
    WPFront User Role Editor 2.12.4
    Yoast SEO 3.5

    danbp
    Participant

    This topic is titled “Function to hide private message depending of user role”.

    and the snippet does that ! Subscribers have no access to the button. So far i remember it is also the default role in WordPress. You change that to your need.

    The first condition in the snippet allows some users (by ID) to access the button, whatever their role.

    If you want to add other WP roles, you simply copy the 2nd conditionnal if(role=='') and add another role if(role=='mamamouchi") { //do something }.

    Or you use only the user ID if you have only a few members allowed to access. I litle understanding of php is of course a + to do that.
    You have the basics in the snippet. Now, it’s to you now to make it work for your need.

    Raphael.v
    Participant

    Thank you @danbp, this work ! I’m pretty sure this will help a lot (and not only me).

    I’am asking something more : can this be adapt to allow only some user role to use private message ? (and not only some users ?) As the second part of the code you wrote, it remove the button to susbscriber.

    (I’m learning PHP, I’ve tried to change the code but did not succeed to have it work…)

    danbp
    Participant

    Hi,

    try this (goes to bp-custom.php)

    function bpex_remove_private_message_button( $button ) {
    $user = bp_loggedin_user_id();
    
        if ( $user == '4' || $user == '7' || $user == '25'  ) { // the allowed user ID's
    	 return $button;
    	}
    
    	if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
    
    		if ( $role == 'subscriber') {
    			$button = '';
    		}
    	}
    }
    add_filter( 'bp_get_send_message_button', 'bpex_remove_private_message_button', 1 , 1 );

    No idea how to get specifically a pmpro defined user ID – you have to check their doc to adjust the above snippet. Note that it works on a standart install – without pmpro.

    #259414
    danbp
    Participant

    Hi @koded1999,

    please, use the <code> button to insert snippets. Also avoid double posting.
    Closing this topic as duplicate.
    Conversation goes ahead here:

    Disable or Hide Private Message Button

    #259413
    koded1999
    Participant

    @henrywright i managed to fix that and is working perfectly.

    but i have another problem.

    i will like to populate the subject automatically when user click the private message button from post

    pls how can i achieve this.

    thank you

    #259410
    koded1999
    Participant

    @henrywright Please i will like to add private message button in post side bar. i used the code below it works but doesnt populate the author automatically. how can i fix this thanks in advance.

    function bpfr_message_shortcode() {	
    $author = get_the_author();
    $message = 'Login to contact advertiser!';
    
    if( is_user_logged_in() ) {
    	return '<a>MESSAGE ADVERTISER</a>';
     } else {
        return $message;
     }
    } 
    add_shortcode( 'ksam', 'bpfr_message_shortcode' );
    #259313

    In reply to: Disable BP reg

    Ron Ashman
    Participant

    Hi Henry,

    Wow I didn’t expect an answer so quickly. Thanks!

    I wouldn’t feel comfortable opening a ticket because my understanding of developing is quite basic, and this is a free plugin so I’d feel greedy asking for things or “complaining”.

    Would you please tell me if it might cause any trouble if I leave those pages set as blank? I don’t mind the warning or might find a way to hide it.

    I tried setting private pages or assign a password, but they don’t show in the list or even if they’re password protected they still show the content (registration form).

    Disabling registration through BP would be the best option for me, I think.

    Thanks again, have a great day!

    #259175
    Venutius
    Moderator

    What you can do is hide that menu option option from non-logged in users. To do this, you need to install the WPFront User Role Editor plugin and it gives the the ability to choose who can see each menu option. It’s quick and dirty but also easy. Obviously is any not logged in user knows the address of the activity page they can still see it, but you could also set that page to private.

    #259174
    danbp
    Participant

    Please note that you don’t need to add your site url in each of your topic. It’s useless and considered as a bad practice when nobody asked specifically for it.

    About privacy, read here

    Making a WordPress & BuddyPress Site Private, the Right Way

    #259168
    danbp
    Participant

    Hi,

    Which group menu are you talking about ?
    How do you add the link ? And why ? Because, you haven’t to do that on a standard MS install, even for private groups. Sorry, but this point is a bit unclear.

    Review your forum settings:

    Installing Group and Sitewide Forums

    Group Settings and Roles

    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' );
    
    
    #259043
    danbp
    Participant

    Hi,

    To get the link to a user profile:
    $link = bp_get_loggedin_user_link();

    Many use examples can be found on the forum. Ie:

    [Resolved] BuddyPress Links URLs

    Is it possible to make Activity and Forum profile tabs private?

    #259033
    ositive
    Participant

    Thank you Shanebp
    I tried the following steps (below is the final code):
    -I started from the basic random code
    -I introduced the function to create and pass #sql (like Ninja Warrior trick code)
    but it seems not working.. Can you help me please (I’m really trying everithing..)?
    Thanks

    <?php
     
    // Exit if accessed directly
    if ( !defined( 'ABSPATH' ) ) exit;
     
    class BP_Loop_Filters {
     
        
        public function __construct() {
            $this->setup_actions();
        }
     
        private function setup_actions() {
            /**
             * Adds the Rating order to the select boxes of the Members directory pages
             */
            // Members component is core, so it will be available
            add_action( 'bp_members_directory_order_options', array( $this, 'rating_order' ) );
     
        }
     
        public function rating_order() {
           
    	global $wpdb;
    
    	$sql = "SELECT
                     a.ID as id, a.user_nicename 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";
        var_dump( $sql );
    
    	return $sql;
    
        }
     
    }
     
    function bp_loop_filters() {
        return new BP_Loop_Filters();
    }
     
    add_action( 'bp_include', 'bp_loop_filters' );
    #259030
    bdollin
    Participant

    Thanks but I should be more specific. I want to show a default subject field in a private message that the user is composing. I want to avoid changing the core compose.php and use an add_filter instead if possible

    http://mywebsite.com/profiles/username/messages/compose/?r=recipientname&_wpnonce=a4a33412e1

    It would be easy if we could add something like subject=”message’ but not possible

Viewing 25 results - 651 through 675 (of 3,490 total)
Skip to toolbar