Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 3,651 through 3,675 (of 3,787 total)
  • @danbp

    Participant

    @wpleo,

    i checked the buddypress-pt_BR.po/mo. Sitewide Activity is correctly translated.
    I also added all gettext filters to the po, as mentionned by @shanebp
    without any result.
    I also tested with mesocolumn theme and magazine theme, with no result.

    The only solution for the moment is to change the original code to the old style way of translating a string ( __(”,”) )

    the string is in bp-activity-loader.php:109

    Change
    ‘directory_title’ => _x( ‘Sitewide Activity’, ‘component directory title’, ‘buddypress’ ),
    to
    ‘directory_title’ => __( ‘Sitewide Activity’, ‘buddypress’ ),

    will resolve the problem.

    @danbp

    Participant

    @danbp

    Participant

    @danbp

    Participant

    hi @escudero95

    here are 2 function you can use for do what you need. The first add Happy birthday on the Toolbar, near the Howdy.

    The second will add the same thing on the profile header, above @username at the right of the avatar.

    These function can be used from within bp-custom.php or theme’s functions.php

    You have to create a date type profile field and set it to be viewed by friends only.

    Naturally this is intended to be an example of use. It’s certainly perfectible. Also take care of the different comments inside the code. Have fun !

    
    function bpfr_happybirthday( $wp_admin_bar ) {
    	global $bp;
    	
    	// if user is not logged in, we show nothing
    	if ( !is_user_logged_in() )
    	return false;
    	
    	// is xprofile component active ?
    	if ( bp_is_active( 'xprofile' ) )	
    		   // fetch the birthdate
    		   // as the function should work outside of the profile loop, we first need the user_id
    		$user_id = bp_get_activity_user_id();
    			
    			// now we get the birthdate and our text to show (text | username). 53 is the field id.
    			// depending your theme, this may be adjusted by css as it goes probably on two lines
    		$birthdate = xprofile_get_field_data('53', $user_id ) ? __( 'Happy Birthday ' ) . bp_core_get_username( bp_displayed_user_id() ) : '';	
    		
    		// building the output and adding some css	 
    		$user_id = bp_displayed_user_id();
    
    		// condition for the greating on the toolbar
    		if (!is_user_logged_in( $user_id ) ) { 		
    		
    		$my_title = '<span style="float: left; width: 16px;	height: 16px; margin: 5px 5px 0 -1px; display: block; background-color: green; border-radius: 16px;"></span> '.$birthdate.' ';
    		
    			$args = array(
    			'parent'    => 'top-secondary', // position
    			'id'		=> 'birthday_item', // unique identifier
    			'title' 	=> $my_title, // the name who appears on the bar
    			);
    		
    	
    			$wp_admin_bar->add_node($args);
    		}
    	
    }
    add_action( 'admin_bar_menu', 'bpfr_happybirthday', 90 );
    
    function bpfr_happybirthday2u() {
    	global $bp;
    	
    	// if user is not logged in, we show nothing
    	if ( !is_user_logged_in() )
    	return false;
    	
    	if( bp_is_user() && ! bp_get_member_user_id() ) {
            $user_id = 'displayed: '. bp_displayed_user_id();
        } else {
            $user_id = 'get_member_user: '. bp_get_member_user_id();
        }
    	
    	// is xprofile components active ?
    	if ( bp_is_active( 'xprofile' ) )
    	
    	// fetch the birthdate
    	// as the function should work outside of the profile loop, we first need the user_id
    	$user_id = bp_get_activity_user_id();
    	
    	// now we get the birthdate and our text to show (text | username). 53 is the field id.
    	// depending your theme, this may be adjusted by css as it goes probably on two lines
    	$birthdate = xprofile_get_field_data('53', $user_id ) ? __( 'Happy Birthday ' ) . bp_core_get_username( bp_displayed_user_id() ) : '';	
    	
    	// building the output and adding some css
    	$my_title = '<div style="margin: 5px 5px 20px 5px; border:1px solid red; min-height:18px;"><div style="float: left; width: 16px; height: 16px; margin: 5px 5px 0 -1px; display: block; background-color: green; border-radius: 16px;"></div> '.$birthdate.' </div>';
    	
    	echo $birthdate;	
    	
    }
    add_action( 'bp_before_member_header_meta', 'bpfr_happybirthday2u' );

    Codex references:
    https://codex.wordpress.org/Class_Reference/WP_Admin_Bar

    Developer Resources

    Playing with the toolbar (in french but code is in english)
    http://www.geekpress.fr/wordpress/tutoriel/modifier-howdy-admin-bar-1102/

    @danbp

    Participant

    Both mentionned files are in /buddypress/bp-activity/

    The SWA shows anything happening on the site. By default, each related site event shows the user avatar, the user name, the action and the date/time and all are clickable and lead to the action or to the profile. Adding a mention handle to this is overcomplicated and completely useless i guess.

    If someone post or comment on a blog, you’ll see it on the activity screens (profile and/or SWA) and you can comment the activity directly or leave a comment on the post page.

    Mentions are used to quote people or to call or messaging them, and not exactly intended to be shortcuts to make things faster. IRL you go to the post office to send a letter. On BP you go on a profile to talk with a user.

    And at least, BuddyPress is not Twitter. Think BuddyPress. πŸ˜‰

    @danbp

    Participant

    Because it’s not necessary to mention users everywhere probably !
    Mention is an activity, usernames are not.
    Read bp-activity-filters.php/bp-activity-functions.php to understand the “why”. πŸ˜‰

    In reply to: Member Page Tabs

    @danbp

    Participant

    hi @joeyaberle,

    you have 2 options: 1) hardcoding the template file or 2) add the tab with a function to a placeholder.

    1) make a copy of buddypress/bp-templates/bp-legacy/buddypress/members/index.php and add it into your child-theme (see codex on how to do that) and add the html you want at line 24, after the endif;

    2) this function will add My Tab on the members directory nav bar, beside All members | My Friends | My Tab. Add it into your theme’s functions.php or bp-custom.php

    function bpfr_my_directory_setup_nav() {
    	echo'<li><a href="http://example.com/wp-content/themes/mychild/my_extra_page.php">My Tab</a></li>'; // link to what you want
    }
    add_action( 'bp_members_directory_member_types', 'bpfr_my_directory_setup_nav' );

    my_extra_page.php is a file that doesn’t exist. You have to create it first. This file should content at least:

    <div id="buddypress">
    <div id="members-dir-list" class="members dir-list">
    			<?php your stuff here....  ?>
    		</div><!-- #members-dir-list -->
    </div><!-- #buddypress -->

    Placeholder reference:
    buddypress/bp-templates/bp-legacy/buddypress/members/index.php:25
    More on the Codex:
    https://codex.buddypress.org/component/members/

    @danbp

    Participant

    @mercime awesome: ? πŸ˜€ tsss tsss tsss 😳

    @danbp

    Participant

    hi @envieme,

    is there a simple way I can achieve this hacking the wordpress code?

    NO !
    But you can check this plugin: http://urbangiraffe.com/plugins/headspace2/

    @danbp

    Participant

    @danbp

    Participant

    @danbp

    Participant

    @hatherley

    “why” is sometimes a complex question… in your case i think, ajax handling of comment and topic ID’s. FYI you probably have to search on Trac for some devs point of views about “replies” or “group activity”.

    For example (but not direct answers)
    https://buddypress.trac.wordpress.org/ticket/5014#comment:3
    https://buddypress.trac.wordpress.org/ticket/2587
    etc

    @danbp

    Participant

    Hi @cronhound,
    perhaps consider this plugin: http://buddydev.com/plugins/bp-limit-members-per-group/
    or if you’re confortable with PHP study this old plugin: https://wordpress.org/plugins/buddypress-restrict-group-creation/

    @danbp

    Participant

    @antimuffin
    you should be more specific please.
    Where do you try to add your link ? On admin ? On profile field settings ? where should the link be at least ?
    And also BP & WP version, theme name…. Thx

    @danbp

    Participant

    Generally after adding some custom code and getting a blank page afterward is due to a PHP error. So before saying it’s not working (and it is), you have to check attentively what you did. A missing semi-colon, apostrophe, etc….

    @danbp

    Participant

    Reference file: buddypress/bp-activity/bp-activity-filters.php
    How to remove @mention from updates, forum posts, etc

    When searching (and/or tweaking) code in BuddyPress, use a text editor like Notepad++. This editor provide also a robust search tool. It’s much faster to work with the right tool as to wait for a response on a forum…. πŸ˜‰

    @danbp

    Participant

    @danbp

    Participant

    hi @dio1987,

    give this a try. Component name will be removed only when you’re on a profile

    
    function my_profiles_wp_title( $title ='', $sep = '', $seplocation = '' ) {
    	if( bp_get_displayed_user_fullname() ) {
    		$bp = buddypress();
    		
    		// Get the component's ID to try and get it's name
    		$component_id = $component_name = bp_current_component();
    		
    		// Use the actual component name
    		if ( !empty( $bp->{$component_id}->name ) ) {
    			$component_name = $bp->{$component_id}->name;
    			
    			// Fall back on the component ID (probably same as current_component)
    		} elseif ( !empty( $bp->{$component_id}->id ) ) {
    			$component_name = $bp->{$component_id}->id;
    		}
    		
    		$title = str_replace( ucwords( $component_name ), '', $title );
    	}  
    	return $title;
    }
    add_filter( 'bp_modify_page_title', 'my_profiles_wp_title', 20, 3 );

    @danbp

    Participant

    Give this a try !

    function embed_my_register_video() {
    	echo wp_oembed_get( 'http://www.youtube.com/watch?v=dQw4w9WgXcQ', array( 
        'width'  => 600,
        'height' => 400
    	) );
    		
    }
    add_action( 'bp_before_register_page', 'embed_my_register_video' );

    Function reference
    File reference

    @danbp

    Participant

    I use this function and it works.

    Perhaps try to modify the field view of group id 2,in the profile setting. View for members only and set them also so that members cannot change the view.

    Have you also applied the patch given in the ticket ?

    @danbp

    Participant

    The add friend button contains an ajaxified url, a cookie, a nonce and some other stuff. By default, this button is intended to be on members directory and on the profile header.
    Open /bp-friends/firends-widget.js to see how BP actually handle this.

    If you absolutely need to have this button elsewhere, a custom page for example, you need to extend the original class witch is in bp-xprofile-loader.php:38 (BP 2.0.1)

    Otherwise, any action on this added button will always return to the member profile page after a click and not reload like it does when in the member directory.

    I’m not a developper so i can’t help you more.
    Perhaps read here for better understanding of this button.

    File reference

    @danbp

    Participant

    Good idea but not yet implemented. But hopefully in 2.1 … Read this ticket

    @danbp

    Participant

    Maybe read here, the post and all the comments:

    Fetching and Showing only Specific fields from BuddyPress XProfile data

    @danbp

    Participant

    Since BP 2.0, you can use bp_parse_args to customise template loops and on a much easier way as never before.

    The example function below will hide profile groups with ID 1 and profile fields IDs 6, 18 & 39 on the public profile screen of each member and stay visible on the edit screen. Tested & approved 2.0.1

    If you get some php warning while using this function, be aware that there is a bug in 2.0.1 bp-xprofile-classes.php (fixed. See ticket). Simply apply the lattest patch to get rid of this error.

    function flegmatiq_profiles( $retval ) {	
       // conditionnals to set accordingly to your purpose
    	if( !is_user_logged_in()  && !bp_is_profile_edit() ) { 
    		$retval['exclude_groups'] = '2';	
    		$retval['exclude_fields'] = '6,18,39';	
    		
    	} 
    	return $retval;
    	
    }
    add_filter( 'bp_after_has_profile_parse_args', 'flegmatiq_profiles' );

    In your particular case, you have to play with the conditionnals

    The example below is to give you an idea how to handle this. Not tested !

    function flegmatiq_profiles( $retval ) {
    $myfield = xprofile_get_field_data( 'Faculty', $user_id );
    if( empty( $myfield ) )
    return; // or echo
    
       if( $myfield == "Faculty" ) 
          if( bp_is_profile_edit() ) { 
    		$retval['exclude_groups'] = '1,56';	
    		$retval['exclude_fields'] = '6,18,39';	.
          }
       if $myfield == "field_name_2";
         // do something other...
    
    return $myfield;
    
    add_filter( 'bp_after_has_profile_parse_args', 'flegmatiq_profiles' );

    @danbp

    Participant

    Yes, I did search before asking, but this 2 string are so hard to match in the search results.

    The problem is not the strings, but the translation of them. And this is most probably a theme issue or a wrong path to BP’s translation.
    You can check this point by activating one of WP’s default template. If it’s translated, you know the culprit.

    It might just be that the theme author needs to update the theme to be compatible with the latest WP and BP versions. As we have no access to the premium theme, best place to ask is the theme’s support forums or contact theme author.

    If you’re comfortable with code, here’s a workaround. Be aware that this does not solve the problem, but only ignore it.

Viewing 25 replies - 3,651 through 3,675 (of 3,787 total)
Skip to toolbar