Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 2,451 through 2,475 (of 3,820 total)
  • @shanebp

    Moderator

    I’m surprised that it works via add_filter.
    The hook is a do_action.
    And – You don’t need the global.
    And – bp_is_page is deprecated.

    function bp_guest_redirect( $name ) {
    
        if( ! is_user_logged_in() ) {
    
            if ( bp_is_activity_component() || bp_is_groups_component() || bp_is_blogs_component() || bp_is_directory() || bp_is_user() ) 
                wp_redirect( get_option('siteurl') . '/wp-login.php/' );
    
        }
    
    }
    add_action( 'get_header', 'bp_guest_redirect', 1, 1 );

    @shanebp

    Moderator

    If you are on the Members page, the search function already supports username.

    What are you trying to do?

    @shanebp

    Moderator

    I ended up duplicating the site

    Good, now you have a dev site.
    Try turning off all plugins except BP and continue using the 2015 theme.
    If the problem persists, then it might be a BP issue.
    If not, turn the other plugins back on one at a time and hopefully find the plugin that is causing the issue.

    @shanebp

    Moderator

    @i-am-anja – I apologize for the fact that you weren’t provided good info on how to access your dashboard.

    You will need to use FTP or if your host provides a File Manager ( maybe thru cpanel ).
    Then navigate to [your site]/wp-content/plugins/buddypress and either delete the buddypress folder or rename to something else, for example ‘buddypressX’.
    Doing so means BP will not be loaded and you should be able to access your dashboard.

    @shanebp

    Moderator

    I am using a custom theme, so it’s possible that is the problem,

    Switch to a WP theme like 2013.
    If the problem goes away, then it’s something in your theme.

    @shanebp

    Moderator

    Members won’t appear in the members loop until they have a last_activity entry.
    Logging in will create that entry.
    Or you can give them one as soon as a member is registered via front or back end:

    function webmister_add_last_activity( $user_id ) {
    
        bp_update_user_last_activity( $user_id, bp_core_current_time() );
    
    }
    add_action ('user_register', 'webmister_add_last_activity', 20, 1);

    Put the function in your theme/functions.php or in bp-custom.php.

    @shanebp

    Moderator

    I would like to have a list of posts with hyperlinks instead of displaying the whole content.

    @alexterchum – his code kindly provides explicit instructions for doing exactly that.
    Did you read them?
    Here is what you need:

    foreach($myposts as $post) {
       setup_postdata( $post );
       echo '<a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a><br/>';			
    }

    @shanebp

    Moderator

    afaik, even site admins and groups admins cannot edit activity stream items on the front-end.
    This will give group moderators the ability to delete activity stream items:

    function majecdad_group_mod_delete( $can_delete, $activity ) {
    	
       if( $activity->component == 'groups' ) {
    	
    	$group_id = $activity->item_id; 
    		
    	if( bp_current_user_can( 'bp_moderate' ) || groups_is_user_mod( bp_loggedin_user_id(), $group_id ) )
    	    $can_delete = true;
    	
       }
    
       return $can_delete;
    }
    add_filter('bp_activity_user_can_delete', 'majecdad_group_mod_delete', 21, 2 );

    @shanebp

    Moderator

    Are you sure you’ve translated this label: Friends <span class="%s">%s</span>

    Did you include this Sources Keyword when creating the translation .mo in poEdit: _x()

    The Friends label is generated by __() and _x(), depending on the context.

    More info re keywords: http://www.cssigniter.com/ignite/wordpress-poedit-translation-secrets/

    In reply to: Bp register page

    @shanebp

    Moderator

    The @ symbol is added in this file:
    buddypress\bp-templates\bp-legacy\buddypress\members\single\member-header.php

    Create a template overload of that file and remove the symbol.

    In reply to: Bp register page

    @shanebp

    Moderator

    It would be helpful to your question to get some terminology sorted.

    Example:

    • username aka login name: jayd94
    • display name: Daniel

    In BP, your profile would show:
    Daniel
    @jayd94

    So the name on the BP ‘side’ of register = display name
    And the name on the WP ‘side’ of register = username aka login name
    Both fields are required.

    Using that info, can you restate your question.

    @shanebp

    Moderator

    Try using this hook fromfunction groups_delete_group in buddypress\bp-groups\bp-groups-functions.php

    do_action( 'groups_before_delete_group', $group_id );

    @shanebp

    Moderator

    Your approach should be okay, but…
    Since you only want member IDs, then only request IDs.
    You can avoid retrieving user objects for each member and then having to extract their ID by doing this:

    function modify_members_loop( $qs=false, $object=false ) {
    
        if ( $object != 'members' )
            return $qs;
    
        $subscribers =  get_users( 'fields=ID&role=subscriber' );
        
        $args['include'] =  $subscribers;
    	
        $qs = build_query($args);
    
        return $qs;
    }
    add_action( 'bp_ajax_querystring' , 'modify_members_loop', 25, 2 );
    In reply to: Unable to Edit Profile

    @shanebp

    Moderator

    So when you go to your profile screen and click ‘Profile > Edit’ you get a blank screen?

    Try to narrow down the potential issues.

    What is the browser url on that screen? Do you see the site header?

    What theme are you using?

    Try switching to a WP theme, like TwentyThirteen.

    Try deactivating your other ‘extensions’.

    @shanebp

    Moderator

    Please use the code button when posting code.

    If I go into the admin panel and select Activities, I can see the same comment, but “View Activity” takes me to the activity panel, were I can see the parent activity and the post successfully.

    As you can see, the url is being rewritten when you click on ‘view activity’.
    You can either figure how the url is being rewritten.
    Or create your own url using the fields from the comment object.
    Something like:
    $url = bp_core_get_userlink( comment[user_id] ) . '/activity/' . comment[comment_ID] . '/';

    bp_core_get_userlink()

    In reply to: Unable to Edit Profile

    @shanebp

    Moderator

    when I click on my profile in the groups setup

    What do you mean by ‘groups setup’ ?

    @shanebp

    Moderator

    Re pagination:
    It’s probably due to my code wiping out the query array and hardcoding page = 1

    There is most likely an easier / better way, but try storing the page in a var before the if( isset conditional:

    $page = $query_args['page'];

    Then put it back into the array in the conditional:

    $query_args['page'] = $page;

    @shanebp

    Moderator

    This is separate from the function I supplied.
    Put it in activity/index.php
    <li id="activity-just-me"> <a id="just-me" href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/'; ?>">Personal</a></li>

    You can also insert the link without using a template overload by using the provided hook:
    do_action( 'bp_activity_type_tabs' );

    @shanebp

    Moderator

    Have you tried using get_comment_link( $post_comment_id ); ?

    @shanebp

    Moderator

    Location data from the Foursquare API isn’t very useful unless you’re only dealing with Foursquare users. The data is way too centric.

    Google Places API is easy to pull in.
    Their documentation is very comprehensive.
    Hook into wp_enqueue_scripts and use wp_register_script and wp_print_script to pull it in.
    Then call it in a template.
    How to get, store and use the Location data is up to you.

    @shanebp

    Moderator

    Where are you getting bp_pre_group_query from?
    You can’t make up hooks :>
    See BP_Groups_Group::get in buddypress\bp-groups\bp-groups-classes.php for more info.

    Try this:

    
    function antares_groups_filter_options() {
        echo '<option value="user-league">User League</option>';
    }
    add_action( 'bp_groups_directory_order_options', 'antares_groups_filter_options' );
    
    function antares_ajax_querystring( $query_string, $object ) {
    
    	if ( 'groups' != $object ) 
    		return $query_string;
    
    	if ( ! bp_is_groups_directory() ) 
    		return $query_string;
    	
    	$query_args = wp_parse_args( $query_string, array() );
    
            $page = $query_args['page'];
    
    	if( isset( $query_args['action'] ) && $query_args['action'] == 'user-league' ) {
    	
    		$query_args = array();
    		$query_args['page'] = $page;
    		$query_args['orderby'] = 'name';		
    		$query_args['order'] = 'ASC';			
    		$query_args['include'] = antares_get_groups(); 
    		$query_string = http_build_query( $query_args );
    
    	}
    
    	return $query_string;
    
    }
    add_filter( 'bp_ajax_querystring', 'antares_ajax_querystring', 32, 2 );
    
    function antares_get_groups() {
    
        // put your custom sql here
        // return a csv string of the groups ids
        // for example '1,22,57'
    
    }

    @shanebp

    Moderator

    Unless you’re specifically using the default theme, you only have to change this file:
    \buddypress\bp-templates\bp-legacy\buddypress\members\register.php

    And the recommended approach is to create a template overload in your theme:

    Theme Compatibility & Template Files

    @shanebp

    Moderator

    This is probably theme related.

    This is the default template:
    \buddypress\bp-templates\bp-legacy\buddypress\groups\groups-loop.php

    You’re using a custom template.
    Take a look at the code generating the links in your groups loop.
    Or there may be a function in your theme that filters bp_group_permalink() or permalinks in general.

    @shanebp

    Moderator

    The email requirement is a WP requirement.

    There are various code snippets and plugins to get around this requirement – whether creating users only thru the Dashboard or through open registration:

    https://www.google.com/?gws_rd=ssl#q=wordpress+registration+email+optional

    @shanebp

    Moderator

    You want to add a ‘Personal’ option to the ‘Show’ selector on Site Wide Activity?

    Try this in your theme/functions.php or in bp-custom.php

    function leanne_activity_filter_options() {
        if ( is_user_logged_in() )
             echo '<option value="personal">Personal</option>';
    }
    add_action( 'bp_activity_filter_options', 'leanne_activity_filter_options' );
    
    function leanne_ajax_querystring( $query_string, $object ) {
    
    	if ( 'activity' != $object ) 
    		return $query_string;
    
    	if ( ! bp_is_activity_directory() ) 
    		return $query_string;
    
    	$query_args = wp_parse_args( $query_string, array() );
    
     	$page = $query_args['page'];
    
    	if( isset( $query_args['action'] ) && $query_args['action'] == 'personal' ) {
    	
    		$query_args = array();
    		$query_args['page'] = $page;
    		$query_args['user_id'] = bp_loggedin_user_id();
    		$query_string = http_build_query( $query_args );
    
    	}
    	
    	return $query_string;
    
    }
    add_filter( 'bp_ajax_querystring', 'leanne_ajax_querystring', 20, 2 );
Viewing 25 replies - 2,451 through 2,475 (of 3,820 total)
Skip to toolbar