Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 5,001 through 5,025 (of 32,518 total)
  • Author
    Search Results
  • #186155
    leonliang
    Participant

    Hello,

    I wonder if there is any shortcode that Display Topics that Contain Certain Words? Looks like the documentation doesn’t have any content about this.

    Thank you!
    Leon

    #186152
    ougurlog
    Participant
    case 'popular' :
    				$topics_query = array(
    					'post_type'           => bbp_get_topic_post_type(),
    					'post_parent'         => $settings['parent_forum'],
    					'posts_per_page'      => (int) $settings['max_shown'],
    					'post_status'         => array( bbp_get_public_status_id(), bbp_get_closed_status_id() ),
    					'ignore_sticky_posts' => true,
    					'no_found_rows'       => true,
    					'meta_key'            => '_bbp_reply_count',
    					'orderby'             => 'meta_value',
    					'order'               => 'DESC'
    
    				);
    				break;
    

    I want to show just topics posted in a day

    #186140
    rajesh896
    Participant

    Make sure you’ve created a custom page titled “new topic” with a friendly url of “new-topic”

    Place the new shortcode we registered into this page:

    [wpmu_bbp_topic]

    This will automatically display contact create form of the selected forum if ID exists in the URL otherwise fall back to default shortcode.

    You can see it in action on my site:
    happy deepavali images 2017

    #186138
    rajesh896
    Participant

    Make sure you’ve created a custom page titled “new topic” with a friendly url of “new-topic”

    Place the new shortcode we registered into this page:

    [wpmu_bbp_topic]

    This will automatically display contact create form of the selected forum if ID exists in the URL otherwise fall back to default shortcode.

    You can see it in action on my site:
    happy deepavali images

    #186137
    willad
    Participant

    Hello, I have also been trying to get a new topic button working for some time. In case it is of help to anyone, this is what seems to work for me.

    I created a wordpress page template “forum.php” and added the following code – it adds a ‘New Question’ button to the forum page but not if it’s the parent forum:

    <?php
    get_header(); 
    
    while ( have_posts() ) : the_post();
    if((($post_type = get_post_type()) == 'forum') ) //make sure we are on a forum
    {
      if(bbp_get_forum_id() != 0) //don't add the button to the parent forum
      {
        ?>
        <a href="<?php echo esc_url( add_query_arg( 'c', bbp_get_forum_id( ), site_url( '/new-topic/' ) ) )?>">New Question</a>
        <?php
      }
    }
    the_content();
    endwhile; // End of the loop.    
    ?>
    <?php get_footer();

    Now when I click the New Question link it opens the page new-topic and the forum I was on when I pressed the button is the forum the new question will be placed in.

    new-topic is a page I created in wordpress, and I gave it a template page-new-topic.php

    It contains the following code:

    <?php
    get_header(); 
    $my_c = get_query_var( 'c' );
    $forum_add_topic='[bbp-topic-form forum_id='.$my_c.']';
    echo do_shortcode($forum_add_topic);
    ?>
    <?php get_footer();

    The line

    <a href="<?php echo esc_url( add_query_arg( 'c', bbp_get_forum_id( ), site_url( '/new-topic/' ) ) )?>">New Question</a>

    in forum.php adds a variable c (which contains the current forum id() -bbp_get_forum_id( ) ) to the url when New Question is clicked.

    In page-new-topic.php this variable c is added to the shortcode [bbp-topic-form forum_id=XXX]

    do_shortcode then runs the shortcode which creates the form.

    I also had to add the following to functions.php to tie the two pages together:

    function add_custom_query_var( $vars ){
      $vars[] = "c";
      return $vars;
    }
    add_filter( 'query_vars', 'add_custom_query_var' );

    You could add this as a plugin if you wish.

    The idea for the shortcode came from this post: post

    How to pass variables through wordpress urls came from this post:

    post-2

    I am new to WordPress and PHP so there may be better ways of doing this but, as I said, this seems to work.

    andrewkusuma
    Participant

    I want to remove/disable totally changing email input value from form-user-edit without using hidden input

    <input type="hidden" name="email" id="email" value="<?php bbp_displayed_user_field( 'user_email', 'edit' ); ?>" class="regular-text" tabindex="<?php bbp_tab_index(); ?>" />

    I want user only change display name, bio, and password only how to do it?

    #186131
    gihan1992
    Participant

    In my forum once i create a user and then going to edit his/her profile edit.php redirects to groups. I couldn’t find any code issue. Help me. Thanks in advance.

    #186128
    gihan1992
    Participant

    In my forum once i create a user and then going to edit his/her profile edit.php redirects to groups. I couldn’t find any code issue. Help me. Thanks in advance.

    jeroi
    Participant

    I have newest WordPress and used it to add bbPress. How ever I have added forum as shortcode to my siten page. How ever When is use top menu to add new topic the box where I chose relative parent category till example gaiming, sell, buy does not work. The box is full of those categoires where to put that topic but I cannot select any one of them only no parent stays selected.

    Is there somehow how I cand fix this?

    #186107
    jstuts5797
    Participant

    Hey there guys… there is a specific element on my bbpress forum that I need to customise and I’ve been through the style crib, the bbpress style sheet, and even the bbpress style pack plugin and can’t sem to find in the code anywhere that will help me customize this element. I have a screen shot but now I realize I can’t use screen shots here. The element is the Reply To: element. I know how to make it non transparent… but I can’t figure out where to set that text color at all. The actual text “Reply To” needs to be a different color so it can be seen. I also think there is a glitch in the boarder as well. Any help would be awesome. Here is a link to my screenshot: http://fjrmbfans.us/wp-content/uploads/2017/08/FORUMscreenshot.jpg you’ll see my issue in the bottom portion. Thanks again for all your help!

    #186105
    nobita
    Participant

    Hi I have same error

    PHP7.1
    bbpress2.5.13

    bbpress/includes/forum/functions.php line:1800

    PHP Fatal error: Uncaught Error: [] operator not supported for strings

    			//$post_stati[] = bbp_get_public_status_id();
    			$post_stati = (array) bbp_get_public_status_id();
    

    It worked for me

    #186088
    bullarni
    Participant

    Hey All

    Forgive me if this has already been discussed but I was wondering if a fix to the pagination links of threads with 100 or more pages of replies has been resolved as part of 2.6?

    The issue is discussed here along with code that resolves the problem:

    Links to last post are wrong (pagination issue?)

    Thanks!

    #186087
    abernreiter
    Participant

    wordpress version. 4.8.1
    bbPress version 2.5.11
    BuddyPress version 2.9.0

    Website: http://forum.epp-forum.com/

    We use the shortcode [bbp-topic-index] on our homepage. In this listing are also displayed topics, to which one has access only if one is logged in.
    These topics should not be displayed if you are not logged in. How can we prevent it?

    Show only if logged

    Click on Zeppy then this screen comes. So a blocked contribution

    Thank you for help

    #186086
    jagdishtechnostacks
    Participant

    Hi, you can use this in functions.php or somewhere where you initialize your code
    /* Redirect to Splash screen if Non Admin */
    function loginRedirect( $redirect_to, $request, $user ) {
    return ( is_array( $user->roles ) && in_array( ‘administrator’, $user->roles ) ) ? admin_url() : site_url(“home/”);
    }
    add_filter( ‘login_redirect’, ‘loginRedirect’, 10, 3 );
    /* Ends */

    #186079
    Dave
    Participant

    I’m confused by the logic in this system, and it’s likely because I don’t know what I’m doing.

    I have a page titled, “Team Discussions” with the shortcode [bbp-forum-index] in the editor.

    On the Forum Settings page, are the following settings:

    Forum Root Slug > Forum Root = forums

    Single Forum Slugs > Forum = forum

    I have a site-wide navigation menu link from that same Team Discussions page (http://…/team-discussions/&#8221;. When I click on it, this takes me to a page that shows the forum index. Awesome!

    But when in a sub forum for example, “Closing the Sale” (http://…/forums/forum/closing-sale/), and I click on the breadcrumb, “Home, Forums” specifically “Forums,” it redirects to a page URL of http://…/forums/&#8221;.

    What am I doing wrong?

    #186077

    In reply to: bbp-forum-index issues

    lhexy
    Participant

    after add the code,
    function bbp_increase-forum-per-page( $args = array() ) {
    $args[‘posts_per_page’] = get_option( ‘_bbp_forums_per_page’, 100 );
    return $args;
    }
    add_filter( ‘bbp_before_has_forums_parse_args’, ‘bbp_increase-forum-per-page’ );

    I got an error

    /clickandbuilds/…/wp-content/themes/…./functions.php on line 207

    As a result, I cannot open any page. Please help.

    #186062
    SimonScott
    Participant

    I was removing the BBPRESS plugin from my wordpress install, following these instructions:

    Deleting bbPress

    But after I deleted, the screen locked up, and now my website will not load.

    Please try http://www.kambocleanse.com

    Can anybody help me – can pay $$$ to get my site back up.

    Thanks

    Simon
    inbox@simon-scott.com

    #186060

    In reply to: Cant access forum

    Robin W
    Moderator

    Suspect you are using php 7.1
    so 3 fixes
    1. downgrade to a lesser version of php
    2. upgrade to bbpress 2.6rc3
    3. in bbpress 2.5.13 in includes/forums/functions.php
    change line 1851 from
    $meta_query = $posts_query->get( ‘meta_query’ );
    to
    $meta_query = $posts_query->get( ‘meta_query’, array() );
    and change line 1796 from

    $post_stati = $posts_query->get( 'post_status' );
    

    to

    $post_stati = $posts_query->get( ‘post_status’ ); 
    if (!is_array($post_stati)){
        			$post_stati = array($post_stati);
    }
    
    #186056
    michent1
    Participant

    I ended up having to dig this snippet backup for a new project and made some tweaks.


    @struth
    Updated to only output if user is logged in.

    
    	/**
    	 * Generate BBpress Edit Profile Link in a shortcode
    	 *
    	 * @param $atts, text|class
    	 * @example [bbp_edit_profile text="Edit My Profile" class"my-link-style"]
    	 * @return string|void
    	 *
    	 */
    	function bbp_edit_profile_link( $atts ) {
    		
    		//If user isn't logged in, return nothing
    		if(!is_user_logged_in()) {
    			return;
    		} else {
    			
    			extract( shortcode_atts( array(
    				                         'text'  => "",  // default value if none supplied
    				                         'class' => "" //Style class for link
    			                         ), $atts ) );
    			
    			if ( $text ) {
    				$current_user = wp_get_current_user();
    				$user         = $current_user->user_login;
    				
    				return '<a class="' . $class . '" href="/forums/users/' . $user . '/edit">' . $text . '</a>';
    				
    			}
    		}
    	}
    	
    	add_shortcode( 'bbp_edit_profile', 'bbp_edit_profile_link' );
    
    #186053
    Robin W
    Moderator

    kicked it round some more, and got to this as a better answer

    add_filter( 'bbp_get_caps_for_role', 'rew_moderator', 10, 2);
    
    function rew_moderator ($caps, $role) {
    	if ($role == bbp_get_moderator_role() ) {
    		$caps['edit_others_forums'] = true ;
    		$caps['delete_forums'] = true ;
    		$caps['delete_others_forums'] = true ;
    	}
    return $caps ;
    }
    
    add_filter ('bbp_map_forum_meta_caps', 'rew_mod', 10,4) ;
    
    function rew_mod ( $caps, $cap, $user_id, $args) {
    	switch ( $cap ) {
    	
    	case 'bbp_forums_admin'  :
    		if ( user_can( $user_id, 'moderate' ) ) {
    				$caps = array( 'moderate' );
    		}
    		
    	case 'edit_forums'         :
    	case 'edit_others_forums'  :
    	
    		if ( user_can( $user_id, 'moderate' ) ) {
    				$caps = array( 'moderate' );
    		}
    	
    	}
    	
    return $caps ;
    }
    #186039
    Robin W
    Moderator

    ok, I’ve been kicking this around for the last 3 hours!!

    Capabilities are spread all over the files in bbpress, so it’s taken a while to get to something.

    But I’ve learnt some good stuff along the way !!

    This is close to a perfect solution, and seems workable

    add_filter ('bbp_register_forum_post_type', 'rew_change') ; 
    
    function rew_change () {
    	$rew = array(
    				'labels'              => bbp_get_forum_post_type_labels(),
    				'rewrite'             => bbp_get_forum_post_type_rewrite(),
    				'supports'            => bbp_get_forum_post_type_supports(),
    				'description'         => __( 'bbPress Forums', 'bbpress' ),
    				'capabilities'        => bbp_get_topic_caps(),
    				'capability_type'     => array( 'forum', 'forums' ),
    				'menu_position'       => 555555,
    				'has_archive'         => bbp_get_root_slug(),
    				'exclude_from_search' => true,
    				'show_in_nav_menus'   => true,
    				'public'              => true,
    				'show_ui'             => current_user_can( 'moderate' ),
    				'can_export'          => true,
    				'hierarchical'        => false,
    				'query_var'           => true,
    				'menu_icon'           => ''
    			) ;
    	return apply_filters( 'rew_change', $rew );
    }
    
    add_filter( 'bbp_get_caps_for_role', 'rew_moderator', 10, 2);
    
    function rew_moderator ($caps, $role) {
    	if ($role == bbp_get_moderator_role() ) {
    		$caps['edit_others_forums'] = true ;
    		$caps['delete_forums'] = true ;
    		$caps['delete_others_forums'] = true ;
    		$caps['publish_forums'] = true ;
    		$caps['read_private_forums'] = true ;
    		$caps['read_hidden_forums'] = true ;
    		$caps['edit_forums'] = true ;
    				
    	}
    
    return $caps ;
    	
    }

    The line

    'capabilities' => bbp_get_topic_caps(),

    should say

    'capabilities' => bbp_get_forum_caps(),

    and my 2nd filter should then make that work, but for whatever reason it doesn’t.

    But as it gives the topic permissions which for a moderator are what you want for forums, it should be fine.

    #186038
    JC
    Participant

    Hello all, I’m using WordPress 8.0 and bbPress2.5.13.

    I have added this function to add the visual tab to the editor:

    function enable_visual_editor( $args = array() ) {
        $args['tinymce'] = true;
        return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'enable_visual_editor' );

    When I signed in as admin is everything OK, the editor tab is selected by default and I can start to type. However, when I do as a participant no tabs are selected and I have to select one of them in order to start to type. This is not intuitive at all for participants that want to write a post in the forum and eventually they will leave.

    Why is happening that? Can anyone give me support? Thank you in advance 🙂

    Robin W
    Moderator

    try this in the additional css of the theme

    dashboard>appearance>customise>additional css

    .entry-header, .entry-content, .entry-summary, .entry-meta {
        max-width: 604px;
       }

    and amend max width to whatever you want

    #186035
    Robin W
    Moderator

    you need to get bbpress to use the correct theme template

    see

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

    item 8

    #186027

    In reply to: group forum slug

    Georgio
    Participant

    If you find a solution, i take ! I need similare slug

    Just a workaround:

    //This function changes the text wherever it is quoted

    function change_translate_text( $translated_text ) {
    	if ( $translated_text == 'x' ) {
    	$translated_text = 'y';
    	}
    	return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text', 20 );

    Give it a try only if you have slugs that are not ordinary words. Unfortunately I cannot use it for forum, since everytime a user writes “forum” it will be translated.

Viewing 25 results - 5,001 through 5,025 (of 32,518 total)
Skip to toolbar