BuddyDev

Search

[Resolved] xProfile Custom Field Types

  • Participant
    Level: Initiated
    Posts: 1
    Ed Freeman on #46617

    I am using paid memberships pro and when I update the buddypress addon I am receiving this error in the buddypress member profile section. The error appears below each xprofile field that was marked as public.

    ‘Warning: Undefined array key “public” in /home/xxxxx/public_html/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-template.php on line 917’

    ‘Warning: Trying to access array offset on value of type null in /home/xxxxx/public_html/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-template.php on line 917’

    The public visibility option seems to be getting lost somehow. When editing the fields and choosing the visibility options the public option does not even appear.

    Thanks,
    Ed

  • Keymaster
    (BuddyDev Team)
    Posts: 24566
    Brajesh Singh on #46618

    Hi Ed,
    I am sorry to hear about your issue. Seems like the PMPro addon is causing some conflict. Please allow me to look at it and get back to you within next 24 hours with more details.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24566
    Brajesh Singh on #46651

    Hi Ed,
    Hope you are doing well.

    I had a look.
    The problem lies with pmpro removing the ‘public’ visibility levels.

    Here is the code in PmPro that is causing it.

    
    /**
     * Remove "Public" status from XProfile fields when non-members restricted.
     *
     * @since 1.3
     * @param array $labels of field types for XProfile Fields.
     * @return array $labels of field types for XProfile Fields.
     */
    function pmpro_bp_hide_public_non_members( $label ) {
    	$non_user_options = pmpro_bp_get_level_options( 0 );
    	if ( $non_user_options['pmpro_bp_restrictions'] !== PMPROBP_GIVE_ALL_ACCESS ) {
    		unset( $label['public'] );
    	}
    
    	return $label;
    }
    add_filter( 'bp_xprofile_get_visibility_levels', 'pmpro_bp_hide_public_non_members' );
    
    

    Please report it to PMPro developers and they will provide a graceful fallback.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 1
    Ed Freeman on #46688

    Hi Brajesh,

    I really appreciate you taking the time to work that out instead of just saying it wasn’t your plugin.

    I’ll let PMPro know what you found.

    Thank you!!
    Ed

  • Keymaster
    (BuddyDev Team)
    Posts: 24566
    Brajesh Singh on #46697

    Hi Ed,
    You are welcome.
    I am glad I was able to assist.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: resolved