Skip to:
Content
Pages
Categories
Search
Top
Bottom

About bp-custom


  • Joshua Blevins
    Participant

    @jblevins1991

    I see the code here about creating custom member types, but it didn’t say much about where to put this code. I assumed one of two places. Either in the bp-custom.php file wp-content/plugins/ or in functions.php. However, when i post the code below into both I did not get the desired effect.

    
    function custom_member_types(){
    	bp_register_member_type("role", array("labels" => array("name" => "role", "singular_name" => "role"), "has_directory" => "coaches"));
    }
    
    add_action("bp_register_member_types", "custom_member_types");
Viewing 2 replies - 1 through 2 (of 2 total)

  • danbp
    Moderator

    @danbp

    Hi,

    if you read attentively the mentionned Codex page, you’ll see that the function is written with single quotes. Try it.

    Also, you have to register MT first, using bp_init action hook. (1st function example on codex)
    After that, you may build a MT directory for which you use bp_register_member_types. (2nd example)

    In other words, you need at least 2 functions to get this to work.

    bp-custom.php is the correct file to add those functions. The avantage of this method is to let you theme independant.


    Joshua Blevins
    Participant

    @jblevins1991

    Okay, I did those changes (shown below). I still see no additional role added to the WordPress extended profile. I should be able to see it there. Correct?

    <?php
    
    /*
    *
    */
    function custom_member_types(){
    	bp_register_member_type('role', array('labels' => array('name' => 'role', 'singular_name' => 'role')));
    }
    
    add_action('bp_init', 'custom_member_types');
    
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘About bp-custom’ is closed to new replies.
Skip to toolbar