Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 3,951 through 3,975 (of 32,481 total)
  • Author
    Search Results
  • #197103

    In reply to: Trackbacks

    cdwed
    Participant

    I put in the code and got a syntax error. I loaded it in just as you wrote it. So it will not run.

    Can you check on this please?
    Here is what you posted:

    // Force ping_status on bbPress post types 
    add_filter( 'pings_open', 'rew_force_ping_status' ); 
    
    function rew_force_ping_status( $open, $post_id = 0 ) { 
    
    <strong>// Get the post type of the post ID 
    $post_type = get_post_type( $post_id ); 
    // Default return value is what is passed in $open 
    $retval = $open; 
    // Only force for bbPress post types 
    switch ( $post_type ) { 
    case bbp_get_forum_post_type() : 
    case bbp_get_topic_post_type() : 
    case bbp_get_reply_post_type() : 
    	$retval = false; 
    break; 
    // Allow override of the override 
    return apply_filters( 'rew_force_ping_status', $retval, $open, $post_id, $post_type ); 
    } </strong>
    #197083
    jaykaybee
    Participant

    I am trying to configure bbpress for one way announcements to an audience of members in my website. Meaning I as the author am posting topics in chronological order, with no possibility of replies. So not a normal forum.

    This has meant removing a lot of extraneous information normally displayed: I don’t need or want author, freshness, voices, etc.

    I am new to WordPress, BBpress, and I am not a coder. I have proceeded, through trial and error, to “inspect” the pages and use custom CSS to hide objects that I don’t want (display: none !important), and to look at the php files such as content-single-topic-lead.php and remove any references to author (e.g. bbp-topic-author).

    Without understanding much of what I’m doing, I’m getting very close to achieving the intended effect. Now I’m stuck because when someone clicks in Resource Messages (the “forum” name) on an actual topic, they see an indented display of content, because the author column (which normally displays author name and avatar etc, which I hid using CSS display: none !important) is still present (if empty).

    Please see https://devgo.jeffbelkora.com/square/topic/20181219-resource-message-2/

    So my questions are:
    1. Can anyone instruct me on how to remove that first author/avatar column?
    2. How to resize column 2, or otherwise adapt it so each topic’s content displays as a left-justified text?

    Please be very remedial in any tips you can give me. I have created a “bbpress” subfolder inside my “astra” child theme via “files” in my cpanel. I am deleting code in php files there adding custom css inside the astra child theme “customizer”.

    If you are going to suggest changing files, could you please specify how I need to place them in my child theme to make this futureproof to updates etc.?

    Thank you!

    #197065
    Robin W
    Moderator

    not sure why that would be – bbp_get_forum_title just does a check and then executes get_the_title

    the full function is

    function bbp_get_forum_title( $forum_id = 0 ) {
    		$forum_id = bbp_get_forum_id( $forum_id );
    		$title    = get_the_title( $forum_id );
    
    		return apply_filters( 'bbp_get_forum_title', $title, $forum_id );
    	}

    It seems to work fine on my test site.

    Is there a particular circumstance or is it consistently wrong on your site?

    #197057
    Foliferous
    Participant

    Hello,

    I noticed a weird thing, the Admin profile has this empty DIV on its page:

    Check it out.

    Other profiles don’t have that. Check it out.

    It seems to be this here:

    <div class="comments-area"></div>

    What is this and what is it doing there? How do I remove it? Is it some space for user comments on profiles? And why do other users don’t have that?

    Thanks!

    By the way I love bbpress, it’s awesome. I used a lot of other forum software (IPB, vBulletin, phpBB), but this one’s really the best!

    #197041
    rgilman
    Participant

    Apologies for the delay in reporting back. I was able to modify the (style pack) latest activity widget to meet my needs. Thank you!

    Along the way I found what may be a bug. On line 255, bbp_get_forum_title($forum) gets the topic title but get_the_title($forum) gets the forum title.

    #197039
    mattbru
    Participant

    Okay, I GOT IT!
    The key is to compare the topic id and the reply id. If they are equal, then its the first reply in bbpress.

    Here is my full solution:

    <?php
    function add_content_before_first_reply_content($content,$id){
    
    	$post = get_post($id);
    	$topic_id = bbp_get_topic_id();
    	$reply_id = bbp_get_reply_id();
    	$content_to_add = '';
    
    	if ($topic_id === $reply_id) {
    		// do whatever you need to in  here
    		$content .= $content_to_add;
    	}
    
    	return $content;
    
    }
    add_filter( 'bbp_get_reply_content', 'add_content_before_first_reply_content', 99, 2 );
    #197038
    mattbru
    Participant

    Thank you Robin W. But that does not work.

    $count = get_post_meta($topic_id, '_bbp_reply_count', false);
    is the same as
    $count = bbp_get_topic_reply_count($topic_id);
    Except the second one returns a number, first one gives you an array.
    The results of what you suggested gives me array([0]=>6) , meaning there are six replies to the topic.

    If you do a conditional like this: if ($count === 0) { // then code } , its only going to run the code if there are no replies to the post. That’s not what I need.

    #197037
    Robin W
    Moderator

    ok, get the topic ID, and then in your hook to bbp_theme_before_reply_content look up whether the topic has had any replies by using

    $count = get_post_meta ($topic_id, '_bbp_reply_count' , false)

    If $count=0, then there have been no replies, so this is the first.

    #197036
    mattbru
    Participant

    wp v5.0.1
    bbpress v2.5.14

    How can I hook into the FIRST reply on a single topic page? I want to add an image attachment only to the first reply, but i cannot find how to do so. I hooked into the action “bbp_theme_before_reply_content“, but it adds the image to every reply on the page!

    I thought about getting a list of all reply ids, then comparing the current reply id (bbp_get_reply_id()) with the first id in the array, and showing content if they are equal. That would solve the problem. BUT I also failed at getting the list of ids – I tried with bbp_get_all_child_ids

    I also wish the FIRST reply in the loop would have a unique id or class, but it does not 🙁

    Here is the page:

    Meet My New Crested Gecko

    #197034
    Info Ekonomi
    Participant

    PekMez your solution does work, but still modifying the core code will be overwritten on the upcoming update, and we will probably forget about this in the future. So after upgrade our BBPress version we forget to re-modify this code.

    Anyway how about now, is there a solution for BreadCrumbs without modifying the core?

    #197015
    tekgazet
    Participant

    Sure. I used the bbp_new_topic_pre_content Filter Hook and the code I used is as under:

     //code to limit number of characters in topic contents to 500 characters
     
    function tm_limit_topic_content( $topic_content )
    {
        /* Check for number of characters in topic contents  */
        if (strlen($topic_content) > 500) {
    		$revised_content = substr($topic_content, 0, 500);
    		}	
    	else {
    		$revised_content = $topic_content ;
    	}		
     
        return $revised_content ;
    }
     
    add_filter( 'bbp_new_topic_pre_content', 'tm_limit_topic_content' );
    #196987
    eigodeasobo
    Participant

    I want to display only the following two on buddypress activity.

    ※When creating topics for BBP.
    ※When comment for topics.

    What should I write in “※” below?

    wp-content>plugins>buddypress>bp-templates>bp-legacy>buddypress>members>single>activity.php
    <?php if ( bp_has_activities( bp_ajax_querystring( ‘activity’ ) . ‘&action=※※’ ) ) : ?>

    tekgazet
    Participant

    I want to limit the number of characters in the Topic Content Text Area in bbPress to a maximum limit (of say 500 characters). How can I do it?

    I tried to do it by using the maxlength attribute of textarea (bbp_topic_content) in the stylesheet file, but this attribute is not working (may perhaps be because this attribute was included in HTML5 version only). However, if I use this in Developer Tools in Chrome while inspecting the text area for Topic Content, it works fine; but that is only for testing and I am not able to make a permanent change by editing the source file or through any plugin.

    Other two methods could be javascript to check on local machine the number of characters being entered, but I understand that this can easily be cheated by disabling javascript. Moreover, I am not fully sure how to do it.

    Third method could be to use for action or filter hook. Can you please suggest me which hook to be used and sample code, if any?

    Thanks in advance.

    #196959
    wpturk
    Participant

    @robin-w , thanks for your advise. RC7 partially solved the problem.

    This is before updating topic (post_id:54878) in admin area:

    mysql> select * from forum_postmeta where meta_key="_bbp_subscription" ; 
    +---------+---------+-------------------+------------+
    | meta_id | post_id | meta_key          | meta_value |
    +---------+---------+-------------------+------------+
    .....
    .....
    |   35265 |   54878 | _bbp_subscription | 11743      |
    +---------+---------+-------------------+------------+

    This is after updating the topic (post_id:54878) in admin area:

    mysql> select * from forum_postmeta where meta_key="_bbp_subscription" ; 
    +---------+---------+-------------------+------------+
    | meta_id | post_id | meta_key          | meta_value |
    +---------+---------+-------------------+------------+
    .....
    .....
    |   35265 |   54878 | _bbp_subscription | 11743      |
    |   35280 |   54879 | _bbp_subscription | 1          |
    +---------+---------+-------------------+------------+

    So, the user subscription is there but there is a new unnecessary row, the admin user is subscribed to a non-existing topic. post_id=54879 does not exist.

    Who can we report bugs?

    #196923
    ducrevit181
    Participant

    You have been a great help.

    I read through and tried https://codex.bbpress.org/bbpress-styling-crib/

    What I did,
    1. installed Simple Custom CSS plugin – all ok
    2. insert the below code. and changed the font-size: 1.1em; to 1.6em

    #bbpress-forums div.odd, #bbpress-forums ul.odd { background-color: #fbfbfb; } #bbpress-forums div.even, #bbpress-forums ul.even { background-color: #fff; }

    IF post is sticky or super sticky, then

    .bbp-topics-front ul.super-sticky, .bbp-topics ul.super-sticky, .bbp-topics ul.sticky, .bbp-forum-content ul.sticky { background-color: #ffffe0 !important; font-size: 1.1em; }

    but the rest doesn’t seem to work
especially
    Number 5. Various texts

    bbpress-forums .bbp-topic-content p, bbpress-forums .bbp-reply-content p { font-size: 12px;

    I change the font-size: 20px

    nothing happens. 

    what did I do wrong? basically I wanted to increase font size for all forum section from 1 to 8. How please.

    Thank you in advance

    #196841
    arturooo32
    Participant

    WordPress 4.9.8
    bbPress 2.5.14
    ProfileGrid 3.2.1
    http://Www.lokmiechow.pl

    Hello, i use bbpress and ProfileGrid. I have problem with profile user. Now i have 2 various profile user. 1st is from forum mybb and 2nd is from profileGrid.
    1st view is, if i click on name author post. I think i need change it in file php but i dont know how and where.

    
    1st) http://www.lokmiechow.pl/forums/user/assadsadas-asasda/
    2nd) http://www.lokmiechow.pl/konto/?uid=10
    

    I would like have only 2nd view. What should i change and where to fix it?

    I would like also add options from 1st to 2nd view, for example in new overlap “user forum stats”.

    #196802
    shubh2018
    Participant

    When i create new topic it shows normally no issues!!
    But i had a huge data that needed to be imported on the same site. I used WP All Import Plugin for the import and I imported the data into topics… Actually I only require the topics section so there is forum I want to show… I managed the look. But after the import finished. I cant see the list of topics that meant to be seen on my homepage. Though I see the topics in the sidebar under related topics. I used shortcode [bbp-topic-index] to show the topic on my homepage.
    I can also see the topic in my wordpress topics section…
    So, I decided to take a look in my database. I saw that earlier when i created topics it was stored in wp_posts table but now after import all that new data is in wp_pmxi_ tables and topics were in wp_pmxi_topics table. I don’t know if that supposed to be but I cant solve this issue… I even imported data again in posts which then went to wp_posts table in database but ofcourse wordpress was taking that as posts not bbpress topics…
    Can please someone help me out?

    #196761

    In reply to: Trackbacks

    Robin W
    Moderator

    if you have put the code in the plugin – that’s it !

    On a load, the code looks to see if it is a topic or reply, and if so turns off pingbacks

    #196758

    In reply to: Trackbacks

    cdwed
    Participant

    OK I added the plug-in. Can you give some specific instructions on how to enter the code?

    Do I do this for each forum page?

    TNX Robin.

    Peter

    #196744
    jsima
    Participant

    @robin-w how much i have to pay for that code?

    #196739
    engin1984
    Participant
    <!DOCTYPE html>
    <!--[if IE 7]>
    <html class="ie ie7" lang="en-US" prefix="og: http://ogp.me/ns#">
    <![endif]-->
    <!--[if IE 8]>
    <html class="ie ie8" lang="en-US" prefix="og: http://ogp.me/ns#">
    <![endif]-->
    <!--[if !(IE 7) | !(IE 8)  ]><!-->
    <html lang="en-US" prefix="og: http://ogp.me/ns#">
    <!--<![endif]-->

    testing some code…
    edit: YEP! Code tag is working .

    #196738

    In reply to: Trackbacks

    Robin W
    Moderator

    no.

    The simplest way is to use this plugin

    Code Snippets

    and put the code in there

    #196732
    xavier_bs
    Participant
    add_action( 'private_title_format', 'xbs_hide_second_prefix_title' );
    function xbs_hide_second_prefix_title( $title ) {
       $prefix = str_replace( '%s', '', $title );
       return "<span class=\"private-title\">$prefix</span>%s";
    }

    and in CSS:

    .private-title + .private-title {
        display: none;
    }
    #196722

    In reply to: Trackbacks

    Robin W
    Moderator

    I just looked in trac, and fixing this is now a 2.8 goal.

    However this looks like it might help

    // Force ping_status on bbPress post types 
    add_filter( 'pings_open', 'rew_force_ping_status' ); 
    
    function rew_force_ping_status( $open, $post_id = 0 ) { 
    
    // Get the post type of the post ID 
    $post_type = get_post_type( $post_id ); 
    // Default return value is what is passed in $open 
    $retval = $open; 
    // Only force for bbPress post types 
    switch ( $post_type ) { 
    case bbp_get_forum_post_type() : 
    case bbp_get_topic_post_type() : 
    case bbp_get_reply_post_type() : 
    	$retval = false; 
    break; 
    // Allow override of the override 
    return apply_filters( 'rew_force_ping_status', $retval, $open, $post_id, $post_type ); 
    } 
    #196721
    Robin W
    Moderator

    not within free help, sorry, but if you have a way to allocate I could probably write some code cheaply

    contact me via

    http://www.rewweb.co.uk

Viewing 25 results - 3,951 through 3,975 (of 32,481 total)
Skip to toolbar