Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 1 through 25 (of 33 total)
  • @maelga

    Participant

    Thanks @henrywright

    What’s the difference with calling global $bp?
    I guess if you’re advising the above, this might be performance related.

    @maelga

    Participant

    Thanks @henrywright. No luck with the above.

    I got it working with this:

    global $bp;
    echo $bp->bp_nav['foo']['link'];

    from the $bp doc https://codex.buddypress.org/developer/the-bp-global/

    I am now wondering whether there is already a function defined for this.
    Just like bp_loggedin_user_domain() works instead of global $bp; echo $bp->loggedin_user->domain;

    @maelga

    Participant

    Thanks @henrywright
    Defining the slug with bp_core_new_nav_item() is not an issue.

    How can i get the slug to be echoed dynamically?
    I’m currently using echo bp_loggedin_user_domain(). '/mynavslug/'; to show the hyperlink in my theme files but i don’ t want the slug to be hardcoded.
    Maybe something like this echo $bp->bp_nav[]['link']?

    @maelga

    Participant

    Thanks @shanebp

    @maelga

    Participant

    I was unable to post the functions in my above post.
    They can be found here: http://pastebin.com/kiEP6cmR

    @maelga

    Participant

    What is the 'my-custom-js' in your script?

    From WP codex it’s the $handle var <?php wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); ?>

    Not sure what it is supposed to be.
    It does not seem to relate to anything in your above js.

    @maelga

    Participant

    Thanks @henrywright

    Where is the best place to put this script?
    single/member-header.php
    ?

    @maelga

    Participant

    Thanks @henrywright.

    The order of the variables should read $ud->user_login, $sender_name, $subject, $content, $message_link

    @maelga

    Participant

    How can I add “Dear username” at the beginning of the email message?

    I have tried adding $user_id to the function with ` $user = get_userdata( $user_id );
    ‘Dear ‘ . $user->user_login . ‘,`
    but it does not return any value.

    Any idea?

    @maelga

    Participant

    Yep, I mean your Community Stats plugin because I only need backend stats.

    Different site, different needs I guess.
    I do neither use the Friends component nor the Activity Streams one.
    Posting of multiple custom post types and messaging are the 2 main activities, so this data is critical to me.

    There are indeed plenty of plugins to report author/CPT stats but I yet have to come across one that tracks BP Messages.
    If you are aware of one, please let me know. 😉

    @maelga

    Participant

    Thanks @danbp.

    Could you add messages stats in a future release?
    Messaging is the heart of my BP install and I currently have no idea how much activity is ongoing.

    Not yet available on WP repo and already a feature request 😉

    @maelga

    Participant

    @maelga

    Participant

    I’ll be curious to hear from developers who successfully set up Object Cache with Buddypress, especially using W3 Total Cache.

    Anyone?

    @maelga

    Participant

    bump 🙂

    @maelga

    Participant

    Thanks @shanebp for these clarifications.

    So I understand Site Tracking is some kind of “sub-component” of Activity Stream.
    If Activity Stream is disabled, enabling Site Tracking is useless.

    @maelga

    Participant

    +1

    I only found this old thread but with broken links unfortunately: https://buddypress.org/support/topic/member-profile-url-with-user-id-instead-of-username/

    So any input would be appreciated.

    @maelga

    Participant

    That’s clever. Thanks @shanebp

    @maelga

    Participant

    Hi @shanebp, would you have any input for this?

    @maelga

    Participant

    Yes, a few other profile groups should be visible and editable.

    So I guess hiding the whole group 1 requires a redirect to another group id.
    I have seen (very) old topics on this and tried some code but it does not seem to work with newer BP versions.

    Appreciate your help 🙂

    @maelga

    Participant

    Do you guys have any snippet to display the xprofile fields ID in admin?
    The lesser I go to my db, the happier I am! 🙂

    @maelga

    Participant

    Thanks @shanebp.
    bp_core_activated_user does a better job than user_register
    It works with some additional {} as follows:

    function set_default_group( $user_id ) {
    
            if ( empty( $user_id ) ) {
    		return;
            }
    	$accounttype  = xprofile_get_field_data( 'I am a', $user_id );
    
    	if ($accounttype  == 'Student') {
    		groups_join_group( 1, $user_id );
    	}	
    	elseif ($accounttype  == 'Teacher') {
    		groups_join_group( 2, $user_id );
    	}
    }
    add_action( 'bp_core_activated_user', 'set_default_group', 11, 1 ); 
    

    May I ask what’s the purpose of

         if ( empty( $user_id ) ) {
    		return;
    		}
    

    ?

    @maelga

    Participant

    I have tested the groups_join_group function and it works now. Thanks @shanebp

    However, the IF loop does not.

    function set_default_group( $user_id ) {
    	$accounttype  = get_user_meta( $user_id, 'I am a', true );
    	if ($accounttype  == 'Student'){
    		groups_join_group( 1, $user_id );
    	}
    	elseif ($accounttype  == 'Teacher'){
    		groups_join_group( 2, $user_id );
    	}
    }
    add_action( 'user_register', 'set_default_group', 10, 1 ); 
    

    I have also tried @imath’s gist… It works well as-is for all new registered members to auto join selected groups.
    But I need new members to join only specific groups based on the ‘I am a’ field (Student/Teacher).
    So unfortunately the gist doesn’t help if I can’t even get my IF loop to work 🙁

    It seems to be an issue with get_user_meta.
    I have tried $accounttype = xprofile_get_field_data( 'I am a', $user_id ); instead of $accounttype = get_user_meta( $user_id, 'I am a', true ); but none of them work.

    My field ‘I am a’ is part of the Primary Field Group (also shown on the registration form) and has only ‘Student’ and ‘Teacher’ as options.

    Any idea what goes wrong?

    @maelga

    Participant

    If I were to create 2 or more tabs, what would be the best way to achieve this?
    I’ve been playing with the above code for some time without much success…

    @maelga

    Participant

    From function.php

    Thanks again @shanebp

    @maelga

    Participant

    Thanks @shanebp.
    It only works if I remove the function triggered at bp_loaded, as follows:

    	if ( class_exists( 'BP_Group_Extension' ) ) :
    		class members_nav_tab_in_group extends BP_Group_Extension {
    			function __construct() {
    				if( bp_is_group_single() ) {
    					$bp = buddypress();
    					$group_id = $bp->groups->current_group->id;
    					if( $group_id == '1' ) {
    						$args = array(
    						'slug'              => '../../members',
    						'name'              => 'Members Directory',
    						'nav_item_position' => 105,
    						);
    						parent::init( $args );
    					}
    				}
    			}
    		}
    	bp_register_group_extension( 'members_nav_tab_in_group' );
    	endif;
    

    What is the rationale/advantage for adding this function add_group_tab()?

Viewing 25 replies - 1 through 25 (of 33 total)
Skip to toolbar