Helping you Build Your Own Social Network!

Faster, better and easier!

Creating a new component

(4 posts) (2 voices)
  • Started 9 months ago by gwu
  • Latest reply from Brajesh Singh

Tags:

No tags yet.


  1. Hi Brajesh,

    I need to create a new component called Contact. Basically a page where I can put in my contact form. I am doing something like this, but this re directs me to 404 page

    function show_contact_link(){
    	echo '<a href="';
    	site_url();
    	echo 'contact">Contact</a>';
    }
    //now the code to handle /contact url
    function bp_contact_screen_function() {
        global $bp;
    	if($bp->current_component=="contact"){
    		bp_core_load_template( apply_filters( "contact_my_contact", 'contact' ) );
    	}
    }
    add_action( 'wp', 'bp_contact_screen_function',5);
    
    function bp_is_contact(){
    	global $bp;
    	if($bp->current_component=="contact")
    		return true;
    	return false;
    }
    Posted 9 months ago #
  2. Hi Gwu,
    if you are on bp 1.2.9, putting this code should fix it. In 1.5, it will need more updates though.

    function bp_add_contact_component(){
    
    bp_core_add_root_component('contact');
    }
    add_action('bp_setup_root_components','bp_add_contact_component',2);
    Posted 9 months ago #
  3. It will be helpful if you can tell me how can i get this working on 1.5. eventually we have to upgrade to 1.5 and unfortunately BP never upgrades seamlessly. it always breaks plugins/custom work put in the previous version.

    this is one thing i dislike about BP.

    Posted 9 months ago #
  4. HI Gwu,
    I am posting a couple of details in your other thread.

    Posted 9 months ago #

Reply

You must log in to post.