Search Results for 'private'
-
AuthorSearch Results
-
October 5, 2016 at 5:25 am #259414
In reply to: Buddypress PM Message from Post
danbp
ParticipantHi @koded1999,
please, use the
<code>button to insert snippets. Also avoid double posting.
Closing this topic as duplicate.
Conversation goes ahead here:October 5, 2016 at 3:55 am #259413In reply to: Disable or Hide Private Message Button
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
October 5, 2016 at 3:02 am #259410In reply to: Disable or Hide Private Message Button
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' );October 1, 2016 at 3:58 pm #259313In reply to: Disable BP reg
Ron Ashman
ParticipantHi 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!
September 27, 2016 at 6:02 pm #259175In reply to: Changing visibility in Activity page
Venutius
ModeratorWhat 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.
September 27, 2016 at 6:02 pm #259174In reply to: Changing visibility in Activity page
danbp
ParticipantPlease 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
September 27, 2016 at 4:55 pm #259168In reply to: Group Forum Won’t Stay in Group
danbp
ParticipantHi,
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:
September 23, 2016 at 5:47 am #259053bikerwp000
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' );September 22, 2016 at 10:41 pm #259043In reply to: Adding external links within members pages
danbp
ParticipantHi,
To get the link to a user profile:
$link = bp_get_loggedin_user_link();Many use examples can be found on the forum. Ie:
Is it possible to make Activity and Forum profile tabs private?
September 22, 2016 at 5:21 pm #259033In reply to: Order by custom field in member loop
ositive
ParticipantThank 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' );September 22, 2016 at 4:41 pm #259030In reply to: [Resolved] bp_messages_subject_value
bdollin
ParticipantThanks 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
September 19, 2016 at 5:37 pm #258920Brajesh Singh
ParticipantPlease put this code in your 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' );That should do it. Hoe it helps.
September 18, 2016 at 8:29 pm #258900danbp
ParticipantHere “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_inby!bp_is_my_profile()– this scenario doesn’t need a check for logged in users as it is made bybp_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 !
September 15, 2016 at 4:07 pm #258761In reply to: Error 404 for non logged in users
tizianopitisci
ParticipantI would like to have on my website the same solution of buddydev.com. See this examples please:
BUDDYPRESS: https://buddypress.org/members/tizianopitisci/notifications/
BUDDYDEV: https://buddydev.com/members/tizianopitisci/notifications/In buddydev users:
1. Recive a notification by email with a link inside;
2. Follow the link;
3. Make the log-in;
4. Access the private areaI wuold like to have the same solution. Do you think is possible?
Thanks for your help
TizianoSeptember 15, 2016 at 9:07 am #258742In reply to: Error 404 for non logged in users
tizianopitisci
ParticipantThank you Henry, I’ve just made the following test:
-no plugin exept Buddypress
-defauolt wordpress theme “twenty fifteen”but we still have the issue. The point is that the message private as well as the notification area return a “not found page” message instead a “log-in required” message. I’m running the last buddypress version (italian located website).
Is that a bug?
September 12, 2016 at 4:07 pm #258659In reply to: Error 404 when joining a private group
jaumearagay
ParticipantIt’s a PRIVATE group I talk about, not a HIDDEN one. My fault! π
September 12, 2016 at 9:47 am #258653In reply to: Error 404 when joining a private group
jaumearagay
ParticipantHas anyboby tried this, please?
Can you join a private group either being an admin or not?
Is this a bug or is this something that affects only my install?Thanks for your time! π
September 11, 2016 at 11:01 pm #258638danbp
ParticipantI’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’sTry 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
September 11, 2016 at 12:47 pm #258630In reply to: [Resolved] Error 404 – Page Not Found
danbp
ParticipantHi,
the logout link is redirected to the same page. If you’re on your profile notifications screen, which is only intended for you, it is normal that when you logout from there, you’re redirected to a page not found message. Notifications is even private and not public.
The solution is to redirect to an always public part of the site on logout.
Add this snippet to child-theme’s functions.php
//* Redirect WordPress Logout to Home Page add_action( 'wp_logout', create_function( '', 'wp_redirect( home_url() ); exit();' ) );Advice 1: use preferably the login widget, so the user stays on the same page where he attempt to login instead to be redirected to that boring wp-login page.
Advice 2: on the Home (which is the member directory), you have all BP pages listed at the bottom. Remove them ! You certainly don’t need to give access to account activation or register page to your visitors…
September 11, 2016 at 2:40 am #258619jowyds
Participanthello danbp, thanks for your reply.
I have tried the suggestion to use
define('WP_DEBUG', true);in conjuction withdefine('WP_DEBUG_LOG', true);with a twenty theme. It works fine when buddypress is not activated. No error or logfile whatsover. Then after I tried to activate buddypress, and test again. The media library still cannot load out. I have tried to check for error log and I can’t seems to find any.Nevertheless I found the culprit can be my bp-custom.php in which I put it just under /wp-content/plugins/[here]
if I remove the file and everything seems works fine again with buddypress activated.
This is the content for my bp-custom.php
<?php // hacks and mods will go here /** * Make a site Private, works with/Without BuddyPress * * @author sbrajesh * @global string $pagenow * */ /* function buddydev_private_site() { //first exclude the wp-login.php //register //activate global $pagenow; //do not restrict logged in users if( is_user_logged_in() ) { return ; } //if we are here, the user is not logged in, so let us check for exclusion //we selectively exclude pages from the list //are we on login page? if( $pagenow == 'wp-login.php' ) { return ; } //let us exclude the home page if( is_front_page() ) { return ; } $exclude_pages = array( 'register', 'activate', 'excelportfolio' );//add the slugs here //is it one of the excluded pages, if yes, we just return and don't care if( is_page( $exclude_pages ) ) { return ; } $redirect_url = wp_login_url( site_url('/') );//get login url, wp_safe_redirect( $redirect_url ); exit( 0 ); } */ //add_action( 'template_redirect', 'buddydev_private_site', 0 ); ?> <style type="text/css"> #wp-admin-bar-bp-login { display:none; /* JOWY: hide login link for buddypress. */ } #wp-admin-bar-bp-register { display:none; /* JOWY: hide register link for buddypress. */ } #adminloginform { color: #ffffff; /* JOWY: text color on form. */ } #wpadminbar { opacity: 0.7; /* JOWY: Opacity for wpadminbar. */ } </style>what can possible went wrong?
September 7, 2016 at 7:24 pm #258503In reply to: Error 404 when joining a private group
jaumearagay
ParticipantAm I the only one having this problem?!
Could you make one of your groups private and try to join it to see if you get the same problem, please?
I want to know if the problem is from BP or something in WordPress messing with BP.
Thanks in advance! π
Jaume.
September 5, 2016 at 9:15 am #258376FEARtheMoose
ParticipantI’ve been trying to find a way to make the activity and forum tabs only visible to the logged in user. So for example, if im logged into my profile, i will be able to see/use the activity and forum tabs, however, im the only one who can see them.
I managed to hide the tabs from users using css, but that only works for people who are logged out. Anyone who is logged into their account can still see those tabs due to there not being a specific css class. However, i would much rather a non CSS way of removing them for obvious reasons.
Any help would be much appreciated, as i cant seem to find to much on the topic bar removing it with css.
Cheers
September 1, 2016 at 8:27 pm #258281In reply to: Private Messaging restriction
danbp
ParticipantHi,
you can try to remove the private message button from the template or hide it with CSS.
And add a custom one who leads to admin inbox.The link should look like
http://your-site.com/members/YOU/messages/compose/?r=THE ADMIN&_wpnonce=an_alpha_numeric_valueSee here how you may code this
Codex and Forum are your friends to search about template customization.
September 1, 2016 at 2:41 pm #258256danbp
ParticipantHi !
How could this have happened ?
Are you sure you clicked on private message and not on public message ? Or have you checked the option
This is a notice to all users ?But no worry ! To delete this notice, go to your profile, click on Messages > Notices and delete the message from the list.
August 30, 2016 at 1:54 pm #258187In reply to: Ideas for web services site with users private pages
danbp
ParticipantAccording to your specifications:
1) We would like that user after purchase of one of those services could access to a private page where he can manage what he have purchased.
2) We would like to have freedom to put personalized content on user private pages.
3) We need in particular that a user could use a contact form tu send us extra information on services configuration.
Solution:
1) woocommerce + some page privacy settings
2) wordpress configuration
3) a contact form ?I would say you don’t need BuddyPress for that. Confirmed by your statement:
We donβt need to have interaction between user, like a forum or a social network.Read about BuddyPress.
-
AuthorSearch Results