• Resolved bcanr2d2

    (@bcanr2d2)


    I think I need to add in some advanced conditions, but I am not sure how to start.

    What I would like to occur is for the popup to look for a profile field that is set to complete, and for the popup to not open when it is that value.

    Currently, I do not have that functioning at all, the popup itself is set to Auto Open on the BuddyPress Is Current Action: Edit, but want the above check added in to only open when a profile field is not set to complete
    I already use a shortcode in the popup to display different text depending on what this variable is set to.

    It is at bbs4you.com

Viewing 7 replies - 1 through 7 (of 7 total)
  • @bcanr2d2

    Maybe this adding custom Conditions doc will help you get started. It’s less of a how-to or more just examples.

    I’ll have our Lead Dev @danieliser offer his advice also.

    Thanks for your patience.

    Thread Starter bcanr2d2

    (@bcanr2d2)

    Thanks, I think I have some understanding, just need to code the right conditions.

    Thread Starter bcanr2d2

    (@bcanr2d2)

    Thanks for the push in the right direction. Just needed to do a simple lookup for the value of my BuddyPress Xprofile field value, and return TRUE or FALSE, depending on what value it found.

    Worked as expected!

    Let us know if you need any further assistance, and we’ll be happy to help.

    Plugin Author Daniel Iser

    (@danieliser)

    @bcanr2d2 – Awesome, glad you got it worked out, be sure to post your solution so others can find it, add a brief description of exactly what yours does if you didn’t add inline comments.

    That said, please take a moment to click that it Works and to rate and review the plugin or support.

    Thread Starter bcanr2d2

    (@bcanr2d2)

    This function is looking at an Xprofile Field, that is updated automatically as a user enters values into their profile.
    When they first login to edit their profile, Popup Maker is used to display a message about completing required fields, when that is saved, then it asks users to kindly fill out any optional fields, to assist them getting the attention they seek.

    When a user is considered to have completed their profile, there is no need to ask them to complete.
    Below is the condition I added to Popup Maker, along with the function I used to look at an XProfile Field in BuddyPress.

    The conditions of my popup were
    BP:Is Current Action = Edit
    And then used the below, set to Not equal (! highlighted)

    This had the popup display when the user was editing in BuddyPress and when it was NOT complete

    add_filter( 'pum_get_conditions', 'pum_profile_complete_conditions' );
    function pum_profile_complete_conditions( $conditions ) {
    	return array_merge( $conditions, array(
    		'password_page_unlocked' => array(
    			'group'    => __( 'Pages' ), // Can match any existing group. 
    			'name'     => __( 'Profile Stage: Complete' ), // Label to identify it in the list
    			'callback' => 'profile_stage_complete', // Where the magic happens 
    		),
    	) );
    }
    
    function profile_stage_complete(){
    //This is where we check to see if the profile stage is complete for a user
    // 
    $profile_stage = xprofile_get_field_data('Profile Stage');
    if ('complete' == $profile_stage){
    //Return True if profile is complete
    return TRUE;
    } else {
    //Return False if not complete, so member gets popup advising to complete profile fields
    return FALSE;
    }
    }
    • This reply was modified 8 years, 4 months ago by bcanr2d2. Reason: Coding typo

    @bcanr2d2

    Sweet! Thanks so much!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Stop Popup From Opening if Xprofile set to a particular value’ is closed to new replies.