Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 10,551 through 10,575 (of 32,521 total)
  • Author
    Search Results
  • #152651
    robsward
    Participant

    Hi,

    I’m trying to retrieve a simple list of all forums on a site, for which I need to have a loop. I’m trying to create one from within a class in my plugin using this function:

    public function forum_list(){
    
    	$forums		= array();
    
    	if ( bbp_has_forums() ) {
    		while ( bbp_forums() ) {
    
    			bbp_the_forum();
    
    			$forum_id = bbp_get_forum_id();
    			$forum_name = bbp_get_forum_title();
    			$data = array( 'ID' => $forum_id, 'name' => $forum_name );
    
    			$forums[] = $data;
    
    		} // while()
    	} // if()
    
    	return $forums;
    
    } // get_forum_list()

    Which is called inside the construcor like so:

    $this->forums = $this->forum_list();

    This is telling me there is no object (Call to a member function get() on a non-object). The function works perfectly well outside the class, but inside it fails. What am I missing?

    #152629

    In reply to: BBPress Awards Plugin

    Robkk
    Moderator

    there are two reward type plugins that integrate with bbpress i know off the top of my head.

    https://wordpress.org/plugins/mycred/
    https://wordpress.org/plugins/achievements/

    and maybe more.

    But i mean if you really have something different and unique then make the plugin.

    but hey if your just looking for plugins to develop for bbpress i wouldnt be mind if you fork this.

    https://github.com/master5o1/bbPress-Post-Toolbar

    this plugin just isnt structured well, it really slows down a site too, but has alot of good elements.

    or combine some elements of this editor to give a responsive bbcode editor, i wouldnt mind at all.

    https://github.com/wbb/WysiBB

    #152627

    In reply to: Full Width Forum Pages

    bertusschoeman
    Participant

    Hi there, thank you for the swift response. I am currently using bbpress, as stated above. I read trough and implemented the information you linked me to, but still no luck. Here is the code in my theme’s page.php file. Maybe you can help me since I can not seem to figure out the code šŸ™‚

    <?php
    
    get_header();
    
    $is_page_builder_used = et_pb_is_pagebuilder_used( get_the_ID() );
    
    ?>
    
    <div id="main-content">
    
    <?php if ( ! $is_page_builder_used ) : ?>
    
    	<div class="container">
    		<div id="content-area" class="clearfix">
    			<div id="left-area">
    
    <?php endif; ?>
    
    			<?php while ( have_posts() ) : the_post(); ?>
    
    				<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    				<?php if ( ! $is_page_builder_used ) : ?>
    
    					<h1 class="main_title"><?php the_title(); ?></h1>
    				<?php
    					$thumb = '';
    
    					$width = (int) apply_filters( 'et_pb_index_blog_image_width', 1080 );
    
    					$height = (int) apply_filters( 'et_pb_index_blog_image_height', 675 );
    					$classtext = 'et_featured_image';
    					$titletext = get_the_title();
    					$thumbnail = get_thumbnail( $width, $height, $classtext, $titletext, $titletext, false, 'Blogimage' );
    					$thumb = $thumbnail["thumb"];
    
    					if ( 'on' === et_get_option( 'divi_page_thumbnails', 'false' ) && '' !== $thumb )
    						print_thumbnail( $thumb, $thumbnail["use_timthumb"], $titletext, $width, $height );
    				?>
    
    				<?php endif; ?>
    
    					<div class="entry-content">
    					<?php
    						the_content();
    
    						if ( ! $is_page_builder_used )
    							wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'Divi' ), 'after' => '</div>' ) );
    					?>
    					</div> <!-- .entry-content -->
    
    				<?php
    					if ( ! $is_page_builder_used && comments_open() && 'on' === et_get_option( 'divi_show_pagescomments', 'false' ) ) comments_template( '', true );
    				?>
    
    				</article> <!-- .et_pb_post -->
    
    			<?php endwhile; ?>
    
    <?php if ( ! $is_page_builder_used ) : ?>
    
    			</div> <!-- #left-area -->
    
    			<?php get_sidebar(); ?>
    			
    		</div> <!-- #content-area -->
    	</div> <!-- .container -->
    
    <?php endif; ?>
    
    </div> <!-- #main-content -->
    
    <?php get_footer(); ?>

    Thanks a mil!

    #152620
    LaunchFocus
    Participant

    Issue came up after a user joined with with a space in his username. His profile leads to 404 when you click on his username. I researched and saw special characters and spaces aren’t allowed? Why is this and is there a simple fix rather than having to validate our code?

    #152619

    In reply to: Full Width Forum Pages

    Robin W
    Moderator

    You need to get bbpress to use the full width template

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

    #152614
    Robkk
    Moderator

    @pavle123 thank you for the compliment

    The progress of this is theme is probably at 65% of completion.
    Im really just removing unnecessary code in templates and css that are not useful since i made some arrangements.

    and also im really just thinking what else could i add thats different from other forum software.
    if you have any ideas on what to add please feel free to share.

    and also if i should just share a child theme of a default theme like twenty twelve for free.

    or make a theme off of _s put whatever i want in it and sell it for like 5-15 dollars.

    #152598
    Robkk
    Moderator

    i checked this out and i think you need to fix the “Filed Under” that is under every forum.

    if you havent made a bbpress.php do so to fix that.

    https://codex.bbpress.org/theme-compatibility/getting-started-in-modifying-the-main-bbpress-template/

    #152596
    arno8
    Participant

    @lynq I hope you can help me.

    As you see here, in the general section it shows the topic and posts count nicely on the correct place.
    However on the sub-forums u can see the counts are just ext to the name. how can i position these so they get on the same position like the ones above?

    I tried to add a class here

    // Parse arguments against default values
    	$r = bbp_parse_args( $args, array(
    		'before'            => '<ul class="bbp-forums-list">',
    		'after'             => '</ul>',
    		'link_before'       => '<li class="bbp-forum">',
    		'link_after'        => '</li>',
    		'count_before'      => '(',
    		'count_after'       => ' )',
    		'count_sep'         => ', ',
    		'separator'         => ', ',
    		'forum_id'          => '',
    		'show_topic_count'  => true,
    		'show_reply_count'  => true,
    	), 'list_forums' );

    Like this:

    // Parse arguments against default values
    	$r = bbp_parse_args( $args, array(
    		'before'            => '<ul class="bbp-forums-list">',
    		'after'             => '</ul>',
    		'link_before'       => '<li class="bbp-forum">',
    		'link_after'        => '</li>',
    		'count_before'      => '<div class="counts">',
    		'count_after'       => '</div>',
    		//'count_sep'         => ', ',
    		//'separator'         => ', ',
    		'forum_id'          => '',
    		'show_topic_count'  => true,
    		'show_reply_count'  => true,
    	), 'list_forums' );

    to then style it in css, but when i try this it doesnt show the count anymore and i cANT EDIT IT IN CSS.

    #152584

    In reply to: Online Magazine Theme

    Robin W
    Moderator

    ok, I downloaded the theme and had a play

    you need to create this file as bbpress.php

    <?php global $theme; get_header(); ?>
    
        <div id="main">
        
            <?php $theme->hook('main_before'); ?>
    
            <div id="content2">
                
                <?php $theme->hook('content_before'); ?>
            
                <?php 
                    if (have_posts()) : while (have_posts()) : the_post();
                        /**
                         * Find the post formatting for the pages in the post-page.php file
                         */
                        get_template_part('post', 'page');
                        
                        if(comments_open( get_the_ID() ))  {
                            comments_template('', true); 
                        }
                    endwhile;
                    
                    else :
                        get_template_part('post', 'noresults');
                    endif; 
                ?>
                
                <?php $theme->hook('content_after'); ?>
            
            </div><!-- #content -->
        
            <div id="sidebar-primary">
    
       <?php
            if(!dynamic_sidebar('sidebar-bbpress')) {
                /**
                * The primary sidebar widget area. Manage the widgets from: wp-admin -> Appearance -> Widgets 
                */
                $theme->hook('sidebar-bbpress');
            }
            $theme->hook("sidebar_primary_after");
        ?>
        
    </div><!-- #sidebar-primary -->
            
            <?php $theme->hook('main_after'); ?>
            
        </div><!-- #main -->
        
    <?php get_footer(); ?>
    
    

    Then in your style.css you need to add the following to the bottom just above the

    /* =END
    
    
    #content2 {
      float: left;
      overflow: hidden;
      width: 630px;
    }
    
    

    That should do it

    #152578

    In reply to: Online Magazine Theme

    Topknotch
    Participant

    Still doesn’t work šŸ™ this is driving me mad I have been trying it all day and when you re posted I thought woooohooooo , but sadly no šŸ™
    This is my code –

    <?php
    
    /**
    
     * Template Name: Full Width, no sidebar(s)
    
    */
    
    get_header(); ?>
    
        <div id="main-fullwidth">
    
            
    
            <?php 
    
                if (have_posts()) : while (have_posts()) : the_post();
    
                    /**
    
                     * Find the post formatting for the pages in the post-page.php file
    
                     */
    
                    get_template_part('post', 'page');
    
                    
    
                    if(comments_open( get_the_ID() ))  {
    
                        comments_template('', true); 
    
                    }
    
                endwhile;
    
                
    
                else :
    
                    get_template_part('post', 'noresults');
    
                endif; 
    
            ?>
    
            
    
        </div><!-- #main-fullwidth -->
    
        
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    #152577

    In reply to: Online Magazine Theme

    Robin W
    Moderator

    sorry…

    <? get_sidebar(); ?>
    

    should read

    <?php get_sidebar(); ?>

    #152576
    Robin W
    Moderator

    try using the method shown here

    Layout and functionality – Examples you can use

    #152568

    In reply to: UNDEFINED Header. . .

    Robin W
    Moderator

    how are you accessing this page – which of these is it?

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

    #152557
    Robin W
    Moderator

    I think this should do it. It’s from my library of code and haven’t used it in a while, so come back if it’s not what you want

    You’ll need to add it to your functions file

    Functions files and child themes – explained !

    //This function adds descriptions to the sub forums
    function custom_list_forums( $args = '' ) {
    
    	// Define used variables
    	$output = $sub_forums = $topic_count = $reply_count = $counts = '';
    	$i = 0;
    	$count = array();
    
    	// Parse arguments against default values
    	$r = bbp_parse_args( $args, array(
    		'before'            => '<ul class="bbp-forums-list">',
    		'after'             => '</ul>',
    		'link_before'       => '<li class="bbp-forum">',
    		'link_after'        => '</li>',
    		'count_before'      => ' (',
    		'count_after'       => ')',
    		'count_sep'         => ', ',
    		'separator'         => ', ',
    		'forum_id'          => '',
    		'show_topic_count'  => true,
    		'show_reply_count'  => true,
    	), 'list_forums' );
    
    	// Loop through forums and create a list
    	$sub_forums = bbp_forum_get_subforums( $r['forum_id'] );
    	if ( !empty( $sub_forums ) ) {
    
    		// Total count (for separator)
    		$total_subs = count( $sub_forums );
    		foreach ( $sub_forums as $sub_forum ) {
    			$i++; // Separator count
    
    			// Get forum details
    			$count     = array();
    			$show_sep  = $total_subs > $i ? $r['separator'] : '';
    			$permalink = bbp_get_forum_permalink( $sub_forum->ID );
    			$title     = bbp_get_forum_title( $sub_forum->ID );
    			$content = bbp_get_forum_content($sub_forum->ID) ;
    
    			// Show topic count
    			if ( !empty( $r['show_topic_count'] ) && !bbp_is_forum_category( $sub_forum->ID ) ) {
    				$count['topic'] = bbp_get_forum_topic_count( $sub_forum->ID );
    			}
    
    			// Show reply count
    			if ( !empty( $r['show_reply_count'] ) && !bbp_is_forum_category( $sub_forum->ID ) ) {
    				$count['reply'] = bbp_get_forum_reply_count( $sub_forum->ID );
    			}
    
    			// Counts to show
    			if ( !empty( $count ) ) {
    				$counts = $r['count_before'] . implode( $r['count_sep'], $count ) . $r['count_after'];
    			}
    
    			// Build this sub forums link
    			$output .= $r['before'].$r['link_before'] . '<a href="' . esc_url( $permalink ) . '" class="bbp-forum-link">' . $title . $counts . '</a>' . $show_sep . $r['link_after'].'<div class="bbp-forum-content">'.$content.'</div>'.$r['after'];
    		}
    
    		// Output the list
    		return $output ;
    	}
    }
    
    add_filter('bbp_list_forums', 'custom_list_forums' );
    #152534
    robsward
    Participant

    Hi,

    How can I move a topic from one forum to another programmatically? I’m hoping to send a post variable with the new forum ID, and then update the topic like so:

    // Update the Status Meta After Changes are Posted
    if ( isset( $_POST['bbps_forum_option'] ) ) {
    
    	$new_forum = $_POST['bbps_forum_option'];
    
    	bbp_update_topic( $this->topic_id, $new_forum );
    
    } // if()

    Thanks!

    #152533
    robsward
    Participant

    There are a couple of issues with that code up there. Correct function is this one:

    public function forum_list(){
    
    	$forums		= array();
    
    	if ( bbp_has_forums() ) {
    		while ( bbp_forums() ) {
    
    			bbp_the_forum();
    
    			$forum_id = bbp_get_forum_id();
    			$forum_name = bbp_get_forum_title();
    			$data = array( 'ID' => $forum_id, 'name' => $forum_name );
    
    			$forums[] = $data;
    
    		} // while()
    	} // if()
    
    	return $forums;
    
    } // get_forum_list()
    #152532
    robsward
    Participant

    Hi,

    I’m trying to retrieve a simple list of all forums on a site, for which I need to have a loop. I’m trying to create one from within a class in my plugin using this function:

    public function forum_list(){
    
    	$forums		= array();
    
    	if ( bbp_has_forums() {
    		while ( bbp_forums() ) {
    
    			bbp_the_forum();
    
    			$forum_id = bbp_get_forum_id();
    			$forum_name = bbp_get_forum_title();
    			$data = array( 'ID' => $forum_id, 'name' => $forum_name );
    
    			$forums[] = $data;
    
    		//} // while()
    	} // if()
    
    	return $forums;
    
    } // get_forum_list()

    Which is called inside the construcor like so:

    $this->forums = $this->forum_list();

    This is telling me there is no object (Call to a member function get() on a non-object). The function works perfectly well outside the class, but inside it fails. What am I missing?

    #152526

    Topic: CSS questions

    in forum Themes
    EzYRiDaH
    Participant

    Hi there,
    I use the Genesis framework. In the Genesis theme there is a CSS part that sets the global margins.

    .entry {
    	margin-bottom: 40px;
    	padding: 50px 60px;
    }

    I managed to change a lot of the CSS by learning trial and error. I managed to change lot of the CSS of bbPress, but I don’t now how to change specific global things only affecting the bbPress forum.

    How can I change only the margings and the font type of the forum, without affecting the rest of the site (Genesis CSS).

    Your help is highly appreciated šŸ™‚

    #152512
    Robin W
    Moderator

    The normal behaviour is to allow anyone to see profiles.

    You can limit this to only logged in users by adding some code to a couple of files.

    If you have c-panel or ftp access and know how to transfer files, come back and I’ll help you with the changes.

    #152510

    In reply to: Online Magazine Theme

    Robin W
    Moderator

    ok, save this file as bbpress.php into the root of your theme

    ie

    wp-content/themes/%yourthemename%/bbpress.php

    where %yourthemename% is the name of your theme !! šŸ™‚

    Then add a line above the last, so that it now reads

    <? get_sidebar(); ?>
    <?php get_footer(); ?>

    bbpress will now use that page as the one for bbpress, and should display a sidebar.

    ‘tweaks’ should tghen sue this fro your forum sidebar.

    Come back if any of that doesn’t work, or you need more explanation

    #152506

    In reply to: Online Magazine Theme

    Topknotch
    Participant

    Thanks Robin

    <?php
    
    /**
    
     * Template Name: Full Width, no sidebar(s)
    
    */
    
    get_header(); ?>
    
        <div id="main-fullwidth">
    
            
    
            <?php 
    
                if (have_posts()) : while (have_posts()) : the_post();
    
                    /**
    
                     * Find the post formatting for the pages in the post-page.php file
    
                     */
    
                    get_template_part('post', 'page');
    
                    
    
                    if(comments_open( get_the_ID() ))  {
    
                        comments_template('', true); 
    
                    }
    
                endwhile;
    
                
    
                else :
    
                    get_template_part('post', 'noresults');
    
                endif; 
    
            ?>
    
            
    
        </div><!-- #main-fullwidth -->
    
        
    
    <?php get_footer(); ?>
    #152504

    In reply to: Online Magazine Theme

    Robin W
    Moderator

    can you post the code for the full width one here please

    #152495
    sdunning
    Participant

    I wish to show the description of each forum in the forum list as seen here:
    http://forum.unified-automation.com/

    If someone could point me towards the file and/or function I need to add/amend, I’d be eternally grateful.

    I have it laid out with the child forums listed as shown by following this example but when I last tried to show the description along side it, I got the WSOD (my php sucks).

    Thanks to any and all!

    WP version 4.0
    bbPress version 2.5.4

    #152485
    STG
    Participant

    Ok, I found it.

    I had a plug-in called Landing Page.

    It wasn`t enough to deactivate it. I deleted it and everything seems to work fine.
    Don`t ask how or why, it just worked.

    Thanks for your help.

    Loni
    Participant

    @nightcoder You Rock! I was having this same problem where the “s” was missing from our noreply address. I followed your instruction and modified bbpress/includes/common/functions.php and it works perfectly! Thank you very much. šŸ™‚

Viewing 25 results - 10,551 through 10,575 (of 32,521 total)
Skip to toolbar