Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to add login link to “You must be logged in to create new topics.”


  • uksentinel
    Participant

    @uksentinel

    Hi

    I am running BBPRESS and am looking to add a login link to Add login link to “You must be logged in to create new topics.” which appears at the bottom of Topics list when you are not logged in.

    I have copied out the Forum-Topic.php file and it is located in my Themes BBPRESS folder.

    Code in my Forum-Topic.php that I am looking to add to is ….

    <div id=”no-topic-<?php bbp_forum_id(); ?>” class=”bbp-no-topic”>
    <div class=”bbp-template-notice”>

    • <?php is_user_logged_in()
      ? esc_html_e( ‘You cannot create new topics.’, ‘bbpress’ )
      : esc_html_e( ‘You must be logged in to create new topics.’, ‘bbpress’ );
      ?>
Viewing 6 replies - 1 through 6 (of 6 total)

  • uksentinel
    Participant

    @uksentinel

    Any guidance on the code I need to add would be most welcomed after the You cannot create new topics.

    Thanks


    uksentinel
    Participant

    @uksentinel

    I did try a href=”https://uktechhub.com/login&#8221; title=”login”>Login</a with <> at each end, but this did not seem to work


    uksentinel
    Participant

    @uksentinel

    So as a slight deviation, I managed to resolve how to add a login link to “You must be logged in to reply to this topic.” and not “You must be logged in to create new topics.”.

    I use the login plugin (paid) created by Xootix and I asked them for the necessary code (PHP) to add a link to the “You must be logged in to reply to this topic.” or at least enable the wording to be clickable.

    Below is PHP code provided by Xootix and I added it to the Themes functions.php and this works very well

    add_action( ‘wp_footer’, function(){
    if( is_user_logged_in() ) return;
    ?>

    <style type=”text/css”>
    .bbp-no-reply .bbp-template-notice{
    cursor: pointer;
    }
    </style>
    <script type=”text/javascript”>
    jQuery(document).ready(function($){
    $(‘body’).on( ‘click’, ‘.bbp-no-reply .bbp-template-notice’, function(){
    $(‘.xoo-el-login-tgr’).trigger(‘click’);
    } )
    })
    </script>
    <?php
    } );


    uksentinel
    Participant

    @uksentinel

    Post to original Q and A as formatting is not correct for PHP code

    https://wordpress.org/support/topic/add-xootix-login-to-bbpress/#post-17505394


    uksentinel
    Participant

    @uksentinel

    Ignore


    Robin W
    Moderator

    @robin-w

    🙂

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