Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Create Member type with code snippet
- */
- function vap_create_member_type_for_specific_user_id() {
- bp_register_member_type(
- 'type-one',
- array(
- 'labels' => array(
- 'name' => 'Member Type One',
- 'singular_name' => 'Member Type One',
- ),
- )
- );
- bp_register_member_type(
- 'type-two',
- array(
- 'labels' => array(
- 'name' => 'Member Type Two',
- 'singular_name' => 'Member Type Two',
- ),
- )
- );
- bp_register_member_type(
- 'type-three',
- array(
- 'labels' => array(
- 'name' => 'Member Type Three',
- 'singular_name' => 'Member Type Three',
- ),
- )
- );
- bp_register_member_type(
- 'type-four',
- array(
- 'labels' => array(
- 'name' => 'Member Type Four',
- 'singular_name' => 'Member Type Four',
- ),
- )
- );
- }
- add_action( 'bp_register_member_types', 'vap_create_member_type_for_specific_user_id' );
- /**
- * Set member types for specific user.
- */
- function wbcom_add_mmeber_type_for_specific_user() {
- $user_id = array( 1 );
-
- $set_member_type = array( 'type-four', 'type-three' );
-
- bp_set_member_type( $user_id, $set_member_type );
- }
-
- add_action( 'bp_init', 'wbcom_add_mmeber_type_for_specific_user' );
Add Comment
Please, Sign In to add comment