Skip to:
Content
Pages
Categories
Search
Top
Bottom

Changing Submit button wording to Update


  • ajtruckle
    Participant

    @ajtruckle

    When we are editing a topic / reply it would be nice if I could change the wording of the Submit / Submitting button to Update / Updating. This would be more accurate feedback for the user.

    I am using the bbp style pack forum template.

Viewing 9 replies - 1 through 9 (of 9 total)

  • Robin W
    Moderator

    @robin-w

    //This function changes the text wherever it is quoted
    function change_translate_text( $translated_text ) {
    	if ( $translated_text == 'old text' ) {
    	$translated_text = 'new text';
    	}
    	return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text', 20 );

    ajtruckle
    Participant

    @ajtruckle

    Thank you. I think the problem I am going to have though is that for new topics, the right words are still Submit / Submitting. It is only editing topics that need the words replaced.

    Wouldn’t the above code replace in code contexts, based on your comment preceding the code?


    Robin W
    Moderator

    @robin-w

    then you need to amend form-topic and form-reply

    to amend

    <button type="submit" tabindex="<?php bbp_tab_index(); ?>" id="bbp_topic_submit" name="bbp_topic_submit" class="button submit"><?php _e( 'Submit', 'bbpress' ); ?></button>

    to something like (untested)

    <?php if ( bbp_allow_revisions() && bbp_is_topic_edit() ) : ?>
    <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 endif ; ?>
    <?php else : ?>
    <button type="submit" tabindex="<?php bbp_tab_index(); ?>" id="bbp_topic_submit" name="bbp_topic_submit" class="button submit"><?php _e( 'Update', 'bbpress' ); ?></button>
    <?php endelse : ?>
    

    Robin W
    Moderator

    @robin-w

    ‘updating..’ beyond my current time avaailability


    ajtruckle
    Participant

    @ajtruckle

    Thanks for this. I have now successfully created a child theme (I think) and it is live on my site.

    I am trying to find where your previous instructions are. If I recall, you said I should replicate the path to the stated files under the child theme folder? And put them there and they will be picked up?

    If so, I might give it ago. But not until I get my head around “Submitting” which I see is in the functions file.

    One step at a time.


    Robin W
    Moderator

    @robin-w

    You can copy all the templates across, but you only need to copy those that you want to change, and it is better just to do this, as then you know which you have altered.

    so if you wanted to amend loop-single-forum you would do the following

    create a directory on your theme called ‘bbpress’
    ie wp-content/themes/%your-theme-name%/bbpress

    where %your-theme-name% is the name of your theme

    find
    wp-content/plugins/bbpress/templates/default/bbpress/loop-single-forum.php
    Make a copy of this file, and put in in the directory called bbpress that you created above, so you end up with
    wp-content/themes/%your-theme-name%/bbpress/loop-single-forum.php
    bbPress will now use this template instead of the original
    and you can amend this


    ajtruckle
    Participant

    @ajtruckle

    Understood.

    This is the code in the functions php that needs updating:

    function bsp_load_spinner_topic () {
    	global $bsp_style_settings_form ;
    	//preload spinner so it is ready - css hides this
    	echo '<div id="bsp-spinner-load"></div>' ;
    	//add button - hidden by css
    	echo '<button type="submit" id="bsp_topic_submit" name="bbp_topic_submit" class="button submit">' ;
    	//leave as is if field is blanked (user may just want spinner)
    	$value = (!empty($bsp_style_settings_form['SubmittingSubmitting']) ? $bsp_style_settings_form['SubmittingSubmitting']  : '') ;
    	echo $value ;
    	//then add spinner if activated
    	if (!empty( $bsp_style_settings_form['SubmittingSpinner'])) echo '<span class="bsp-spinner"></span>' ;
    	//then finish button
    	echo '</button>' ;
    }
    	
    	
    function bsp_load_spinner_reply () {
    	global $bsp_style_settings_form ;
    	//preload spinner so it is ready - css hides this
    	echo '<div id="bsp-spinner-load"></div>' ;
    	//add button - hidden by css
    	echo '<button type="submit" id="bsp_reply_submit" name="bbp_reply_submit" class="button submit">' ;
    	//leave as is if field is blanked (user may just want spinner)
    	$value = (!empty($bsp_style_settings_form['SubmittingSubmitting']) ? $bsp_style_settings_form['SubmittingSubmitting']  : '') ;
    	echo $value ;
    	//then add spinner if activated
    	if (!empty ( $bsp_style_settings_form['SubmittingSpinner'])) echo '<span class="bsp-spinner"></span>' ;
    	//then finish button
    	echo '</button>' ;
    }

    Specifically:

    	//leave as is if field is blanked (user may just want spinner)
    	$value = (!empty($bsp_style_settings_form['SubmittingSubmitting']) ? $bsp_style_settings_form['SubmittingSubmitting']  : '') ;
    	echo $value ;
    

    So it looks to see if the user has entered a value in the settings for “Submitting” and if it is not empty echos it, else it echos nothing. Do functions like bbp_allow_revisions() work in this context?


    Robin W
    Moderator

    @robin-w

    as I said ‘updating..’ beyond my current time avaailability


    ajtruckle
    Participant

    @ajtruckle

    😀 Yep

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