Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #1214419

    Hello,
    I was able to do this once before and now I can’t find the code I used but I remember that it was pretty short and simple.

    What could I add to the functions.php file that would make the header logo point to https://www.yousio.com for users that are logged out?

    But then have the logo point to http://www.yousio.com/activity after they log in

    #1215486

    Hey bigwavebusiness,

    Please have a look at the following thread:
    https://kriesi.at/support/topic/change-logo-for-logged-in-users/

    If you need further assistance please let us know.

    Best regards,
    Victoria

    #1215537

    Hi Victoria,
    I’m not the greatest with php (huge understatement lol) but that looks like it is to actually change the logo to a different image. I’m just trying to change the link associated with the logo.

    #1215706

    Hi bigwavebusiness,

    The code here allows you to change the links for the logo:
    https://kriesi.at/support/topic/change-logo-for-logged-in-users/#post-251039

    You need to place the links where Ismael pointed and add this code in your functions.php file in the child theme.

    Best regards,
    Victoria

    #1216576

    I tried what was supplied but I must have something wrong still as I’m getting an error on the last line saying unexpected ending. This is what I have:

    // Change Logo Link For Logged In Users
    add_filter('avf_logo_final_output', 'avf_logged_logo_final_output');
    
    function avf_logged_logo_final_output($logo) {
    	$headline_type = "h1";
    	if($dimension === true) $dimension = "height='100' width='300'"; //basically just for better page speed ranking :P
    	$loggedinlogo  = "<img src='https://yousio.com/wp-content/uploads/2020/05/Yousio-Flag-Logo-4.jpg' />";
    	$loggedoutlogo = "<img src='https://yousio.com/wp-content/uploads/2020/05/Yousio-Flag-Logo-4.jpg' />";
    	
    if ( is_user_logged_in() ) {
        $logo = "<$headline_type class='logo bg-logo'><a href='https://yousio.com'>".$loggedinlogo."$sub</a></$headline_type>";
    	} else {
    	$logo = "<$headline_type class='logo bg-logo'><a href='https://yousio.com/home/'>".$loggedoutlogo."$sub</a></$headline_type>";
    }	

    I added this in another thread but I also can’t access the Customize Theme page to be able to change what the intended home page is and instead I’m getting this error when trying to access https://yousio.com/wp-admin/customize.php?return=%2Fwp-admin%2Fupload.php

    Fatal error: Uncaught Error: Call to undefined function gutenberg_can_edit_post_type() in /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php:563 Stack trace: #0 /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php(423): Avia_Gutenberg->can_use_block_editor(‘post’, true) #1 /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php(458): Avia_Gutenberg->init_force_classic_post_types() #2 /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php(533): Avia_Gutenberg->get_force_classic_post_types() #3 /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php(671): Avia_Gutenberg->force_classic_editor(‘page’) #4 /home2/activ111/yousio.com/wp-includes/class-wp-hook.php(287): Avia_Gutenberg->handler_display_post_states(Array, Object(WP_Post)) #5 /home2/activ111/yousio.com/wp-includes/plugin.php(206): WP_Hook->apply_filters(Array, Array) #6 in /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php on line 563

    There has been a critical error on your website. Please check your site admin email inbox for instructions.

    #1216654

    Hi bigwavebusiness,

    You lost the closing bracket and why are you adding the same logo? It defeats the purpose of adding this code.

    Please try like this:

    
    // Change Logo Link For Logged In Users
    add_filter('avf_logo_final_output', 'avf_logged_logo_final_output');
    
    function avf_logged_logo_final_output($logo) {
    	$headline_type = "h1";
    	if($dimension === true) $dimension = "height='100' width='300'"; //basically just for better page speed ranking :P
    	$loggedinlogo  = "<img src='https://yousio.com/wp-content/uploads/2020/05/Yousio-Flag-Logo-4.jpg' />";
    	$loggedoutlogo = "<img src='https://yousio.com/wp-content/uploads/2020/05/Yousio-Flag-Logo-4.jpg' />";
    	
    if ( is_user_logged_in() ) {
        $logo = "<$headline_type class='logo bg-logo'><a href='https://yousio.com'>".$loggedinlogo."$sub</a></$headline_type>";
    	} else {
    	$logo = "<$headline_type class='logo bg-logo'><a href='https://yousio.com/home/'>".$loggedoutlogo."$sub</a></$headline_type>";
    }	
    }
    

    Best regards,
    Victoria

    #1216659

    I don’t want to change the logo. Only the link associated for logged in users.

    And the other error?

    #1216686

    Also, the fix you gave me made the Logo disappear

    #1216689

    Try this:

    add_filter('avf_logo_link','av_change_logo_link');
    function av_change_logo_link($link){
      if ( is_user_logged_in() ) {
          $link = "url1"; 
      }
      if ( !is_user_logged_in() ) {
          $link = "url2"; 
      }
        return $link;
    }
    #1216693

    Thanks Guenni007!
    I’m sorry but witch side of that is logged in and which is logged out?
    I’m trying to make it so that if you are not logged in and you click on the header logo it takes you to yousio.com/home
    But once you login the logo takes you to yousio.com/activity

    I have no idea what is causing the other error listed above but it is keeping me from being able to edit the theme so I currently can’t set a static homepage.

    #1216697

    And that is really hard to understand?
    is_user_logged_in is if the user is logged in.

    the ! is a not logic

    add_filter('avf_logo_link','av_change_logo_link');
    function av_change_logo_link($link){
      if ( is_user_logged_in() ) {
          $link = "https://yousio.com/activity"; 
      }
      if ( !is_user_logged_in() ) {
          $link = "https://yousio.com/"; 
      }
        return $link;
    }

    but for not logged in users this is normal behavior so you might get rid of the default setting:

    add_filter('avf_logo_link','av_change_logo_link');
    function av_change_logo_link($link){
      if ( is_user_logged_in() ) {
          $link = "https://yousio.com/activity"; 
      }
        return $link;
    }

    try yourself.

    • This reply was modified 4 years, 5 months ago by Guenni007.
    #1216702

    Well, I’m not a programmer so pretty much any php is difficult to understand but that is changing the links. Thank you

    But something is still forcing the user to the activity page if they are not logged in. If you try to access the url in any way it is forcing back to activity.

    https://yousio.com/loggedout ( I changed the page to reduce confusion)

    #1216712

    hm :

    have you tried that on top:

    add_filter('avf_logo_link','av_change_logo_link');
    function av_change_logo_link($link){
      if ( is_user_logged_in() ) {
          $link = "https://yousio.com/activity"; 
      }
      if ( !is_user_logged_in() ) {
          $link = "https://yousio.com/"; 
      }
        return $link;
    }

    maybe you set the wordpress setup wrong – because i do not see any difference on the homepage and the activity page ( yes i’m not logged in)
    when klicking on the activity button in your menu. If there is a difference there migth be two different pages ! ?

    what did you declare as frontpage ( if it is the activity page then it is clear )

    Yes i can see that there is different pages ( different page-ids ) but the content seems to me identical.
    I see only different sidebars. But they do change on reload too.

    #1216722

    Loggedout Page

    That’s what the home page should look like for a logged out user. The only way I can access it is by going to edit the page and hitting preview.

    But something is forcing everything to activity. What? I’m at a total loss right now

    #1216723

    Woohooo, I got it working. The setting in Appearance > Customize for what the homepage is was overriding the Enfold setting. I ended up having to switch to a different theme and save the correct page and then switch back to Enfold.

    The other error was preventing me from doing it before by blocking the page. Any thoughts on what is causing this error?

    Fatal error: Uncaught Error: Call to undefined function gutenberg_can_edit_post_type() in /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php:563 Stack trace: #0 /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php(423): Avia_Gutenberg->can_use_block_editor(‘post’, true) #1 /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php(458): Avia_Gutenberg->init_force_classic_post_types() #2 /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php(533): Avia_Gutenberg->get_force_classic_post_types() #3 /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php(671): Avia_Gutenberg->force_classic_editor(‘page’) #4 /home2/activ111/yousio.com/wp-includes/class-wp-hook.php(287): Avia_Gutenberg->handler_display_post_states(Array, Object(WP_Post)) #5 /home2/activ111/yousio.com/wp-includes/plugin.php(206): WP_Hook->apply_filters(Array, Array) #6 in /home2/activ111/yousio.com/wp-content/themes/enfold/config-gutenberg/class-avia-gutenberg.php on line 563

    There has been a critical error on your website. Please check your site admin email inbox for instructions.

    #1219098

    Hi,

    Glad to know that you managed to make it work. If you have any additional questions at this time we kindly ask that you open them up in a separate thread. The longer threads get in the forum, they become more difficult to support as they tend to drift off topic and they also make it troublesome for users trying to search for solutions. Keeping threads relevant to their original inquiry ensures that we can keep better track of what has been resolved and that users can more effectively find answers to similar issues they might be experiencing.

    Thanks!

    Best regards,
    Ismael

Viewing 16 posts - 1 through 16 (of 16 total)
  • The topic ‘Changing the link for the main logo for logged out users’ is closed to new replies.