Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 1,401 through 1,425 (of 32,432 total)
  • Author
    Search Results
  • #223472
    Morphim
    Participant

    Hi there

    It’s the end of Sept 2021 and I’ve been trying to sort out an old PHPBB conversion to BBPress.
    WP: 5.8.1 and BBPress 2.6.6

    I can confirm I’ve done this seemingly successfully. It took a few tries but with this thread I’ve got it working.

    I just wanted to share what worked in 2021.

    1. I exported my old PHPBB database (.sql file) and then set up a new database on my current host and imported the PHPBB to it.
    This just simplified any server timeouts and other connection issues.

    2. I obviously had BBpress installed within WP, but the included PHPBB converter doesn’t work (why??) so copied two files from this thread.

    a. Firstly, I had the ‘annonymous user’ loop mentioned above so copied @davidmanch great code (a couple of comments above) into:
    /wp-content/plugins/bbpress/includes/admin/classes/class-bbp-converter.php
    This fixed the never ending loop but the built in converter didn’t import any users, so …

    b. I copied @a8bit excellent code (3 posts above this one) into:
    /wp-content/plugins/bbpress/includes/admin/converters/phpbb.php
    This added many more steps to the import which completed without errors. I’m thinking this code might also have fixed the annonymous user loop too but didn’t try it on it’s own?? I’d already change the code in a. above. If you do this, maybe just try this code only and see if it works.

    So, if you find this now, it does work (for me at least) so hopefully you don’t have to hunt around for solutions.

    The BBPress guys need to look at these two pieces of code and see why their packaged converter doesn’t work. It’s very frustrating and shouldn’t be left to users much smarter than me to fix … but I’m glad they did.

    Cheers

    #223461

    Topic: Force Login

    in forum Installation
    msAniElle
    Participant

    I have tried looking through this forum to find what I need, and I just can’t seem to do so.

    I am by no means a coder, but I said I would help a friend put together a forum, and I would like everyone who clicks on the “forum” access button at the top of the page to be forced to log in if they are not already logged in. I would then like them to see the main forum page, not the dashboard unless they have higher clearance than participants.

    How does one do that? I saw someone post about the Private groups plugin… but will it do what I want it to do?

    #223381
    severbronny
    Participant

    I’m a newbie with code and web implementation, so forgive me if this is a dumb question. My readers have reported the following: “I’ve been trying to be able to post on your forum. I have a wordpress account, which I use to try to log in. After that it takes me to a jetpack and wordpress site, which Makes me put in my info again. But when I do, it then it takes me back to the original jetpack/wordpress page.”

    Here is the forum:

    Forum *new*

    And yet they can make comments on my site with ease:

    Discussion

    I installed bbPress using this slug: [bbp-forum-index]

    What am I missing? Thanks ahead!

    outkax
    Participant

    Thanks for your answer I have corrected my code with yours 🙂

    Robin W
    Moderator

    your triple === means that is has to match type (eg string or integer) as well as value, hence why

    if(bbp_forum_id() === '513')

    didn’t work, as the forum id is an integer and by havng quotes round the number you are asking it to be a string

    in your solution

    <?php if(bbp_get_forum_id() === $forum_id = 513): ?>

    would be better as

    <?php if(bbp_get_forum_id() === 513): ?>

    or better still

    <?php if(bbp_get_forum_id() == 513): ?>

    as unless you are using the $forum_id variable elsewhere (when it probbaly needs to be declared as a global) then the $forum_id = is redundant

    but glad you fixed it

    outkax
    Participant

    I think I found the solution 🙂 :

    <?php
    
    /**
     * Single Forum Content Part
     *
     * @package bbPress
     * @subpackage Theme
     */
    
    // Exit if accessed directly
    defined( 'ABSPATH' ) || exit;
    
    ?>
    
    <div id="bbpress-forums" class="bbpress-wrapper">
    
    	<?php bbp_breadcrumb(); ?>
    
    	<?php //bbp_forum_subscription_link(); ?>
    
    	<?php do_action( 'bbp_template_before_single_forum' ); ?>
    
    	<?php if ( post_password_required() ) : ?>
    
    		<?php bbp_get_template_part( 'form', 'protected' ); ?>
    
    	<?php else : ?>
    
    		<?php //bbp_single_forum_description(); ?>
    
    		<?php if ( bbp_has_forums() ) : ?>
    
    			<?php bbp_get_template_part( 'loop', 'forums' ); ?>
    
    		<?php endif; ?>
    
    		<?php if ( ! bbp_is_forum_category() && bbp_has_topics() ) : ?>
    
    			<?php bbp_get_template_part( 'pagination', 'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'loop',       'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'pagination', 'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'form',       'topic'     ); ?>
    
    		<?php elseif ( ! bbp_is_forum_category() ) : ?>
    			<?php if(bbp_get_forum_id() === $forum_id = 513): ?>
    
    				<?php bbp_get_template_part( 'rules' ); ?>
    
    			<?php else :  ?>
    				<?php bbp_get_template_part( 'feedback',   'no-topics' ); ?>
    
    				<?php bbp_get_template_part( 'form',       'topic'     ); ?>
    			<?php ?>
    			<?php endif; ?>
    		<?php endif; ?>
    
    	<?php endif; ?>
    
    	<?php do_action( 'bbp_template_after_single_forum' ); ?>
    
    </div>
    
    Robin W
    Moderator

    sorry, untested code, go with

    if ($forum_id == ‘12345’) {

    outkax
    Participant

    I tried another method but no way bbp_forum_id only displays the forum id.I tried with I tried with “bbp_get_forum_id” that doesn’t work either.

    <div id="bbpress-forums" class="bbpress-wrapper">
    
    	<?php bbp_breadcrumb(); ?>
    
    	<?php //bbp_forum_subscription_link(); ?>
    
    	<?php do_action( 'bbp_template_before_single_forum' ); ?>
    
    	<?php if ( post_password_required() ) : ?>
    
    		<?php bbp_get_template_part( 'form', 'protected' ); ?>
    
    	<?php else : ?>
    
    		<?php //bbp_single_forum_description(); ?>
    
    		<?php if ( bbp_has_forums() ) : ?>
    
    			<?php bbp_get_template_part( 'loop', 'forums' ); ?>
    
    		<?php endif; ?>
    
    		<?php if ( ! bbp_is_forum_category() && bbp_has_topics() ) : ?>
    
    			<?php bbp_get_template_part( 'pagination', 'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'loop',       'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'pagination', 'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'form',       'topic'     ); ?>
    
    		<?php elseif ( ! bbp_is_forum_category() ) : ?>
    			<?php if(bbp_forum_id() === '513'): ?>
    			<?php echo 'yes'; ?>
    			<?php else :  ?>
    				<?php bbp_get_template_part( 'feedback',   'no-topics' ); ?>
    
    				<?php bbp_get_template_part( 'form',       'topic'     ); ?>
    			<?php ?>
    			<?php endif; ?>
    		<?php endif; ?>
    
    	<?php endif; ?>
    
    	<?php do_action( 'bbp_template_after_single_forum' ); ?>
    
    </div>
    outkax
    Participant

    I tested with your code Robin, it does not work. The if is missing parentheses. But even with that doesn’t work. It displays all the forums with the content of the if and does not take into account the id I give it.

    #223269
    bobdobbs
    Participant

    I have a solution.

    It relies on a couple of assumptions: one being that the structure of URL’s is like this:
    http://mysite.com/forums/…&#8217;

    Assumption 2: all users with an account on the website are allowed to access the forum.

    This function does the following:
    If the user requests a resource under ‘/forums/’ then we test to see if the user has a wordpress account and is logged in. If the user isn’t logged into the wordpress account, then they get denied.

    In production I’ve replaced ‘wp_die’ with a wp_redirect to another page.

    /**
    * If a user is not a forum member, and requests the forum index page then redirect them
    */

    add_action('init', 'as_protect_forums');
    
    function  as_protect_forums() {
    
        // get the path of the requested URI
        $current_url = home_url($_SERVER['REQUEST_URI']);
    
        $path = parse_url($current_url, PHP_URL_PATH) ;
    
        $parts = explode('/', $path) ;
    
        $first_part = $parts[1] ;
    
        if (  $first_part === 'forums' ) {
            if ( 0 === get_current_user_id() ) {
                wp_die('nope');
            }
        }
    
    }
    
    

    Hi @outkax 👋

    The functionality you’re looking for does not currently exist.

    The bbp_get_template_part filter exists to hook into this API and extend the template parts to attempt to locate, so it would be achievable with some custom code.

    #223266
    Robin W
    Moderator

    have you been to

    Step by step guide to setting up a bbPress forum – Part 1

    and looked at item 3?

    #223263
    drivinghome
    Participant

    WP 5.8.1 bbPress 2.6.6

    Can the bbPress Forum 2.6.6 version be used with Elementor and or does it have a shortcode so that we can embed the forum onto an existing page.

    Thanks

    Greg

    Robin W
    Moderator

    I am very unclear as to what you are trying to achieve.

    if you want one forum say forum id 12345 to display differently, then just amend content-single-forum to

    <?php
    $forum_id = bbp_forum_id() ; 
    if $forum_id = '12345' {
    ?>
    
    <div id="bbpress-forums" class="bbpress-wrapper">
    
    	<?php bbp_breadcrumb(); ?>
    
    	<?php bbp_forum_subscription_link(); ?>
    
    	<?php do_action( 'bbp_template_before_single_forum' ); ?>
    
    	<?php if ( post_password_required() ) : ?>
    
    		<?php bbp_get_template_part( 'form', 'protected' ); ?>
    
    	<?php else : ?>
    
    		<?php bbp_single_forum_description(); ?>
    
    		<?php if ( bbp_has_forums() ) : ?>
    
    			<?php bbp_get_template_part( 'loop', 'forums' ); ?>
    
    		<?php endif; ?>
    
    		<?php if ( ! bbp_is_forum_category() && bbp_has_topics() ) : ?>
    
    			<?php bbp_get_template_part( 'pagination', 'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'loop',       'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'pagination', 'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'form',       'topic'     ); ?>
    
    		<?php elseif ( ! bbp_is_forum_category() ) : ?>
    
    			<?php bbp_get_template_part( 'feedback',   'no-topics' ); ?>
    
    			<?php bbp_get_template_part( 'form',       'topic'     ); ?>
    
    		<?php endif; ?>
    
    	<?php endif; ?>
    
    	<?php do_action( 'bbp_template_after_single_forum' ); ?>
    
    </div>
    <?php
    }
    else {
    ?>
    <div id="bbpress-forums" class="bbpress-wrapper">
    
    	<?php bbp_breadcrumb(); ?>
    
    	<?php bbp_forum_subscription_link(); ?>
    
    	<?php do_action( 'bbp_template_before_single_forum' ); ?>
    
    	<?php if ( post_password_required() ) : ?>
    
    		<?php bbp_get_template_part( 'form', 'protected' ); ?>
    
    	<?php else : ?>
    
    		<?php bbp_single_forum_description(); ?>
    
    		<?php if ( bbp_has_forums() ) : ?>
    
    			<?php bbp_get_template_part( 'loop', 'forums' ); ?>
    
    		<?php endif; ?>
    
    		<?php if ( ! bbp_is_forum_category() && bbp_has_topics() ) : ?>
    
    			<?php bbp_get_template_part( 'pagination', 'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'loop',       'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'pagination', 'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'form',       'topic'     ); ?>
    
    		<?php elseif ( ! bbp_is_forum_category() ) : ?>
    
    			<?php bbp_get_template_part( 'feedback',   'no-topics' ); ?>
    
    			<?php bbp_get_template_part( 'form',       'topic'     ); ?>
    
    		<?php endif; ?>
    
    	<?php endif; ?>
    
    	<?php do_action( 'bbp_template_after_single_forum' ); ?>
    
    </div>
    <?php } ?>

    and change whichever display you want

    #223247

    In reply to: Topic Sidebar

    Robin W
    Moderator

    you could try method 2 in this

    Step by step guide to setting up a bbPress forum – Part 1

    it might work, it might not 🙂

    #223218
    Ludovic S. Clain
    Participant

    Hi there 👋
    I followed this step by step guide
    👉 https://codex.bbpress.org/step-by-step-guide-to-setting-up-a-bbpress-forum/#3-%c2%a0creating-a-forum-page

    And I’m annoyed with one quirk that I can’t seem to resolve: My borders aren’t showing!
    With method # 1 my borders disappear and with method # 2 everything is normal.
    How can I fix this please?

    Screenshot display forums list issue

    My regards,
    Ludovic

    #223208
    Nigel M Rodgers
    Participant

    Hi,

    I just did something similar for Rank Math SEO plugin:

    
    
    /**
     * Sets bbPress user profile pages to noindex
     *
     * @param array $robots The meta robots directives.
     */
    add_filter( 'rank_math/frontend/robots', function( $robots ) {
        
        if (!bbp_is_single_user_profile()) {
            return $robots;
            }
        unset( $robots['index']);
        $robots['noindex'] = 'noindex';
        return $robots;
    });
    

    Cheers

    #223204
    jappan
    Participant
    add_filter('bp_email_use_wp_mail', function () {
        return true;
    });

    you should add this code in function.php

    #223185
    Robin W
    Moderator

    ok, the line

    echo esc_html__( 'You must be logged in to create new topics.', 'bbpress' ) . ' <a href="' . esc_url( thim_get_login_page_url() ) . '">' . esc_html__( 'Login here', 'bbpress' ) . '</a>';

    is doing the Login Here

    This line chooses the location from a setting in your theme thim_get_login_page_url()

    so I suspect it is as simple as changing that setting to the page you want it to say, so look at your theme settings

    If that doesn’t work, come back

    #223182
    cosmiclove1978
    Participant

    Hi Robin,

    Yes, I can see form-topic.php in the parent theme.

    <?php
    
    /**
     * New/Edit Topic
     *
     * @package bbPress
     * @subpackage Theme
     */
    
    ?>
    
    <?php if ( !bbp_is_single_forum() ) : ?>
    
    <div id="bbpress-forums">
    
    	<?php bbp_breadcrumb(); ?>
    
    <?php endif; ?>
    
    <?php if ( bbp_is_topic_edit() ) : ?>
    
    	<?php bbp_topic_tag_list( bbp_get_topic_id() ); ?>
    
    	<?php bbp_single_topic_description( array( 'topic_id' => bbp_get_topic_id() ) ); ?>
    
    <?php endif; ?>
    
    <?php if ( bbp_current_user_can_access_create_topic_form() ) : ?>
    
    	<div id="new-topic-<?php bbp_topic_id(); ?>" class="bbp-topic-form">
    
    		<form id="new-post" name="new-post" method="post" action="<?php the_permalink(); ?>">
    
    			<?php do_action( 'bbp_theme_before_topic_form' ); ?>
    
    			<fieldset class="bbp-form">
    				<legend>
    
    					<?php
    						if ( bbp_is_topic_edit() )
    							printf( __( 'Now Editing &ldquo;%s&rdquo;', 'bbpress' ), bbp_get_topic_title() );
    						else
    							bbp_is_single_forum() ? printf( __( 'Create New Topic in &ldquo;%s&rdquo;', 'bbpress' ), bbp_get_forum_title() ) : _e( 'Create New Topic', 'bbpress' );
    					?>
    
    				</legend>
    
    				<?php do_action( 'bbp_theme_before_topic_form_notices' ); ?>
    
    				<?php if ( !bbp_is_topic_edit() && bbp_is_forum_closed() ) : ?>
    
    					<div class="bbp-template-notice">
    						<p><?php _e( 'This forum is marked as closed to new topics, however your posting capabilities still allow you to do so.', 'bbpress' ); ?></p>
    					</div>
    
    				<?php endif; ?>
    
    				<?php if ( current_user_can( 'unfiltered_html' ) ) : ?>
    
    					<div class="bbp-template-notice">
    						<p><?php _e( 'Your account has the ability to post unrestricted HTML content.', 'bbpress' ); ?></p>
    					</div>
    
    				<?php endif; ?>
    
    				<?php do_action( 'bbp_template_notices' ); ?>
    
    				<div>
    
    					<?php bbp_get_template_part( 'form', 'anonymous' ); ?>
    
    					<?php do_action( 'bbp_theme_before_topic_form_title' ); ?>
    
    					<p>
    						<label for="bbp_topic_title"><?php printf( __( 'Topic Title (Maximum Length: %d):', 'bbpress' ), bbp_get_title_max_length() ); ?></label><br />
    						<input type="text" id="bbp_topic_title" value="<?php bbp_form_topic_title(); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_topic_title" maxlength="<?php bbp_title_max_length(); ?>" />
    					</p>
    
    					<?php do_action( 'bbp_theme_after_topic_form_title' ); ?>
    
    					<?php do_action( 'bbp_theme_before_topic_form_content' ); ?>
    
    					<?php bbp_the_content( array( 'context' => 'topic' ) ); ?>
    
    					<?php do_action( 'bbp_theme_after_topic_form_content' ); ?>
    
    					<?php if ( ! ( bbp_use_wp_editor() || current_user_can( 'unfiltered_html' ) ) ) : ?>
    
    						<p class="form-allowed-tags">
    							<label><?php _e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:','bbpress' ); ?></label><br />
    							<code><?php bbp_allowed_tags(); ?></code>
    						</p>
    
    					<?php endif; ?>
    
    					<?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags' ) ) : ?>
    
    						<?php do_action( 'bbp_theme_before_topic_form_tags' ); ?>
    
    						<p>
    							<label for="bbp_topic_tags"><?php _e( 'Topic Tags:', 'bbpress' ); ?></label><br />
    							<input type="text" value="<?php bbp_form_topic_tags(); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_topic_tags" id="bbp_topic_tags" <?php disabled( bbp_is_topic_spam() ); ?> />
    						</p>
    
    						<?php do_action( 'bbp_theme_after_topic_form_tags' ); ?>
    
    					<?php endif; ?>
    
    					<?php if ( !bbp_is_single_forum() ) : ?>
    
    						<?php do_action( 'bbp_theme_before_topic_form_forum' ); ?>
    
    						<p>
    							<label for="bbp_forum_id"><?php _e( 'Forum:', 'bbpress' ); ?></label><br />
    							<?php
    								bbp_dropdown( array(
    									'show_none' => __( '(No Forum)', 'bbpress' ),
    									'selected'  => bbp_get_form_topic_forum()
    								) );
    							?>
    						</p>
    
    						<?php do_action( 'bbp_theme_after_topic_form_forum' ); ?>
    
    					<?php endif; ?>
    
    					<?php if ( current_user_can( 'moderate' ) ) : ?>
    
    						<?php do_action( 'bbp_theme_before_topic_form_type' ); ?>
    
    						<p>
    
    							<label for="bbp_stick_topic"><?php _e( 'Topic Type:', 'bbpress' ); ?></label><br />
    
    							<?php bbp_form_topic_type_dropdown(); ?>
    
    						</p>
    
    						<?php do_action( 'bbp_theme_after_topic_form_type' ); ?>
    
    						<?php do_action( 'bbp_theme_before_topic_form_status' ); ?>
    
    						<p>
    
    							<label for="bbp_topic_status"><?php _e( 'Topic Status:', 'bbpress' ); ?></label><br />
    
    							<?php bbp_form_topic_status_dropdown(); ?>
    
    						</p>
    
    						<?php do_action( 'bbp_theme_after_topic_form_status' ); ?>
    
    					<?php endif; ?>
    
    					<?php if ( bbp_is_subscriptions_active() && !bbp_is_anonymous() && ( !bbp_is_topic_edit() || ( bbp_is_topic_edit() && !bbp_is_topic_anonymous() ) ) ) : ?>
    
    						<?php do_action( 'bbp_theme_before_topic_form_subscriptions' ); ?>
    
    						<p>
    							<input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe" <?php bbp_form_topic_subscribed(); ?> tabindex="<?php bbp_tab_index(); ?>" />
    
    							<?php if ( bbp_is_topic_edit() && ( bbp_get_topic_author_id() !== bbp_get_current_user_id() ) ) : ?>
    
    								<label for="bbp_topic_subscription"><?php _e( 'Notify the author of follow-up replies via email', 'bbpress' ); ?></label>
    
    							<?php else : ?>
    
    								<label for="bbp_topic_subscription"><?php _e( 'Notify me of follow-up replies via email', 'bbpress' ); ?></label>
    
    							<?php endif; ?>
    						</p>
    
    						<?php do_action( 'bbp_theme_after_topic_form_subscriptions' ); ?>
    
    					<?php endif; ?>
    
    					<?php if ( bbp_allow_revisions() && bbp_is_topic_edit() ) : ?>
    
    						<?php do_action( 'bbp_theme_before_topic_form_revisions' ); ?>
    
    						<fieldset class="bbp-form">
    							<legend>
    								<input name="bbp_log_topic_edit" id="bbp_log_topic_edit" type="checkbox" value="1" <?php bbp_form_topic_log_edit(); ?> tabindex="<?php bbp_tab_index(); ?>" />
    								<label for="bbp_log_topic_edit"><?php _e( 'Keep a log of this edit:', 'bbpress' ); ?></label><br />
    							</legend>
    
    							<div>
    								<label for="bbp_topic_edit_reason"><?php printf( __( 'Optional reason for editing:', 'bbpress' ), bbp_get_current_user_name() ); ?></label><br />
    								<input type="text" value="<?php bbp_form_topic_edit_reason(); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_topic_edit_reason" id="bbp_topic_edit_reason" />
    							</div>
    						</fieldset>
    
    						<?php do_action( 'bbp_theme_after_topic_form_revisions' ); ?>
    
    					<?php endif; ?>
    
    					<?php do_action( 'bbp_theme_before_topic_form_submit_wrapper' ); ?>
    
    					<div class="bbp-submit-wrapper">
    
    						<?php do_action( 'bbp_theme_before_topic_form_submit_button' ); ?>
    
    						<button type="submit" tabindex="<?php bbp_tab_index(); ?>" id="bbp_topic_submit" name="bbp_topic_submit" class="button submit"><?php _e( 'Submit', 'bbpress' ); ?></button>
    
    						<?php do_action( 'bbp_theme_after_topic_form_submit_button' ); ?>
    
    					</div>
    
    					<?php do_action( 'bbp_theme_after_topic_form_submit_wrapper' ); ?>
    
    				</div>
    
    				<?php bbp_topic_form_fields(); ?>
    
    			</fieldset>
    
    			<?php do_action( 'bbp_theme_after_topic_form' ); ?>
    
    		</form>
    	</div>
    
    <?php elseif ( bbp_is_forum_closed() ) : ?>
    
    	<div id="no-topic-<?php bbp_topic_id(); ?>" class="bbp-no-topic">
    		<div class="bbp-template-notice">
    			<p><?php printf( __( 'The forum ‘%s’ is closed to new topics and replies.', 'bbpress' ), bbp_get_forum_title() ); ?></p>
    		</div>
    	</div>
    
    <?php else : ?>
    
    	<div id="no-topic-<?php bbp_topic_id(); ?>" class="bbp-no-topic">
    		<div class="bbp-template-notice">
    			<p>
    				<?php
    				if(is_user_logged_in()) {
    					_e( 'You cannot create new topics.', 'bbpress' );
    				} else {
    					echo esc_html__( 'You must be logged in to create new topics.', 'bbpress' ) . ' <a href="' . esc_url( thim_get_login_page_url() ) . '">' . esc_html__( 'Login here', 'bbpress' ) . '</a>';
    				}
    				?>
    			</p>
    		</div>
    	</div>
    
    <?php endif; ?>
    
    <?php if ( !bbp_is_single_forum() ) : ?>
    
    </div>
    
    <?php endif; ?>
    
    #223158
    Robin W
    Moderator

    ok, delete ALL of the contents of form-user-login.php and instead put

    <a href="https://mydomain.com/login/">Login here</a>

    and that’s what will show 🙂

    #223155
    cosmiclove1978
    Participant

    Hi Robin!
    Thanks for your quick reply and assistance. But there’s only one major challenge (at least to me) I am currently facing, which I’ll describe below:

    Re: — “Then amend this file to take out the current form and put in a link”

    I get the “what” to-do part (i.e. amending file…, creating a folder in my child theme, etc) but as for the “how?”, I have absolutely no idea. In all humility, I make no pretense of familiarity with php syntax or anything php code-related.

    I see the <form>….</form> tags in my file below, should I remove it all and place https://mydomain.com/login?

    <?php
    
    /**
     * User Login Form
     *
     * @package bbPress
     * @subpackage Theme
     */
    
    // Exit if accessed directly
    defined( 'ABSPATH' ) || exit;
    
    ?>
    
    <form method="post" action="<?php bbp_wp_login_action( array( 'context' => 'login_post' ) ); ?>" class="bbp-login-form">
    	<fieldset class="bbp-form">
    		<legend><?php esc_html_e( 'Log In', 'bbpress' ); ?></legend>
    
    		<div class="bbp-username">
    			<label for="user_login"><?php esc_html_e( 'Username', 'bbpress' ); ?>: </label>
    			<input type="text" name="log" value="<?php bbp_sanitize_val( 'user_login', 'text' ); ?>" size="20" maxlength="100" id="user_login" autocomplete="off" />
    		</div>
    
    		<div class="bbp-password">
    			<label for="user_pass"><?php esc_html_e( 'Password', 'bbpress' ); ?>: </label>
    			<input type="password" name="pwd" value="<?php bbp_sanitize_val( 'user_pass', 'password' ); ?>" size="20" id="user_pass" autocomplete="off" />
    		</div>
    
    		<div class="bbp-remember-me">
    			<input type="checkbox" name="rememberme" value="forever" <?php checked( bbp_get_sanitize_val( 'rememberme', 'checkbox' ) ); ?> id="rememberme" />
    			<label for="rememberme"><?php esc_html_e( 'Keep me signed in', 'bbpress' ); ?></label>
    		</div>
    
    		<?php do_action( 'login_form' ); ?>
    
    		<div class="bbp-submit-wrapper">
    
    			<button type="submit" name="user-submit" id="user-submit" class="button submit user-submit"><?php esc_html_e( 'Log In', 'bbpress' ); ?></button>
    
    			<?php bbp_user_login_fields(); ?>
    
    		</div>
    	</fieldset>
    </form>

    My question is and where do I amend this form-user-login.php file with my login url https://mydomain.com/login/?

    If given a blueprint, I can certainly reproduce the steps faithfully when dealing with a similar issue

    Can you (or anyone willing) please pinpoint the parts/lines to modify with the url? Thanks so much in advance.

    #223140
    Sascha
    Participant

    Found solutions in an other forum, just to add in the functions.php:

    add_filter( 'get_the_archive_title', function ($title) {
    if ( is_category() ) {
        $title = single_cat_title( '', false );
    } elseif ( is_tag() ) {
        $title = single_tag_title( '', false );
    } elseif ( is_author() ) {
        $title = '<span class="vcard">' . get_the_author() . '</span>' ;
    } elseif ( is_tax() ) { //for custom post types
        $title = sprintf( __( '%1$s' ), single_term_title( '', false ) );
    } elseif (is_post_type_archive()) {
        $title = post_type_archive_title( '', false );
    }
    return $title;
    });
    #223130
    jappan
    Participant
    add_filter( 'bbp_get_form_reply_content', function( string $reply_content ) {
        if ( isset( $_GET['bbp_reply_to'] ) && (int) $_GET['bbp_reply_to'] ) {
            $display_name = get_the_author_meta( 'display_name', get_post_field( 'post_author', (int) $_GET['bbp_reply_to'] ) );
            return '@' . $display_name . PHP_EOL . $reply_content;
        }
    	return $reply_content;
    });

    You should add this code in “functions.php”.

    #223129
    cosmiclove1978
    Participant

    Hello Regnalf,

    I’m happy to report that your fix worked. I had to apply the new class to all the previous CSS code, but it did the trick!!!

    This is truly got the time to appreciate firsthand php notions such hook and filters, etc and see them at work. It was neat to be able to fine-tune the bbpress-index class vs bbpress and target one vs all parts of the site. I’m grateful.

    Pushing my luck a bit further and modeling your code above and another post I saw elsewhere, I was hoping to get a bit more granular in the way I applied my css to parts of the forum, so I tried this bit of code below to target individual topic pages (or replies?)
    but it didn’t work. If it’s not too much to ask, whenever it’s convenient for you or anyone, could you tell me if this code below somewhat does what you just provided me.

    function my_topic_class($classes) {
    	$classes[] = 'herman-topic-class';
    	return $classes;
    }
    add_filter( 'bbp_get_topic_class','my_topic_class' );

    Nowhere, when viewing the topic page or thread did I see the new class ‘herman-topic-class’ in the Inspect Element utility. With your code, the bbpress and bbpress-index appeared.
    thanks in advance for all the support.

    H

Viewing 25 results - 1,401 through 1,425 (of 32,432 total)
Skip to toolbar