Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 3,451 through 3,475 (of 32,481 total)
  • Author
    Search Results
  • Robin W
    Moderator

    so where are you placing this code ? eg in a page template?

    #205140
    Robin W
    Moderator

    bbp_is_user_subscribed_to_topic()

    bbp_is_user_favorite( $user_id, $topic_id );

    berry metal
    Participant

    I want to output bbPress single topic shortcodes with different IDs, through my single post template.

    On post with the title “A” shortcode [bbp-single-topic id=6041], on post with the title “B” shortcode [bbp-single-topic id=6042], etc…

    And the matching I need it via title strings, meaning that the topic with id 6041 would have the title “A”, and the topic with id 6042 would have the title “B”.

    How to achieve this, and what would be the dynamic query?

    I am using bbPress instead of comments, as they are post type, and I want to use this advantage.

    #205138

    In reply to: bbpress Loop Argument

    Robin W
    Moderator

    given that

    get_template_part( ‘template-parts/topic’, ‘card’ );

    is from your theme (or other plugin) not bbpress, not sure what is taking the pagination.

    the usual solution would be to parse args eg

    add_filter ('bbp_before_has_topics_parse_args', rew_has_topics') ;
    
    function rew_has_topics( $args = '' ) {
    	$args['posts_per_page'] = '-1' ;
    return $args;
    }
    #205137
    Babblebey
    Participant

    Thank you very much.

    If only the codex https://codex.bbpress.org/developer/ was completed.

    Please, I might need the same for if A TOPIC is Favourited and if a TOPIC is Subscribed to

    #205136
    Robin W
    Moderator

    bbp_is_user_subscribed_to_forum($forum)

    Babblebey
    Participant

    Hello there,

    Thank you for viewing this thread.

    I am trying to set a button for based on users current forum subscription status

    When a User “is not Subcribed” to Current Forum

     
    <button type="button" class="btn-lg omna-btn-green shadow-sm" id="forum-subscription-btn"><i class="fa fa-bell"></i> <?php bbp_forum_subscription_link(); ?></button>
    <p>Subscribe to this forum and get updates on latest topics</p>
    

    screenshot-localhost-2019-11-01-17-05-28

    When a User “is Subscribed” to Current Forum

     
    <button type="button" class="btn-lg omna-btn-green shadow-sm" id="forum-subscription-btn"><i class="fa fa-bell-slash"></i> <?php bbp_forum_subscription_link(); ?></button>
    <p>Unsubscribe from this forum and stop receiving updates on latest topics</p>
    

    screenshot-localhost-2019-11-01-17-09-06

    So My Code is suppose to look something like

    
    <?php if (user_is_subcribed_to_this_forum): ?>
        <button type="button" class="btn-lg omna-btn-green shadow-sm" id="forum-subscription-btn"><i class="fa fa-bell-slash"></i> <?php bbp_forum_subscription_link(); ?></button>
        <p>Unsubscribe from this forum and stop receiving updates on latest topics</p>
    <?php else: ?>
        <button type="button" class="btn-lg omna-btn-green shadow-sm" id="forum-subscription-btn"><i class="fa fa-bell"></i> <?php bbp_forum_subscription_link(); ?></button>
        <p>Subscribe to this forum and get updates on latest topics</p>
    <?php endif; ?>
    

    The right function to use in-place of user_is_subcribed_to_this_forum is what i seek.

    Thanking you in anticipation of a working response.

    #205134
    Babblebey
    Participant

    Hello there,

    Thank you for viewing this thread.

    I have a sidebar on the Homepage of my website that should list latest forum topics. But the number of topics listed is being determined by the “number of topics” set per-page in the “Forum Settings”.

    Is there a way to setup an argument($args) similarly to that of the new WP_Query($args) to set a custom of topics per-page.?

    Here’s my query:

    
    <!--Sidebar Start-->
                <div class="col-md-4">
                          <div class="sidebar-topics row sticky-top">
                              <div class="col-md-12 col-sm-12 col-12 ml-2 mb-2 p-1">
                                    <h3 class="">Latest Forum Topic</h3>
                              </div>
                              <div class="col-md-12 col-sm-12 col-12">
                            <?php
                                if ( bbp_has_topics() ):
                                    while ( bbp_topics() ) : bbp_the_topic();
                                        get_template_part( 'template-parts/topic', 'card' );
                                    endwhile;
                                endif;
                              ?>
                            </div>
                      </div>
                </div>
    <!--Sidebar Ends-->
    
    #205125
    Chuckie
    Participant

    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?

    #205103
    Robin W
    Moderator

    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 : ?>
    
    #205102
    Chuckie
    Participant

    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?

    #205101
    Robin W
    Moderator
    //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 );
    #205099
    Chuckie
    Participant

    After using the code tweak ($args['teeny'] = false;) I was then able to use this snippet:

    add_filter("mce_buttons", "tinymce_editor_buttons", 99); //targets the first line
    ​
    function tinymce_editor_buttons($buttons) {
    return array(
      "formatselect", 
      "bold",
      "italic",
      "underline",
      "bullist",
      "numlist",
      "blockquote",
      "justifyleft",
      "justifycenter",
      "justifyright",
      "code",
      "link",
      "unlink",
      "image",
      "wp_adv"
      //add more here...
      );
    }
    drjohndimi
    Participant

    Hello All.
    I think this would be a great feature to have. Once a user creates/submits a topic, a popup appears and prompts the user to share his/her post on FB, Twitter or Whatsapp (possibly with the button in the notification message.

    Is there already a solution to this out there (maybe in a plugin or helpful code).

    Thank you for your time.

    JD

    #205097
    Chuckie
    Participant

    I tried sending a post using a non-admin user, with the TEXT editor and thus 3 hrefobjects and it still simply went through the system. Just thought I mention.

    #205092
    Robin W
    Moderator

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

    item 3 method 2 and you can put introductory text before the shortcode

    #205078
    Chuckie
    Participant

    I tried the code above and I get all the buttons.

    But it is missing the Insert Image button.

    #205046

    In reply to: Working Member List?

    Chuckie
    Participant

    Thanks for this plugin. Sorry if this is a dumb question – but suppose I add this as a a plugin, how do I actually use it to present data on a page? A shortcode?

    #205045
    John
    Participant

    I’m having the same issue with bbPress email notifications coming through as HTML code. I’m using the BuddyBoss theme and platform and have reached out to their support for help, but haven’t found a solution yet.


    @avaiya
    Did you ever find a solution to this? If so, what was it?

    #205038
    Robin W
    Moderator

    untested, but this might do it

    add_filter( 'bbp_get_reply_author_display_name' , 'rew_reply_change_to_login', 10 , 2 ) ;
    
    function rew_reply_change_to_login ($author_name, $reply_id) {
    	// Get the author ID
    	$author_id = bbp_get_reply_author_id( $reply_id );
    	$author_name = get_the_author_meta( 'user_login', $author_id );
    return $author_name ;
    }
    
    add_filter( 'bbp_get_topic_author_display_name' , 'rew_topic_change_to_login', 10 , 2 ) ;
    
    function rew_topic_change_to_login ($author_name, $topic_id) {
    	// Get the author ID
    	$author_id = bbp_get_topic_author_id( $topic_id );
    	$author_name = get_the_author_meta( 'user_login', $author_id );
    return $author_name ;
    }

    let me know

    #205030
    tomijolkkonen
    Participant

    Ok yes, starting with I’m completely new to this and I need to redesign my Father in laws, forum website. This would be my first time doing this and he said that there is no hurry as he heard from my wife that I know how to code but the thing is I’m only at the basics of C# so not sure if any use here but on to the point.

    So he is not able to connect to the old website host site because I dont think it really exists anymore and/or was transferred to another host service. But he has a backup from the old database that used phpBB and he is not really willing to part with everything that was stored in that forum as it contains over 10 years of garthered info on the matter which is central to the forum. So I don’t feel that copying every post would be really a good way as there are around 200k posts on it.
    So I have a wordpress site setup with BBpress and have the basics and the serviceprovider has the database on phpmyadmin. I’m looking to use the backup to somehow have the posts etc showup without messing with the actual site but im ok even if it wipes the new design.

    I have tried using bbPress import tool but to no avail. I have not found any info considering this. So the old site is still active but I have no access to the old database but I have the old backup. The import tool did not make much sense to me but I tried.For example I am not sure do I use the root name when typing in the database name in the import tool so I have tried to look for a deeper explanation.Also I dont know how the old posts would show up in bbPress.

    #205000
    Robin W
    Moderator

    I dug into this a bit further

    The moderation in bbpress is looking for ‘<href…’ so if you just post links ie

    you post this

    https://bbpress.org/forums/topic/posts-with-3-or-more-links/

    not this

    <a href="https://bbpress.org/forums/topic/posts-with-3-or-more-links/">some link</a>

    then no check is done – it is looking for links not urls

    There is some capability in the code via

    $reply_content = apply_filters( 'bbp_new_reply_pre_content', $reply_content );

    to take out more than 2 links, but there is not an easy way to put 3 urls into moderation

    #204997
    Robin W
    Moderator

    untested but try

    if ( current_user_can( 'subscriber' ) ) {
    add_action('wp_before_admin_bar_render', 'rew_admin_bar_remove_wp_profile', 0);
    add_action('admin_bar_menu', 'rew_add_bbp_profile', 999);
    }
     
     
    function rew_admin_bar_remove_wp_profile() {
            global $wp_admin_bar;
    
            /* **edit-profile is the ID** */
            $wp_admin_bar->remove_menu('edit-profile');
     }
     
    
    function rew_add_bbp_profile($wp_admin_bar) {
    	
    			$current_user = wp_get_current_user();
    			$user=$current_user->user_nicename  ;
    			$user_slug =  get_option( '_bbp_user_slug' ) ;
    			if (get_option( '_bbp_include_root' ) == true  ) {	
    				$forum_slug = get_option( '_bbp_root_slug' ) ;
    				$slug = $forum_slug.'/'.$user_slug.'/' ;
    			}
    			else {
    				$slug=$user_slug . '/' ;
    			}
    			
    			$profilelink = '/' .$slug. $user . '/edit' ;
    			
    			$wp_admin_bar->add_node( array(
    				'parent' => 'user-actions',
    				'id'		=> 'bbp-edit-profile',
    				'title' => 'Edit Profile',
    				'href' => $profilelink,
    			) );
    
    }
    #204993
    madflute
    Participant

    Thank you so so so much! This code is working great. Just one last thing. How can I make this code run only when the user role is Subscriber? -Hiro

    #204987
    Chuckie
    Participant

    This works:

    // Redirect Registration Page
    function my_registration_page_redirect()
    {
        global $pagenow;
     
        // Standard Registration Redirect
        if ( (strtolower($pagenow) == 'wp-login.php') && (strtolower($_GET['action']) == 'register') ) {
            wp_redirect( home_url('/register/') );
        }
      
        // Redirection after successful registration
        if ( (strtolower($pagenow) == 'wp-login.php') && (strtolower($_GET['checkemail']) == 'registered') ) {
            wp_redirect( home_url('/registration-complete/') );
        }
    }
     
    add_filter( 'init', 'my_registration_page_redirect' );
Viewing 25 results - 3,451 through 3,475 (of 32,481 total)
Skip to toolbar