Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 3,401 through 3,425 (of 3,787 total)
  • @danbp

    Participant

    Glad you got it to work !

    @danbp

    Participant

    Which theme do you use ?
    Is BP set up correctly ? Have you pages activated for each component ? Activities page exist and is activated by default, but you have to check this anyway. Perhaps did you removed the page before you deativate the component ?

    buddypress.php is ordinarly used in a child-theme to replace theme’s page.php
    If bp_get_activity_directory_permalink() is not recognized, it is most probably because the file doesn’t exist for buddypress, or better said, is outside of his scope.

    If this file is shipped with the framework, you have to inquire in the framework doc or to tell about this incident to the author.

    @danbp

    Participant

    /wp-content/themes/child-theme/buddypress.php

    Template Hierarchy

    @danbp

    Participant

    this seems not to be an usal path for a buddypress file !

    @danbp

    Participant

    Hi @hardeepasrani,

    xProfile field manipulation is a such common question on this forum. 🙄 Did you searched before asking ?

    But codex first !

    Creating a Plugin


    other reference

    Here a topic where you can find how this works and can be done.
    https://buddypress.org/support/topic/how-to-add-fields-from-xprofile-fields-groups-created-by-me/

    @danbp

    Participant

    Hi @jencina,

    set the registration page as homepage. (dashboard > Setting > Front page view).

    Make also a child theme and add a copy of the register.php file who is in /bp-templates/bp-legacy/buddypress/members/ and add it to your child, using the same path.

    /your-theme/buddypress/members/register.php

    On this copy you can add/remove and make any change you want for your new homepage.

    Reference
    https://codex.wordpress.org/Creating_a_Static_Front_Page

    Modifying the Registration Form

    @danbp

    Participant

    Hi @bnowthen,

    this is one of the most common thing you can do with BuddyPress. 😉 .
    To do that, you have to read the Codex, about members loop.

    First, you will create a child-theme of 2014.
    Than you add a folder called buddypress to it.
    In this folder, you add a sub folder called members.
    You than make a copy of members-loop.php.
    This file is in wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/members/

    Now, you open the copied file and replace the content of line 16.

    Replace this:
    <?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?>
    with this:
    <?php if ( bp_has_members( bp_ajax_querystring( 'members' ) . '&type=alphabetical' ) ) : ?>

    Save and enjoy.

    References
    https://codex.wordpress.org/Child_Themes

    Members Loop

    @danbp

    Participant

    I was unable to get a correctly working form when i use the plugin page on the ADMIN tab. It shows only. So i revert back to get the job manager on a separate page who shows up on a group page.
    The snippet is set for admins only and to work only on group ID 13 and 9.

    Anything is commented so you can modify that

    Here a slightly modified version of my previous.
    Install the plugin and use the shortcodes as indicated by the author and add the snippet to theme’s functions.php or bp-custom.php

    function bpfr_add_page_to_group() {
    	global $bp;		
    	if ( bp_is_active( 'groups' ) )
    	
    	// allow oly admin's 
    	// this works also on single install
    	if ( is_super_admin() ) :
    	
    	if ( class_exists( 'BP_Group_Extension' ) ) :
    	
    	class Job_Center_Group_Extension extends BP_Group_Extension {	
    	 
    	 //building the tab		
    		function __construct() {
    			$args = array(
                'slug' 		  => 'jobcenter',  // tab slug - mandatory
                'name'        => 'Job Center', // tab name - mandatory  
    			//'parent_slug' => 'admin',  
    			
    			);
    			parent::init( $args );
    		} // end construct()		
    	
    	  // content display		
    		function display() {   
    			
    			// grab page or post ID
    			$id = 240; 
    			$p = get_post($id); 
    
    			// output the post		
    		
    			echo apply_filters('the_content', $p->post_content);
    		}   // end display()
    	} // end class	
    	
    	//display content only in one group (ex. group_ID is 14) 	
        // check for a group ID
    	if( bp_has_groups() ) {
    		// Grab current group ID
    		bp_the_group();
    		$group_id = bp_get_group_ID();
    	}	
    	
        // apply our changes only to this group	
    	// conditionnal action
    	if ( $group_id == 9 OR $group_id == 13 ) {   
    		bp_register_group_extension( 'Job_Center_Group_Extension' );          
    	}      
    	
    	endif;
    	endif;
    }
    add_filter('bp_groups_default_extension', 'bpfr_add_page_to_group' );

    If you want to modify one of the plugin templates, make a copy of wp-job-manager/templates/ folder in your child theme and rename it job_manager ( ! no other name).

    @danbp

    Participant

    You’re welcome ! Glas you got it to work. 😉

    But they are very, very slow.

    Time is not money for everybody or better said, money is not time for some merchants.

    In reply to: not recently active

    @danbp

    Participant

    Hi @bea107,

    some explanation on how to do this, beside reading the codex.

    The original core function we want to modify:

    /**
     * Format last activity string based on time since date given.
     *
     * @uses bp_core_time_since() This function will return an English
     *       representation of the time elapsed.
     *
     * @param int|string $last_activity_date The date of last activity.
     * @param string $string A sprintf()-able statement of the form '% ago'.
     * @return string $last_active A string of the form '3 years ago'.
     */
    function bp_core_get_last_activity( $last_activity_date, $string ) {
    
    	if ( empty( $last_activity_date ) )
    		$last_active = __( 'Not recently active', 'buddypress' );
    	else
    		$last_active = sprintf( $string, bp_core_time_since( $last_activity_date ) );
    
    	return apply_filters( 'bp_core_get_last_activity', $last_active, $last_activity_date, $string );
    }

    To alter it, we have to create a little function. Here’s the custom function which removes the message string:

    function bea107_core_get_last_activity( $last_activity_date, $string ) {
    		if ( empty( $last_activity_date ) )
    				// we do nothing
    				$last_active = '';
    			else
    				$last_active = sprintf( $string, bp_core_time_since( $last_activity_date ) );
    		}
    add_filter( 'bp_core_get_last_activity', 'bea107_core_get_last_activity' );
    

    If you want to remove the whole filter, you use this

    function bea107_remove_last_activity_filter() {
        remove_filter( 'bp_core_get_last_activity', $last_active, $last_activity_date, $string );
    }
    add_filter( 'bp_core_get_last_activity', 'bea107_remove_last_activity_filter' );

    Both function can be added to your child-theme’s functions.php or bp-custom.php

    @danbp

    Participant

    I use the KLEO theme (BuddyPress is integrated), could it be because of that?
    Normally, no.

    But as you use a premium theme, don’t except much help here. You also payed for support. If the snippet doesn’t work for you ( i tested it successfully with Twentythirteen before publishing), you have to get in contact with the theme author or read his doc about customization (if exist).

    To get the field ID, see it from where the field is created, in xprofile admin. If you hover the delete button, you can see it at the bottom left corner of your browser.

    You can also go into the DB and check for it in the bp_xprofile_fields table.

    NOTE:
    When you get a snippet, the first thing to do is to use it “as is” to test it – this means also “understanding how it works”, not to apply what you think is better. 🙄

    And only when the test is ok, you can modify it or try to do so. 😉

    @danbp

    Participant

    Hi @noise,
    did you searched in existing plugins ?
    https://wordpress.org/plugins/search.php?page=2&q=race+result+plugin

    My 2 cents:
    Ideally, the admin would enter in the results for each user for each race.
    well, this let’s you to be so only plugin user. No need for a specific BP plugin in this case.

    From the plugin, you fetch the datas and insert them into a profile textbox called “result” Original isn’t it ? This work can more or less be automated. Depends of the plugin i guess.

    On the members directory, you output the content of the result box under each member name/avatar.

    @danbp

    Participant

    I’m on another path by trying to get the plugin template of job-dashboard, via my child-theme… and by keeping the admin sub tab in place.
    Half done for the moment, but not sure to get a satisfying result without hacking the plugin to get it BP compliant.

    My first suggestion is really working well on a extra tab and adding restriction to a wp page is really easy to achieve. So i would probably not investigate much longer. It’s cold and rainy, so i can work on it. But if the sun comes out, i go motorbiking. 😉

    @danbp

    Participant

    Hi @ww2boy,

    Yes ! 😉 Give this a try. Add it to child theme’s functions.php or bp-custom.php

    function bpfr_hide_profile_edit( $retval ) {	
    	// remove field from edit tab
    	if(  bp_is_profile_edit() ) {		
    		$retval['exclude_fields'] = '54'; // ID's separated by comma
    	}	
    	// allow field on registration page     
    	if ( bp_is_register_page() ) {
    		$retval['include_fields'] = '54'; // ID's separated by comma
    		}		
    	
    	// hide the filed on profile view tab
    	if ( $data = bp_get_profile_field_data( 'field=54' ) ) : 
    		$retval['exclude_fields'] = '54'; // ID's separated by comma	
    	endif;	
    	
    	return $retval;	
    }
    add_filter( 'bp_after_has_profile_parse_args', 'bpfr_hide_profile_edit' );

    Codex reference:
    https://codex.buddypress.org/plugindev/using-bp_parse_args-to-filter-buddypress-template-loops/

    @danbp

    Participant

    You’re welcome ! Don”t hesitate if you have other questions.

    @danbp

    Participant

    Contact me on bp-fr.net please

    @danbp

    Participant

    @shanebp on his best, a long time ago… but this was before BP 1.8. Today it’s a bit different with the Group API.

    @danbp

    Participant

    I tested and get correctly anything from the plugin. What i did:

    – installed the plugin
    – create a new page called job
    – added the shortcode [jobs] [submit_job_form] [job_dashboard]
    – saved

    In bp-custom i added this snippet, similar to the previous but who let’s you add a page to a group.

    function bpfr_add_page_to_group() {
    	
    	if ( class_exists( 'BP_Group_Extension' ) ) :
    	
    	class BPFR_Custom_Group_Extension extends BP_Group_Extension {
    		
    		//   building the tab 
    		
    		function __construct() {
    			$args = array(
                'slug' => 'jobs', // tab slug - mandatory
                'name' => 'Job Center'  // tab name - mandatory        
    			);
    			parent::init( $args );
    		} // end construct()
    		
    		
    		// content display 		 
    		
    		function display() {    
    			
    			// grab page or post ID
    			$id = 240;  
    			$p = get_post($id);     
    			
    			// output the title     
    			echo '<h3>'.apply_filters('the_content', $p->post_title).'</h3>';
    			// output the post      
    			echo apply_filters('the_content', $p->post_content); 
    			// end option 
    			
    		}   // end display() 
    	} // end class	
      
    		bp_register_group_extension( 'BPFR_Custom_Group_Extension' ); 
     
    	endif; 
    }
    add_filter('bp_groups_default_extension', 'bpfr_add_page_to_group' );

    So far i see everything is working !

    EDIT: working yes, but not on the admin tab.
    @shanebp you’re right, but it’s only an example for how things can be done. 😉

    @danbp

    Participant

    I guess you have to remove your custom code before using my snippets.

    The 1st function let you add custom content on the tab. It’s not a WP page on which you can use a shortcode to call your job form.

    I’ll check that.

    @danbp

    Participant

    Seems that you remove the site from the web ?
    With or without www, 1a-spielwiese.de gives a 301 error !

    @danbp

    Participant

    Hi @nickpeplow,

    it’s not possible to add sub nav items with the group API and the only other possibility that eventually could work a day (but not tomorrow 😉 ) would be bp_core_new_subnav_item(), but it is a Todo, as stated in bp-groups-classes.php:3307

    Here are 2 snippets (i tested them within bp-custom.php – BP 2.0.2 Twentythirteen)

    This one let you add some content on the new screen.

    function add_admin_tab_content() {
    	echo 'Quis scelerisque lacinia tempus nullam felis';
    	}
    add_action( 'groups_custom_edit_steps', 'add_admin_tab_content' );

    This one create a sub nav item when you’re on the group admin screen

    
    function bpfr_add_page_to_group() {
    	
    	if ( class_exists( 'BP_Group_Extension' ) ) :
      
    class My_Custom_Group_Extension extends BP_Group_Extension {
     
        function __construct() {
            $args = array(  
    			'slug' => 'houba-houba',
    			'parent_slug' => 'admin', // URL slug of the parent nav item
                'nav_item_position' => 100,
                'screens' => array(
                    'edit' => array(
                        'name' => 'Houba Houba', // the tab name                 
                    ),
                    'create' => array(
                        'position' => 100,
                    ),
                ),
            );
            parent::init( $args );
        }
     
    
         function settings_screen( $group_id ) {
    		// don't remove this function
               }  
    } // end of class
    
    		bp_register_group_extension( 'My_Custom_Group_Extension' );
     
    	endif;
    }
    add_filter('bp_groups_default_extension', 'bpfr_add_page_to_group' );

    Once installed you will see that the “save change” button is still there. This button is contextual and cannot be removed, as it is used elsewhere. So you make it diseapear with the appropriate CSS with display:none!important; on the div with the ID of your/each group save button.

    If you want to display that only for one group, you add a condition to bp_register_group_extension like this

    } // end class
    ////////////////////////////////////////////////////////////
    /* display content only in one group (ex. group_ID is 14) */
    ////////////////////////////////////////////////////////////
         
        // check for a group ID
            if( bp_has_groups() ) {
                // Grab current group ID
                bp_the_group();
                $group_id = bp_get_group_ID();
            }
         
        //////////////////////////////////////////
        /* apply our changes only to this group */
        //////////////////////////////////////////
         
            // conditionnal action
            if ( $group_id == 14 ) {   
                bp_register_group_extension( 'My_Custom_Group_Extension' );          
            } 
    

    Voilà ! May this help.

    More BP tips and tricks on my blog. (FR, sometimes EN – but php is always in english)

    @danbp

    Participant

    This is actually hardcoded in the register.php, so i would be very simple to modify i guess.

    Make a copy of the original file
    /buddypress/bp-templates/bp-legacy/buddypress/members/register.php

    Add it to your child theme
    /your_child_theme/buddypress/members/register.php

    Change the HTML to your need.

    Theme Compatibility & Template Files

    @danbp

    Participant

    You’re welcome ! French powa 😉

    @danbp

    Participant

    You’re welcome !

    @danbp

    Participant

    salut @victord34,

    I obviously could not do it with my child css
    Most probably because you did it wrong !

    Add BuddyPress Styles to a Theme

Viewing 25 replies - 3,401 through 3,425 (of 3,787 total)
Skip to toolbar