Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 11,751 through 11,775 (of 32,521 total)
  • Author
    Search Results
  • #147110
    Jerry
    Participant

    @robin-w, here is my code for the custom fields. You will see where arguments and names match the variables being passed from javascript. This code was placed in a separate file as an additional plugin:

    add_action ( 'bbp_theme_before_topic_form_content', 'bbp_extra_fields');
    function bbp_extra_fields() {
    
      //This is where the cover will go, from google book search
       $value = get_post_meta( bbp_get_topic_id(), 'bookCover', true);
       echo '<label for="bookCover">Book Cover URL</label><br>';
       echo "<p><textarea style='width: 250px; height: 50px'  name='bookCover' value='".$value."'></textarea></p>";
      //Input field for the Author
       $value = get_post_meta( bbp_get_topic_id(), 'bookAuthor', true);
       echo '<label for="bookAuthor">Author</label><br>';
       echo "<p><input type='text' name='bookAuthor' value='".$value."'></p>";
    
       $value = get_post_meta( bbp_get_topic_id(), 'bookPublished', true);
       echo '<label for="bookPublished">Published</label><br>';
       echo "<p><input type='text' name='bookPublished' value='".$value."'></p>";
    
      //Input field for the number of pages in print
       $value = get_post_meta( bbp_get_topic_id(), 'bookPages', true);
       echo '<label for="bookPages">Pages</label><br>';
       echo "<p><input type='text' name='bookPages' value='".$value."'></p>";
      //Input field for the Publisher that corresponds to the Published data
       $value = get_post_meta( bbp_get_topic_id(), 'bookPublisher', true);
       echo '<label for="bookPublisher">Publisher</label><br>';
       echo "<p><input type='text' name='bookPublisher' value='".$value."'></p>";
      //Input field for the ISBN
       $value = get_post_meta( bbp_get_topic_id(), 'bookISBN', true);
       echo '<label for="bookISBN">ISBN</label><br>';
    //   echo "<p><input type='number' name='bookISBN' value='".$value."'></p>";
       echo "<p><input type='text' name='bookISBN' value='".$value."'></p>";
       }
    
    add_action ( 'bbp_new_topic', 'bbp_save_extra_fields', 10, 1 );
    add_action ( 'bbp_edit_topic', 'bbp_save_extra_fields', 10, 1 );
     
    function bbp_save_extra_fields($topic_id=0) {
      if (isset($_POST) && $_POST['bookCover']!='')
        update_post_meta( $topic_id, 'bookCover', $_POST['bookCover'] );
      if (isset($_POST) && $_POST['bookAuthor']!='')
        update_post_meta( $topic_id, 'bookAuthor', $_POST['bookAuthor'] );
      if (isset($_POST) && $_POST['bookPublished']!='')
        update_post_meta( $topic_id, 'bookPublished', $_POST['bookPublished'] );
    //  if (isset($_POST) && $_POST['bookDescription']!='')
    //    update_post_meta( $topic_id, 'bookDescription', $_POST['bookDescription'] );
      if (isset($_POST) && $_POST['bookPages']!='')
        update_post_meta( $topic_id, 'bookPages', $_POST['bookPages'] );
      if (isset($_POST) && $_POST['bookPublisher']!='')
        update_post_meta( $topic_id, 'bookPublisher', $_POST['bookPublisher'] );
      if (isset($_POST) && $_POST['bookISBN']!='')
        update_post_meta( $topic_id, 'bookISBN', $_POST['bookISBN'] );
      }
    
    add_action('bbp_template_before_replies_loop', 'bbp_show_extra_fields');
    //add_action('bbp_template_before_main_content', 'bbp_show_extra_fields');
    function bbp_show_extra_fields() {
      $topic_id = bbp_get_topic_id();
      $valuec = get_post_meta( $topic_id, 'bookCover', true);
      $value1 = get_post_meta( $topic_id, 'bookAuthor', true);
      $value2 = get_post_meta( $topic_id, 'bookPublished', true);
    //  $value3 = get_post_meta( $topic_id, 'bookDescription', true);
      $value4 = get_post_meta( $topic_id, 'bookPages', true);
      $value5 = get_post_meta( $topic_id, 'bookPublisher', true);
      $value6 = get_post_meta( $topic_id, 'bookISBN', true);
    
    //Below is the table format for displaying a book. Might consider changing this
    //to a form??? html header???
    ?>
    
      <table style="width:900px">
      <col width="100">
        <col width="265">
        <col width="535">   
    		  <tr>
          <td style="vertical-align:top">
          <img src=<?php printf(rawurldecode($valuec))?> />
          </td>
          
          <td style="vertical-align:top">
    			 <strong><p style="font-size: 14px";>Author: </strong><?php printf( $value1); ?> </p>
    			 <strong><p style="font-size: 14px";>Published: </strong><?php printf( $value2); ?></p>					     
           <strong><p style="font-size: 14px";>Page(s): </strong><?php printf( $value4); ?></p>
    			 <strong><p style="font-size: 14px";>Publisher: </strong><?php printf( $value5); ?></p>
           <strong><p style="font-size: 14px";>ISBN: </strong><?php printf( $value6); ?></p><br>
           <strong><div style="font-size: 14px";>Description </strong></div>
          </td>
          </tr>
      </table>
    
    <?php
    }

    It would probably also be instructive for me to include the review-meta.php file that is called by javascript, so here is that code as well:

         if ( isset( $_POST['cover'] )) {
            $cover = $_POST['cover'];
          }
         if ( isset( $_POST['coverSmall'] )) {
            $coverSmall = $_POST['coverSmall'];
          }      
         if ( isset( $_POST['title'] )) {
            $title = $_POST['title'];
          }
         if ( isset( $_POST['author'] )) {
            $author = $_POST['author'];
          }
         if ( isset( $_POST['published'] )) {
            $published = $_POST['published'];
          }
         if ( isset( $_POST['description'] )) {
            $description = $_POST['description'];
          }
         if ( isset( $_POST['pages'] )) {
            $pages = $_POST['pages'];
          }
         if ( isset( $_POST['publisher'] )) {
            $publisher = $_POST['publisher'];
          }
         if ( isset( $_POST['ISBN'] )) {
            $ISBN = $_POST['ISBN'];
          }
          $r=array("cover"=>$cover,"coverSmall"=>$coverSmall,"title"=>$title,"author"=>$author,"published"=>$published,
          "description"=>$description,"pages"=>$pages,"publisher"=>$publisher,"ISBN"=>$ISBN);
          print(json_encode($r));
    #147104
    Anonymous User 13302461
    Inactive

    As somebody who can bodge/program (quite) basic php code, do you think I could modify this and add a link or might it be difficult? You could potentially save me wasting hours or days of my life trying in futility!

    Thank you.

    #147100

    In reply to: Missing Topic Intro

    Robin W
    Moderator

    ‘make less of an assumption about the degree of tech literacy us ordinary users have?’

    I had assumed because you were able to look at wp-tables, you were techy !

    I try hard to match responses to authors, but it’s difficult sometimes to judge the degree of technicality, and I’m just a humble volunteer on this site who does this for nothing and has a day job and family, so please don’t shoot those that are trying (if badly sometimes :-)) to help !

    Are you techy enough to edit and ftp .php files, or add code to your functions file? If so then come back and I’ll try to help further

    #147099
    Robin W
    Moderator

    I haven’t taken a detailed look at your problem but you could try adding this to you functions file

    
    //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' );
    #147093
    Robin W
    Moderator

    Do you want me to include the bbpress custom fields code?

    yes please !

    #147082
    Jerry
    Participant

    No problem. I found out that I did not need to create that extra function after all. All I had to do was place ‘bbp_topic_content’ in the ajax function. Here is the javascript. I put more code below this.

    <script>
          $(function() {
          $( "#dialog" ).dialog({height: 550, width: 450});
            $( ".submit" ).click(function(){
            $.ajax({
             type: "POST",
             url: 'review-meta.php',
             async:true,
             dataType: 'json',
             //assign values to the variables to be passed to the server via data, according to their B position
             //within the foreach array. See script within loop for jquery window to see how B is derived.
             data: { B : B, cover : b_cover[B], coverSmall : b_cover_small[B], title : b_title[B], author : b_author[B], published : b_published[B],
             ISBN : b_ISBN[B], description : b_description[B], pages : b_pages[B], publisher : b_publisher[B]},
             success: function(data)
                 {
                 //identify the variables for unique handing on the server side, this is
                 //how the book data gets to the input fields for bbpress forums
                 $("textarea[name='bookCover']").val(data.cover);
                 $("input[name='bookCoverSmall']").val(data.coverSmall);
                 $("input[name='bbp_topic_title']").val(data.title);
                 $("input[name='bookAuthor']").val(data.author);
                 $("input[name='bookPublished']").val(data.published);
                 //$("textarea[name='bookDescription']").val(data.description);
                 $("input[name='bookPages']").val(data.pages);
                 $("input[name='bookPublisher']").val(data.publisher);
                 $("input[name='bookISBN']").val(data.ISBN);
                 $("textarea[name='bbp_topic_content']").val(data.description);
                 //alert(B);
                 },
                 //error: function(errorThrown){
                 //alert('error');
                 //},
                 });
          $( "#dialog" ).dialog( "close" );
          });  });
    </script> 

    Here’s how I did variable assignment in a different script, located within the loop where I am generating results. I did not include all the variable as this is long. Also, I am wondering if I could have done some type of auto-indexing instead of having to list each result. Luckily there are only 10, otherwise this would have been crazy.

    $( ".submit" ).click(function(){
                //get the id number of the button the user selects, which is indexed for each result
                //the variable B is then decremented 1 from id because javascript arrays begin with [0]
                if(this.id.indexOf('select')>-1) {var id = (this.id.split(" "))[1]; console.log(id);}
                B = id - 1;   });
                //create an array for all 10 results. There is probably a cleaner way to do this
                var b_cover = [<?php echo json_encode($b_cover[1]); ?>,<?php echo json_encode($b_cover[2]); ?>,<?php echo json_encode($b_cover[3]); ?>,<?php echo json_encode($b_cover[4]); ?>,
                <?php echo json_encode($b_cover[5]); ?>,<?php echo json_encode($b_cover[6]); ?>,<?php echo json_encode($b_cover[7]); ?>,<?php echo json_encode($b_cover[8]); ?>,
                <?php echo json_encode($b_cover[9]); ?>,<?php echo json_encode($b_cover[10]); ?>];
                //this is the javascript foreach that stores the array values 0 to 9
                b_cover.forEach(function(entry){console.log(entry);});
                
                var b_title = [<?php echo json_encode($b_title[1]); ?>,<?php echo json_encode($b_title[2]); ?>,<?php echo json_encode($b_title[3]); ?>,
                <?php echo json_encode($b_title[4]); ?>,<?php echo json_encode($b_title[5]); ?>,<?php echo json_encode($b_title[6]); ?>,
                <?php echo json_encode($b_title[7]); ?>,<?php echo json_encode($b_title[8]); ?>,<?php echo json_encode($b_title[9]); ?>,<?php echo json_encode($b_title[10]); ?>];
                b_title.forEach(function(entry){console.log(entry);});

    Do you want me to include the bbpress custom fields code?

    Jerry
    Participant

    I am using themes and modifying bbpress.css. I figured out how to remove the roles of people making posts. I want to remove the topic authors only, but keep all authors of replies. Here are the changes I made to bbpress.css, which was to put “dislay: none;” under the forum and topic authors, but that has not worked.

    #bbpress-forums div.bbp-forum-author,
    #bbpress-forums div.bbp-topic-author {
      display: none;
    }
    #bbpress-forums div.bbp-reply-author {
    	float: left;
    	text-align: center;
    	width: 115px;
    }
    
    #bbpress-forums div.bbp-forum-author img.avatar,
    #bbpress-forums div.bbp-topic-author img.avatar {
      display: none;
    }
    #bbpress-forums div.bbp-reply-author img.avatar {
    	border: none;
    	max-width: 80px;
    	padding: 0;
    	margin: 12px auto 0 auto;
    	float: none;
    }
    
    #bbpress-forums div.bbp-forum-author a.bbp-author-name,
    #bbpress-forums div.bbp-topic-author a.bbp-author-name {
      display: none;
    }
    #bbpress-forums div.bbp-reply-author a.bbp-author-name {
    	margin: 0 12px;
    	word-break: break-word;
    	display: inline-block;
    }
    
    #bbpress-forums div.bbp-topic-author a.bbp-author-name {
      display: none;
    }
    #bbpress-forums div.bbp-reply-author a.bbp-author-name {
    	clear: left;
    	display: block;
    }
    
    #bbpress-forums div.bbp-forum-author .bbp-author-role,
    #bbpress-forums div.bbp-topic-author .bbp-author-role,
    #bbpress-forums div.bbp-reply-author .bbp-author-role {
      display: none;
    //	font-size: 11px;
    //	font-style: italic;
    }
    
    #bbpress-forums li.bbp-header .bbp-search-author,
    #bbpress-forums li.bbp-footer .bbp-search-author,
    #bbpress-forums li.bbp-header .bbp-forum-author,
    #bbpress-forums li.bbp-footer .bbp-forum-author,
    #bbpress-forums li.bbp-header .bbp-topic-author,
    #bbpress-forums li.bbp-footer .bbp-topic-author {
      display: none;
    }

    The only way I have found to remove the topic author is to insert “display: none;” under the topic-reply authors, but that removes the topic-reply authors as well, which I don’t want to do. Perhaps I need to get into a php file to do this? If so, can someone direct me to the correct file? Thanks.

    #147080
    jamesict
    Participant

    Hi,

    I am using the [bbp-topic-tags] shortcode on a page and would like to add some kind of separator between each tag [maybe a pipe | if possible].

    Does anyone know how this can be done?

    Thank you for any advice you can offer.

    #147070
    yoosuke
    Participant

    I really appreciate your response!
    bbPress support is great!

    I’ve worked for about 3years as a Web designer.
    So, I can understand HTML and CSS3,
    and how to edit and ftp files as well.

    For php, I learned the just basics before.
    So, I can read basic php codes,
    but I can’t write php codes by my own.

    Thanks for telling URL “Shorten freshness wording”.
    The codes should be helpful for me.
    However, I have no idea to customize the codes to get to my Two goals…

    #147069
    devonc01
    Participant

    Just wanted to confirm that this worked for me, I had found an older solution that also was meant to be applied to the theme’s functions.php file that, in-turn, broke some things in buddyPress – namely, was presenting the profile name as an HTML-a-href link presented as text – using this code, which is presented as an example in the WordPress Codex worked without any further breakings (that I am currently aware of). Thank you, Stephen

    #147068
    Robin W
    Moderator

    I’m sorry but I know nothing of buddypress, but I thought you wanted your page to look like the bbp profilepage, and that simply uses code to create the urls hence why I quoted them !!

    If you just type these urls in, they work, they don’t need any code.

    so what happens if you just rename the form-user-edit.php to settings.php and drop it in the right directory?

    #147066

    In reply to: Newby a little lost

    Robin W
    Moderator

    Now you’ve got it full width, you may decide that actually you want a sidebar, but one for your forum that includes logon, register etc.

    see

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

    #147064

    In reply to: Sticky thread Issues

    Robin W
    Moderator

    yes,

    add this to your functions file

    //This function adds the words sticky before the title
    function bbp_sticky_display () {
    		if(bbp_is_topic_sticky()) {
    		echo '<span class="sticky-display">' ;
    		echo 'Sticky Topic' ; 
    		echo '</span>' ;
    		}
    	}
    		
    add_action ('bbp_theme_before_topic_title', 'bbp_sticky_display') ;

    and this to your style.css

    #bbpress-forums .sticky-display{
    background: none repeat scroll 0 0 #5BB75B;
    color: #FFFFFF;
    display: in-line;
    padding: 5px;
    }

    you can change the words and styling to suit !

    #147063
    elaborate
    Participant

    is this what you are describing as the template file? and which file is that and is it a php file?

    Let’s start with this. The file is a BuddyPress template file called settings.php. It’s wiped clear of any code though. You can find it in buddypress/bp-templates/bp-legacy/buddypress/members/single if you have downloaded BuddyPress.

    This template file controls the BuddyPress user Settings page and I am trying to turn it into a working copy of the bbPress user Edit page.

    ok, so if I understand you correctly, you are trying to have the links that are … and place them on a buddypress page?

    I can’t figure out why you’re listing the URLs you mentioned in above quote again. I’m really sorry if I’m missing something, but I feel like I need to reaffirm that this is not what I’m doing.

    #147059
    elaborate
    Participant

    Thanks for the reply.

    I can’t actually access the BuddyPress Settings page in the backend. Are you suggesting I use the shortcode inside the template file?

    I’m making a theme, so I would really prefer not to rely on plugins. Besides, I would love to know how the form-user-edit.php actually works. 🙂

    Can you say what I need to edit or add to the content of form-user-edit.php get to get it to work somewhere else?

    I’m not sure what you mean by calling each by their url. Can you elaborate?

    #147054

    In reply to: Newby a little lost

    Robin W
    Moderator

    You nee to get bbpress to use a full width page template

    see

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

    #147052
    Robin W
    Moderator

    There should be no reason they won’t integrate.

    However the first thing you should do is create a test site see

    https://codex.bbpress.org/creating-a-test-site/

    The you can do everything without any pain !

    From what you describe, if you really want to go to a separate route, then the simplest route is for you to have two domains the primary and a subdomain. On the subdomain you would install wordpress, and the same theme as your main site and then add bbpress, put the files in there. As you then say, you’d just call this subdomain from your main site.

    #147051
    Robin W
    Moderator

    you will need to filter two functions

    1. bbp_get_forum_freshness_link

    2. You will need to amend the freshness function

    Layout and functionality – Examples you can use

    I have no idea how into coding you are, so come back and let me know so that I can help you further

    How much php do you know
    do you know how to edit files
    do you know how to ftp

    yoosuke
    Participant

    Hello from Japan!
    bbpress is great!

    Well, I’m in trouble.
    so I would appreciate if you help me.

    1.
    By default, an anchor tag is given to texts of “freshness“. like…

    <a>2hours, 1minute ago</a>

    To remove the anchor tag from freshness texts, which files should I modify ?
    Could you please tell me a path to get to the file?

    2.
    By default, a comma is used in display of “freshness”. like..

    2hours,(←here!) 1minute ago

    I want to also remove the comma.
    In this case, a file to be modified will be the same as the file described above?

    Thanks for reading,
    and I’m looking forward to your reply…

    WordPress: ver3.9.1
    bbPress: ver2.5.3

    #147043
    Jerry
    Participant

    This is a rare event for me; I figured this out within 4 hours of posting it. I am including the solution in case someone else decides they want to do the same thing. I had the input name correct: bbp_topic_content. As I was guessing above, I merely had to create a new function. Below is the variable declaration in javascript, and the function that auto-populates the content field of a new topic:
    $("textarea[name='bbp_topic_content']").val(data.description);

    add_action ( 'bbp_get_the_content', 'bbp_description_to_topic');
    function bbp_description_to_topic(){
        $value = get_post_meta( bbp_get_topic_id(), 'bbp_topic_content', true);
        echo "<p><textarea style='width: 414px; height: 151px' name='bbp_topic_content' value='".$value."'></textarea></p>";
    }
    #147042
    artgeek
    Participant

    I’m working on a site that uses both BuddyPress and bbPress. All the BP functionality is in a community parent directory and I’d like to run bbPress out of the same, e.g.

    http://mydomain.com/community/forums

    I was able to create this page and use the bbPress shortcode to display the forum index at this location, but this doesn’t change any of the rest of the directory structure of my forums, e.g., when I click on a forum, I’m redirected to

    http://mydomain.com/forums/forum/myforumname

    The community parent directory is lost. Is there a way for me to keep all bbPress URLs under the community directory?

    Jerry
    Participant

    I put this in “pimp your press”, but now I think it belongs in the troubleshooting forum. Not certain.

    I have created custom fields for my bbpress topics, and I have learned how to auto-populate those fields when a user clicks a button. I have also learned how to auto-populate the Topic Title. I am using javascript to auto-populate the topic title. Here is how I assign the data:

    $("input[name='bbp_topic_title']").val(data.title);

    I am showing this as an example to show what I need. My question is; am I able to auto-populate the content of a new topic, much like I am doing with the title for a new topic?

    To auto-populate the content of a new topic, I assume I need to have the correct term, which I think would be ‘bbp_topic_content’? So it would look like this?

    $("input[name='bbp_topic_content']").val(data.description);

    Here are three functions I am using for custom fields:

    add_action ( 'bbp_theme_before_topic_form_content', 'bbp_extra_fields');
    function bbp_extra_fields() {
     $value = get_post_meta( bbp_get_topic_id(), 'bookCover', true);
       echo '<label for="bookCover">Book Cover URL</label><br>';
       echo "<p><input type='text' name='bookCover' value='".$value."'></p>";
    }
    add_action ( 'bbp_new_topic', 'bbp_save_extra_fields', 10, 1 );
    add_action ( 'bbp_edit_topic', 'bbp_save_extra_fields', 10, 1 );
     
    function bbp_save_extra_fields($topic_id=0) {
      if (isset($_POST) && $_POST['bookCover']!='')
        update_post_meta( $topic_id, 'bookCover', $_POST['bookCover'] );
    }
    add_action('bbp_template_before_replies_loop', 'bbp_show_extra_fields');
    //add_action('bbp_template_before_main_content', 'bbp_show_extra_fields');
    function bbp_show_extra_fields() {
      $topic_id = bbp_get_topic_id();
      $valuec = get_post_meta( $topic_id, 'bookCover', true);
    }

    I am thinking that I need some sort of “add_action” to get this accomplished? Do I need to create a new function? I’ve been looking in templates.php to try and get a hint to figure this out. Any help would be GREATLY appreciated. Thanks.

    Jerry
    Participant

    I have created custom fields for my bbpress topics, and I have learned how to auto-populate those fields when a user clicks a button. I have also learned how to auto-populate the Topic Title. I am using javascript to auto-populate the topic title. Here is how I assign the data:
    $("input[name='bbp_topic_title']").val(data.title);
    I am showing this as an example to show what I need. My question is; am I able to auto-populate the content of a new topic, much like I am doing with the title for a new topic?

    To auto-populate the content of a new topic, I assume I need to have the correct term, which I think would be ‘bbp_topic_content’? So it would look like this?
    $("input[name='bbp_topic_content']").val(data.description);
    Here are three functions I am using for custom fields:

    add_action ( 'bbp_theme_before_topic_form_content', 'bbp_extra_fields');
    function bbp_extra_fields() {
     $value = get_post_meta( bbp_get_topic_id(), 'bookCover', true);
       echo '<label for="bookCover">Book Cover URL</label><br>';
       echo "<p><input type='text' name='bookCover' value='".$value."'></p>";
    }
    add_action ( 'bbp_new_topic', 'bbp_save_extra_fields', 10, 1 );
    add_action ( 'bbp_edit_topic', 'bbp_save_extra_fields', 10, 1 );
     
    function bbp_save_extra_fields($topic_id=0) {
      if (isset($_POST) && $_POST['bookCover']!='')
        update_post_meta( $topic_id, 'bookCover', $_POST['bookCover'] );
    }
    add_action('bbp_template_before_replies_loop', 'bbp_show_extra_fields');
    //add_action('bbp_template_before_main_content', 'bbp_show_extra_fields');
    function bbp_show_extra_fields() {
      $topic_id = bbp_get_topic_id();
      $valuec = get_post_meta( $topic_id, 'bookCover', true);
    }
    

    I am thinking that I need some sort of “add_action” to get this accomplished? Do I need to create a new function? Any help would be GREATLY appreciated. Thanks.

    #147023
    demonboy
    Participant

    I’m sure this has been asked before but I can’t find a solution yet. I’d like to style one particular forum differently to the others, in particular all the replies in every topic. Do I use the post id or the forum name? My forum is called ‘assignments’ and the forum post id is 2881, but of course all topics within that forum have a different post id. Can’t work it out. I’ve tried variations on this:

    #bbpress-forums #post-2881 .bbp-reply-content {font-family:Verdana, Geneva, sans-serif; font-size:0.8em;}

    Any pointers?

    #147021
    inventor1
    Participant

    Ok finally fixed it, and it’s working with the plugin.
    I just added these lines for functions.php
    See the code here:

    https://bbpress.trac.wordpress.org/ticket/1478#comment:7

Viewing 25 results - 11,751 through 11,775 (of 32,521 total)
Skip to toolbar