BuddyDev

Search

[Resolved] Custom BuddyPress/Blog fields and Blog submenu

  • Participant
    Level: Initiated
    Posts: 9
    skryfnet on #4307

    Hi there,

    Awesome work that you’re doing here!

    I am a bit of a noob when it comes to custom code, so please bare with me, I need some help.

    I would like to change the field “blog” to another word, and I would also like to create a sub-menu of site categories under the user’s blog field.

    Also, how would I change certain fields in BuddyPress? For example, instead of “New Post” I want to change it to “Publish” and so forth.

    Best regards

    Skryf_Net

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #4308

    Hi Skryfnet,

    Welcome to Buddydev. If You are familiar with translation you can modify it from the .po file and use the following code in you bp-custom.php file to list the site categories

    
    
    function buddydev_site_categories_tab() {
    
    	$bp = buddypress();
    
    	$user_url = bp_loggedin_user_domain();
    
    	bp_core_new_subnav_item( array(
    			'name'		        => __('Site Categories'),
    			'slug'		        => 'categories',
    			'parent_url'	    => trailingslashit( $user_url . $bp->buddyblog->slug ),
    			'parent_slug'	    => $bp->buddyblog->slug,
    			'screen_function'	=> 'buddydev_screen_site_categories',
    			'position'          => 30,
    		)
    	);
    
    }
    add_action( 'bp_setup_nav', 'buddydev_site_categories_tab', 100 );
    
    function buddydev_screen_site_categories() {
    
    	add_action( 'bp_template_content', 'buddydev_render_site_categories_content' );
    	bp_core_load_template( array( 'members/single/plugins' ) );
    
    }
    
    function buddydev_render_site_categories_content() {
    
    	wp_list_categories(array( 'hide_empty' => false ));
    }
    
    

    Thank You
    Ravi

  • Participant
    Level: Initiated
    Posts: 9
    skryfnet on #4359

    Hi there! Thank you for the help. However, I copied the above code into the file, yet nothing appeared to have happened. Could I have done something wrong?

    For example, when the user hovers over the “blog” field (added by BuddyBlog) I need a drop down list of the word press categories to appear, or a submenu of categories, so that when the user creates a “new post” that post will not only appear on the wordpress main site, but also as a link under the correct category in the “blog” field

    With regards to .po files, I can’t seem to find the correct place to change the field “blog” that was added by BoddyBlog to a custom word “skryfwerk” which is ducth for “written work.”

    Hope it is not to much to ask, I am still in the learning process.

    Much appreciated

    skryfnet

  • Participant
    Level: Initiated
    Posts: 9
    skryfnet on #4360

    UPDATE: I get this error message

    Parse error: syntax error, unexpected ‘}’ in /home/netafrikaans/skryfnet.co.za/wp-content/plugins/bp-custom.php on line 19

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #4365

    Hi Skryfnet,

    This might be a case of code copy and pasting. Please try again copy and paste the code in your bp-custom.php file. If still you got this error send me the complete code of your bp-custom.php file.

    Thank You
    Ravi

  • Participant
    Level: Initiated
    Posts: 9
    skryfnet on #4433

    Hi there, I have tried it a few times, here is the complete code. Am I doing it right?

    <?php
    function buddydev_site_categories_tab() {
    
    	$bp = buddypress();
    
    	$user_url = bp_loggedin_user_domain();
    
    	bp_core_new_subnav_item( array(
    			'name'		        => __('Site Categories'),
    			'slug'		        => 'categories',
    			'parent_url'	    => trailingslashit( $user_url . $bp->buddyblog->slug ),
    			'parent_slug'	    => $bp->buddyblog->slug,
    			'screen_function'	=> 'buddydev_screen_site_categories',
    			'position'          => 30,
    		)
    	);
    
    }
    add_action( 'bp_setup_nav', 'buddydev_site_categories_tab', 100 );
    
    function buddydev_screen_site_categories() {
    
    	add_action( 'bp_template_content', 'buddydev_render_site_categories_content' );
    	bp_core_load_template( array( 'members/single/plugins' ) );
    
    }
    
    function buddydev_render_site_categories_content() {
    
    	wp_list_categories(array( 'hide_empty' => false ));
    }
    ?>

    Thank you for your patience

  • Participant
    Level: Initiated
    Posts: 9
    skryfnet on #4435

    Excuse me, the above code is working now, though not as I had anticipated (in a drop menu) but it would definitely do for now! Thanks a lot.

    It seems the issue now, for me is translating, as the code is in conflict with the site language. I will move that question to a new post.

    Thanks a lot for your patience and help.

You must be logged in to reply to this topic.

This topic is: resolved