• Resolved benenoo

    (@benenoo)


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

    That I need is code for display link is filled and hide link if not filled
    The code below hide link is filled, how

    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
        		}
        	}
        });

    Explain better , I have 3 links :

    My profil >> want to be hide if field name is not filled
    Edit my profil >> want to be display if field name is filled
    Register profil >> want to be hide if field name not filled

    Thanks
    Michel

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

    (@aswingiri)

    Hello @benenoo

    Please try something like the following codes:

    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 ){
    
    		<style>
    			.my-profile-link-class {
    				display:inlin-block;
    			}
    			.edit-my-profile-link-class {
    				display:inline-block;
    			}
    			.register-profile-link-class {
    				display:inline-block;
    			}
    
    		</style>
    
    		}else{
    		?>
    		<style>
    
    		.my-profile-link-class {
    				display:none;
    			}
    			.edit-my-profile-link-class {
    				display:none;
    			}
    			.register-profile-link-class {
    				display:none;
    			}
    		</style>
    		<?php
    		}
    	}
    });
    Thread Starter benenoo

    (@benenoo)

    Hello and thanks, but this code show me error and broke my website.

    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 ){
    
    		<style>
    			.my-profile-link-class {
    				display:inlin-block;
    			}
    			.edit-my-profile-link-class {
    				display:inline-block;
    			}
    			.register-profile-link-class {
    				display:inline-block;
    			}
    
    		</style>
    
    		}else{
    		?>
    		<style>
    
    		.my-profile-link-class {
    				display:none;
    			}
    			.edit-my-profile-link-class {
    				display:none;
    			}
    			.register-profile-link-class {
    				display:none;
    			}
    		</style>
    		<?php
    		}
    	}
    });

    I try to do it with new code ( business_yes is radiobox ) and try to display if radiobox = Oui.
    But doesnt works

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

    Thanks for your help

    Michel

    • This reply was modified 2 weeks, 5 days ago by benenoo.
    • This reply was modified 2 weeks, 5 days ago by benenoo.
    • This reply was modified 2 weeks, 5 days ago by benenoo.
    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @benenoo

    Please avoid creating duplicate topics.
    Please see my response to this topic of yours:
    https://wordpress.org/support/topic/link-hided/

    I’m marking this topic as resolved now.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.