Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 13,251 through 13,275 (of 32,504 total)
  • Author
    Search Results
  • #139692
    Lifeischoice
    Participant

    Hello,
    newbie question: Need assistance to change your code above so as to hide replies by the keymaster (admin) only for public or non logged in?

    thanks

    #139680
    matrixino
    Participant

    Hello, after importing from a phpBB forum where I had custom BBCodes I have the problem that they are not changed in actual html.
    I would like to know how can I implement such custom bbcodes in my bbpress installation.

    I did some tries making a custom plugin with something like this inside (this is just an example):

    function bb_table_replace( $text ) {
    $text = preg_replace('/\[tabella\](.*?)\[\/tabella\]/ie', "<table>$1</table>", $text);
    return $text;
    }
    add_filter('bbp_get_reply_content', 'bb_table_replace');

    But I had no luck. It seems however to find my regexp pattern but its replace is wrong, it’s made after the matched pattern (adding to it, instead of replacing).

    Any help?

    #139678
    Robin W
    Moderator

    I disable the toolbar for users – it always looks like an add-on and clashes with the theme style

    I use a sidebar, and put the login widget on it.

    I then customise the login widget as per item 3 of

    Layout and functionality – Examples you can use

    #139675
    Robin W
    Moderator

    crzyhrse – I am in the process of trying to improve the documentation – I started using wordpress & bbPress earlier this year and am still learning. This is community software, and community documentation, so I am trying to do my bit by helping the documentation side, and by spending time on the forum helping others where I can. The step by step guides I am writing are designed to fit the bill of “cohesive simple directions”, but if they are failing or you haven’t found them, then they are not working as planned. Let me know and I’ll try to improve layout and/or content, but I need good feedback to do this.

    The text change suggested by renai42 works (with a small change) if done to the bbpress.css.

    Can I ask you to look at

    Step by step guide to setting up a bbPress forum – part 2


    and the styling crib

    bbPress Styling Crib

    I’ve just tested and added Renai’s css so look there for what to use.

    If you can improve wording or content to help others – please let me know what could be better phrased.

    If it doesn’t work, come back with what you did, and I’ll see if I can help further

    #139673
    ronthai
    Participant

    Hi,
    In posts, my theme only has page-navigation at the bottom.
    I added it also at the top of posts, no problem

    The issue is that now there is also a (sort of) page-navigation at the top of every page in the bbpress plugin part, which I don’t want of course.

    How do I exclude the added code from showing on the bbpress pages (the whole plugin pages for that matter)

    Thanks, Ron
    WP: 3.7.1
    bbPress: 2.5

    Nevermind, solved it:
    SOLVED:
    Had to put it inbetween:

    <?php if ( is_singular('post') ) : ?>
    
    <?php endif; ?>
    #139672
    Robin W
    Moderator

    bbPress can do all the above.

    See

    Codex


    for a step by step guide.

    Can bbpress be configured to require registration before posting?

    Yes, and you may want to set a manual registration if you want to vet who joins. The documentation explains.

    Are there additional plugins?

    Yes, lots of them that’ll let you add stuff to the forum and customise it for you

    #139671
    Yukon Cornelius
    Participant

    @yanseo thanks for the snippet. It works perfectly! Do you have any idea how i would change the code to add the thumbnail for sub forums instead?

    The forum index looks something like:

    PARENT FORUM
    *sub-1
    *sub-2
    *sub-3

    I attached a featured image to each sub forum. I would like those images to show where the asterisk is.

    I tried changing the action in your code to ‘bbp_theme_before_sub_forums’ but it still spits out the thumbnail/featured image for the Parent category.

    Any ideas?

    J

    #139666
    Robin W
    Moderator

    Sorry I can’t see any forums on your site now.

    You can turn breadcumbs off using

    function bm_bbp_no_breadcrumb ($param) {
    return true;
    
    }
    
    add_filter ('bbp_no_breadcrumb', 'bm_bbp_no_breadcrumb');

    add this to your functions file in your theme/childtheme

    #139651

    In reply to: CSS bug?

    FreeWPress
    Participant

    Why you use clear none?

    #bbpress-forums #bbp-user-wrapper ul.bbp-lead-topic, #bbpress-forums #bbp-user-wrapper ul.bbp-topics, #bbpress-forums #bbp-user-wrapper ul.bbp-forums, #bbpress-forums #bbp-user-wrapper ul.bbp-replies, #bbpress-forums #bbp-user-wrapper fieldset.bbp-form {
        clear: none;
    }
    #139650

    Topic: CSS bug?

    in forum Troubleshooting
    jeepdon
    Participant

    Re: http://powershell.org/wp/forums/users/dlwyatt/replies/

    You’ll notice that the container for the page content is getting a 0px width and massive height calculated. The CSS style #bbp-forums has an “overflow: hidden;” style. Removing that style element fixes the display – but I’d like some confirmation that this is indeed a bug? The content in this specific case has a lot of PRE/CODE styling, so I’m not sure if there’s some weird interaction going on that I just can’t figure out.

    The container in question is a ul#topic-0-replies, classed with .forums and .bbp-replies. The overflow attribute I’m referring to is coming right from the top of bbpress.css.

    Note that I’m using the default styling/theming for BBP.

    #139638
    Robin W
    Moderator

    Hey, Thanks for a great and detailed response, I’ll read it in detail later as off to earn a living, but I’ll be digging into it and the code tonight !

    Thanks again – really helpful !

    #139631
    justsayno1
    Participant

    How did you get from there to “I just followed…”?

    Unfortunately there is not an easy way to explain this as I am not that familair with wordpress/bbpress core myself. BUT what I mean is that function is obviously somewhere in the bbpress core files. All I did was start going in there. They are quite well documented and have comments that explain the different functions that get used. You are mainly looking for the template tags function files. Also most plugins/php apps use an includes folder to put all the main crux of the things in. While the main file is just simply a link to all those areas an common functions. If you really can’t find it then just use a program with a “search in files” option and just try and find it that way. I think that is what I did to start with.

    For example when I wanted to find the function yo mention above:
    bbp_reply_author_link( array( 'sep' => '<br />', 'show_role' => false ) );

    I thought about what the function is saying and where in the folder directories of includes it may be. Since it was “reply” related I figured it would be in the reply section. I just used some common sense to figure out the template-tags.php probably containted template specific functions. Then I just did a search on those files until I found the bbp_reply_author_link. Which then calls bbp_get_reply_author_link which in tern as a return value of:

    return apply_filters( 'bbp_get_reply_author_link', $author_link, $r );

    Meaning that you can basically sub in your own functino for this function by using:

    add_filter( 'bbp_get_reply_author_display_name', 'replace_bbpress_replies_username_filter', 10, 2);

    Where replace_bbpress_replies_username_filter is your replacement filter. Then what I mean by following the functions is that i realised that this function was fine. It was the bpp_get_author_display_name that I was unhappy with. And this would be called in many places (presumably). So I overwrote that function. EG:

    
    function replace_bbpress_replies_username_filter($author_name,$reply_id ){
    $author_id = bbp_get_reply_author_id($reply_id);
    $author_object = get_userdata( $author_id );
    $author_name  = ucfirst($author_object->user_login);
    return $author_name;
    }
    add_filter( 'bbp_get_reply_author_display_name', 'replace_bbpress_replies_username_filter', 10, 2);
    

    Does that help? I know it seems daunting but getting into the core files and seeing what they are doing is I have found the best way when you are thinking “what the fuck!”. Also bear in mind I spend about 4 hours yesterday figuring this stuff out (but I didn’t understand filters really until now). Just to help you out futher. The three filters I added were as follows:

    
    add_filter( 'bbp_get_reply_author_display_name', 'replace_bbpress_replies_username_filter', 10, 2);
    add_filter( 'bbp_get_topic_author_display_name', 'replace_bbpress_topic_author_display_name', 10, 2);
    add_filter( 'bbp_get_user_profile_link', 'replace_bbpress_profile_link_text_filter', 10, 2 );
    

    The display name function I have shown you. The topic display name function:

    
    function replace_bbpress_topic_author_display_name( $topic_id = 0 ) {
    		$topic_id = bbp_get_topic_id( $topic_id );
    
    		// Check for anonymous user
    		if ( !bbp_is_topic_anonymous( $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 );
    
    		// User does not have an account
    		} else {
    			$author_name = get_post_meta( $topic_id, '_bbp_anonymous_name', true);
    		}
    
    		// If nothing could be found anywhere, use Anonymous
    		if ( empty( $author_name ) )
    			$author_name = __( 'Anonymous', 'bbpress' );
    
    		// Encode possible UTF8 display names
    		if ( seems_utf8( $author_name ) === false )
    			$author_name = utf8_encode( $author_name );
    
    		return $author_name;
    }

    And for the profile link:

    
    function replace_bbpress_profile_link_text_filter($user_link, $user_id){
    		// Validate user id
    		$user_id = bbp_get_user_id( $user_id );
    		$user_object = get_userdata( $author_id );
    		$user_name  = ucfirst($author_object->user_login);
    		if ( empty( $user_id ) )
    			return false;
    
    		$user      = get_userdata( $user_id );
    		$name      = esc_attr( $user_name );
    		$user_link = '<a href="' . bbp_get_user_profile_url( $user_id ) . '" title="' . $name . '">' . $name . '</a>';
    }

    I also changed the default wordpress “get_avatar” function because it returns the gravatar users real name as the alt attr. All you really have to do it replace the function with the same function but get the users login name and replace the alt text name with that. the function is big and I don’t wanna make this post any more ridiculous.

    It’s cool to be the one giving the answers on a WordPress forum! I only really have learned this stuff in the last few months myself. I am more of a Drupal guy. Shock Horror.

    Cheers!

    #139629
    joshnoworries
    Participant

    Thanks for all the suggestions! I will investigate the filter as that would be much more elegant. Here is what i am currently using, it’s ugly but i needed an urgent solution for a client:

    loop-single-forum.php

    REPLACED:
    <?php bbp_author_link( array( 'post_id' => bbp_get_forum_last_active_id(), 'size' => 14 ) ); ?>

    WITH:

    <?php if(bbp_get_forum_last_active_id()){?>
    <?php $last_post_id = bbp_get_forum_last_active_id(bbp_get_forum_last_topic_id()); ?>
    <?php $last_user_id = bbp_get_topic_author_id($last_post_id); ?>
    <a href="<?php echo bbp_topic_author_url($last_post_id) ?>"><?php bbp_topic_author_avatar($last_post_id,15); ?>
    <?php $user = get_user_by( 'id',$last_user_id ); echo $user->user_login ; ?></a>
    <?php } else { ?>
    <?php } ?>

    loop-single-topic.php

    REPLACED:

    <?php printf( __( 'Started by: %1$s', 'bbpress' ), bbp_get_topic_author_link( array( 'size' => '14' ) ) ); ?>
    

    WITH:
    Started by: <a href="<?php echo bbp_topic_author_url() ?>"><?php bbp_topic_author_avatar(0,15); ?><?php $user = get_user_by( 'id',bbp_get_topic_author_id() ); echo $user->user_login ; ?></a>

    REPLACED:
    <?php bbp_author_link( array( 'post_id' => bbp_get_topic_last_active_id(), 'size' => 14 ) );?>

    WITH:

    <?php $last_post_id = bbp_get_topic_last_active_id() ?>
    <?php $last_user_id = bbp_get_topic_author_id($last_post_id) ?>
    <a href="<?php echo bbp_topic_author_url($last_post_id) ?>"><?php bbp_topic_author_avatar($last_post_id,15); ?>
    <?php $user = get_user_by( 'id',$last_user_id ); echo $user->user_login ; ?></a>

    loop-single-reply

    REPLACED:
    <?php bbp_reply_author_link( array( 'sep' => '<br />', 'show_role' => true ) ); ?>

    WITH:

    <a href="<?php echo bbp_reply_author_url() ?>"><?php bbp_reply_author_avatar(0,80); ?><br/>
    <?php $user = get_user_by( 'id',bbp_get_reply_author_id() ); echo $user->user_login ; ?></a>
    <?php bbp_reply_author_role() ?>
    #139623

    In reply to: Lost Formatting

    FreeWPress
    Participant

    Hi, if you have update to 2.5 versions you can find other topics with this issue.. There is a patch.. problem is this:

    <link rel='stylesheet' id='bbp-default-css' href='http://qtippoker.com/wp-content/D:Hosting4710742htmlwp-contentpluginsbbpress/templates/default/css/bbpress.css?ver=2.5-5199' type='text/css' media='screen' />

    Your theme can’t find bbpress css…

    #139616
    Robin W
    Moderator

    @justsayno1

    I just followed the functions until I found these three filters: 🙂

    Ok, so given that loop-single-reply has

    bbp_reply_author_link( array( 'sep' => '<br />', 'show_role' => false ) );

    How did you get from there to “I just followed…”?

    I’ve never got into this area (have only been playing with wordpress since March this year, so am still a newbie), and would love to, but can’t find any tutorials that get you from a line on a display php to the backend function that creates it. I understand how a filter works (and that link is the best explanation I’ve seen so far!), but have you got a logical way to then backtrack to find out what you’re going to create a filter for? – I’ve looked through bbpress and there are lots of “function.php”s, the most obvious being bbpress/includes/common/functions.php, but a search for ‘bbp_get_user_profile_link’ comes up blank.

    If you could explain how you get from a to b, I be really grateful !

    #139608
    mouffles
    Participant

    I use a plugin to display pictures in lightbox (plugin name litebox).

    I have modified bbpress post tool bar, to include the class tag to the url.
    I also find the way to allow class tag for images and link in bbpress but i have to modify core files : \bbpress\includes\common\formatting.php

    i already googled a way to override this function in my theme function.php

    and what i did is :

    
    function my_filter_bbpress_allowed_tags() {
    	return array(
     
    		// Links
    		'a' => array(
    			'class'    => true,
    			'href'     => array(),
    			'title'    => array(),
    			'rel'      => array()
    		),
    
    		// Quotes
    		'blockquote'   => array(
    			'cite'     => array()
    		),
    
    		// Code
    		'code'         => array(),
    		'pre'          => array(),
    
    		// Formatting
    		'em'           => array(),
    		'strong'       => array(),
    		'del'          => array(
    			'datetime' => true,
    		),
    
    		// Lists
    		'ul'           => array(),
    		'ol'           => array(
    			'start'    => true,
    		),
    		'li'           => array(),
    
    		// Images
    		'img'          => array(
    			'class'    => true,
    			'src'      => true,
    			'border'   => true,
    			'alt'      => true,
    			'height'   => true,
    			'width'    => true,
    		)
    	);
    }
    add_filter( 'bbp_kses_allowed_tags', 'my_filter_bbpress_allowed_tags' );
    

    But today i updated to bbpress 2.5 and i saw that it didin’t work :/
    What is the correct function to allow this without hacking the bbpress core ?
    Could you in the future add a class tag allowed for link and images ?

    #139601
    Cars10
    Participant

    ok, here my latest uüdates to custom CSS field of my theme:

    #bbpress-forums > #subscription-toggle{
       float:right;
    }
    
    #bbpress-forums div.bbp-reply-content a.subscription-toggle,
    #subscription-toggle a{
       font-weight:bold;
       padding: 0 2px 0 2px;
       border: 1px solid navy;
       background-color: white;
    }
    
    #bbpress-forums div.bbp-reply-content .is-subscribed a.subscription-toggle,
    #subscription-toggle .is-subscribed a.subscription-toggle{
       background-color: #FFE000;
    }
    #139593

    In reply to: Stylesheet Issues

    Stephen Edgar
    Keymaster

    A probably quicker and easier way to test the patch is to download the following file:
    https://bbpress.trac.wordpress.org/export/5210/branches/2.5/includes/core/template-functions.php

    Save that to your PC and then with an FTP program upload it to your web host in this folder /public_html/wp-content/plugins/bbpress/includes/core

    Stephen Edgar
    Keymaster

    Thanks for the reply, MediaTemple DV should not be a problem and I won’t need the other info.

    Can you try this for me please 🙂 Download the following file and save it to your PC.
    https://bbpress.trac.wordpress.org/export/5210/branches/2.5/includes/core/template-functions.php

    With an FTP program upload it to your web host in this folder /public_html/wp-content/plugins/bbpress/includes/core

    Does this fix the issue for you in either bbPress 2.4 or 2.5 (Preferably 2.5)?

    #139588
    Stephen Edgar
    Keymaster

    Also new replies are inserted before the edits:

    TOPIC A
    – Post 1
    – Post 3
    – Post 4
    – Post 5
    – Post 6
    – Post 2

    In this case was/is ‘Topic A’ a newly created topic in bbPress 2.5 or a migrated topic from v1.x?

    Also can you run the repair tools following the instructions here:
    https://codex.bbpress.org/repair-forums/

    Does this fix the order?

    If the order was fixed and a reply is edited what happens?

    #139578
    Stephen Edgar
    Keymaster

    You also go about it this way by adding it to your themes functions.php file or your bbpress-functions.php file in your theme directory.

    To change from Home › Forums › My ForumSubscribe
    To change to Home › Forums › My Forum (Subscribe)

    function ntwb_forum_subscription_link( $args ) {
        $args['before'] = '&nbsp;(';
        $args['after']  = ')';
     
        return $args;
    }
     
    add_filter( 'bbp_before_get_forum_subscribe_link_parse_args', 'ntwb_forum_subscription_link' );

    If you don’t want to add it manually grab the entire file here and add it as a standalone plugin to your WordPress install.

    https://gist.github.com/ntwb/7686980

    #139577
    Stephen Edgar
    Keymaster

    @brucedongcaigmailcom Thanks for that info, helps to make sure we have all the bases covered 🙂

    Probably an easier way would be to download the entire file using this link

    https://bbpress.trac.wordpress.org/export/5210/branches/2.5/includes/core/template-functions.php

    Save that to your PC and then with an FTP program upload it to your web host in this folder /public_html/wp-content/plugins/bbpress/includes/core

    p.s. Just let me know if it doesn’t work

    #139572
    justsayno1
    Participant

    Hi,

    I am in the same situation and I have found a solution. You can apply filters to almost every function in bbpress it seems. I just followed the functions until I found these three filters:

    apply_filters( 'bbp_get_user_profile_link', $user_link, $user_id );
    apply_filters( 'bbp_get_reply_author_display_name', $author_name, $reply_id )
    apply_filters( 'bbp_get_topic_author_link', $author_link, $args );
    

    Using these you can change basically everything. I found it easier to change the avatar ALT text vie the normal wordpress get_avatar filter since I wanted that to happen site wide anyway. Here is an example of the reply filter:

    
    function replace_bbpress_replies_username_filter($author_name,$reply_id ){
    $author_id = bbp_get_reply_author_id($reply_id);
    $author_object = get_userdata( $author_id );
    $author_name  = ucfirst($author_object->user_login);
    return $author_name;
    }
    add_filter( 'bbp_get_reply_author_display_name','replace_bbpress_replies_username_filter',10, 2);
    

    Hope that helps. You can do it through templating but this way you don’t have to worry about doing it in a million different templates and then also dealing the layout of the markup you use to replace the current markup. And if filters confuse you and you don’t understand go read this:

    http://dev.themeblvd.com/tutorial/filters/

    I had zero knowledge of how to do filters when I read this thread 16 hours ago and decided to not go the route the above person mentioned.

    EDIT: I thought I’d add that they really could make this a lot easier with very little effort and make it so that you could configure what to use as a display name…. If anyone reads this from bbPress I’d be happy to get involved and do it for them. Seems so dumb to default to make it peoples full names when 90% people don’t want that. That is what facebook, G+ etc is for.

    #139571

    In reply to: Stylesheet Issues

    Stephen Edgar
    Keymaster

    will the coming update overwrite the code i just changed without any issues?

    Yes, it will automaticlly overwrite the changes you made

    #139570

    In reply to: Stylesheet Issues

    focallocal
    Participant

    just a last quick question.

    will the coming update overwrite the code i just changed without any issues?

    thanks very much

Viewing 25 results - 13,251 through 13,275 (of 32,504 total)
Skip to toolbar