• Hello, I have 2 profile ( business and personnal ) form with link as https://www.xxx.com/business/?um_action=edit for the fill business profil.

    If the profil business is already filled, I want hide the link.

    So I am looking code for hide the url link if the business profil is filled

    Thanks for your help

    Regards
    Michel

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Aswin Giri

    (@aswingiri)

    Hello @benenoo

    Can you please mention which link are you trying to hide? You can check for user metadata and see if the profile was filled.

    For example, if you have first_name field in form, you can try something link following codes:

    <?php
    add_action('wp_head',function(){
    	if( um_is_core_page( 'user' ) ){
    		$profile_id = um_profile_id();
    		$first_name = get_user_meta( $profile_id, 'first_name', true );
    		if( $first_name ){ // first name was filled
    		?>
    		<style>
    			.link-element-class {
    				display:none;
    			}
    		</style>
    		<?php
    		}
    	}
    });

    The above code is just an example, you will have to modify it based on your requirement.

    Thread Starter benenoo

    (@benenoo)

    Thanks for your help ??

    My code on widget is :

    <div class=”link-element-class” style=”
    display: none;
    “>
    <span style=”color:#fd620b; font-size: 15px; display: block; margin-top: 0px”>Créer un compte business </span></div>

    and add to function :

    add_action('wp_head',function(){
    	if( um_is_core_page( 'user' ) ){
    		$profile_id = um_profile_id();
    		$business_name = get_user_meta( $profile_id, 'business_name', true );
    		if( $business_name){ // first name was filled
    		?>
    		<style>
    			.link-element-class {
    				display:none;
    			}
    		</style>
    		<?php
    		}
    	}
    });

    Do you think is correct ?

    • This reply was modified 2 years, 8 months ago by benenoo.
    • This reply was modified 2 years, 8 months ago by benenoo.
    • This reply was modified 2 years, 8 months ago by benenoo.
    • This reply was modified 2 years, 8 months ago by benenoo.
    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @benenoo

    Please try removing the style="display:none" from this line:
    <div class=”link-element-class” style=”display: none;“>

    Thread Starter benenoo

    (@benenoo)

    Hello, this code works well and where add code else ( like if no filled ) inside it ?

    add_action('wp_head',function(){
    	if( um_is_core_page( 'user' ) ){
    		$profile_id = um_profile_id();
    		$business_name = get_user_meta( $profile_id, 'business_name', true );
    		if( $business_name){ // first name was filled
    		?>
    		<style>
    			.link-element-class {
    				display:none;
    			}
    		</style>
    		<?php
    		}
    	}
    });

    Thanks
    Michel

    • This reply was modified 2 years, 7 months ago by benenoo.
    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @benenoo

    Here’s a code snippet that else, see //do something:

    add_action('wp_head',function(){
    	if( um_is_core_page( 'user' ) ){
    		$profile_id = um_profile_id();
    		$business_name = get_user_meta( $profile_id, 'business_name', true );
    		if( $business_name){ // first name was filled
    		?>
    		<style>
    			.link-element-class {
    				display:none;
    			}
    		</style>
    		<?php
    		}else{
                         // Do Something
                    }
    	}
    });
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hide link if form is filled’ is closed to new replies.