Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 1,101 through 1,125 (of 32,432 total)
  • Author
    Search Results
  • #228927
    Robin W
    Moderator

    I doubt this can be solved as posted without custom code.

    You can import files using

    GD bbPress Attachments

    It would be possible to add some fields to the topic and or reply fields – this article explains the principals.

    https://wp-dreams.com/articles/2013/06/adding-custom-fields-bbpress-topic-form/

    Whilst it talks about the functions file, you can also use code snipetts

    Code Snippets

    so for instance if you wanted to try their code you would put all this into a single code snippet

    add_action ( 'bbp_theme_before_topic_form_content', 'bbp_extra_fields');
    function bbp_extra_fields() {
       $value = get_post_meta( bbp_get_topic_id(), 'bbp_extra_field1', true);
       echo '<label for="bbp_extra_field1">Extra Field 1</label><br>';
       echo "<input type='text' name='bbp_extra_field1' value='".$value."'>";
    
       $value = get_post_meta( bbp_get_topic_id(), 'bbp_extra_field2', true);
       echo '<label for="bbp_extra_field1">Extra Field 2</label><br>';
       echo "<input type='text' name='bbp_extra_field2' value='".$value."'>";
    }
    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['bbp_extra_field1']!='')
        update_post_meta( $topic_id, 'bbp_extra_field1', $_POST['bbp_extra_field1'] );
      if (isset($_POST) && $_POST['bbp_extra_field1']!='')
        update_post_meta( $topic_id, 'bbp_extra_field1', $_POST['bbp_extra_field2'] );
    }
    add_action('bbp_template_before_replies_loop', 'bbp_show_extra_fields');
    function bbp_show_extra_fields() {
      $topic_id = bbp_get_topic_id();
      $value1 = get_post_meta( $topic_id, 'bbp_extra_field1', true);
      $value2 = get_post_meta( $topic_id, 'bbp_extra_field2', true);
      echo "Field 1: ".$value1."<br>";
      echo "Field 2: ".$value2."<br>";
    }

    There are reply equivalents, but would need you to specify what should go into topic and what reply

    #228926
    Robin W
    Moderator

    This might be the same as you are saying you don’t want – the user can press the submit, but it returns an error. As close as you’ll get without some js.

    function rew_min_length ($reply_content) {
    	if (strlen($reply_content)<500) {
    		bbp_add_error( 'bbp_reply_content', __( '<strong>ERROR</strong>: Your reply must be at least 500 characters.', 'bbpress' ) );
    	}
    return $reply_content ;
    }
    
    add_filter( 'bbp_new_reply_pre_content', 'rew_min_length' );
    #228896
    Robin W
    Moderator
    #228891
    Robin W
    Moderator

    creating a link within the forum can be done with a hook to the code quite easily.

    The problem would be knowing what course sent the user to the forum, it may well be a parameter in the learndash course database (eg this course has this forum), but beyond free help to work out.

    Contact me via http://www.rewweb.co.uk/contact-me/ if you want me to look.

    #228846
    Satish
    Participant

    Thank you ..

    The issue was with SEO plugins Yoast SEO.

    If anyone else facing similar issue, you can disable breadcrumbs from Yoast SEO:
    /wp-admin/admin.php?page=wpseo_titles#top#breadcrumbs

    Thanks a lot for all the help @robin-w

    #228781
    uisneach
    Participant

    Hi,
    I’m using WordPress 5.9.3 and bbPress 2.6.9.
    I have checked the option for “Allow users to subscribe to forums and topics” in the bbPress settings. However, I don’t see the Subscribe/Unsubscribe button/link above a Forum. I do see the option to subscribe to a Topic when replying to a topic. I’ve tried viewing the forum while logged in with different user roles including Administrator but still no joy.

    I have even tried creating my own shortcodes to try and output the subscribe link but it doesn’t output anything. e.g. while in the loop, bbp_forum_subscription_link( array( ‘before’ => ”, ‘subscribe’ => ‘+’, ‘unsubscribe’ => ‘×’ ) )

    Is there something I’m missing?

    #228749
    maestromike1977
    Participant

    Hi, I’m using Buddyboss theme, and when a user creates a group with a forum, I need the forum to have by default certain topics set up, eg. ‘Rules’, ‘General Chat’ etc (so me/user doesn’t need to set these topics up every time a group is created). Not sure how to code this, any help appreciated, thanks!

    #228747
    Viswa RJ
    Participant

    Hi,

    As said earlier, I have tried installing the bbpress in a demo wordpress domain. With bbPress, I installed and activated only

    1. Advanced Editor Tools (previously TinyMCE Advanced),
    2. Classic Editor,
    3. Highlighting Code Block

    plugins. Created sample forums with few topics. Later, I have created a username and logged in as a participant and tried to post the same topic and reply (Nothing changed). Topic got posted, it never shown any error such as Duplicate topic detected or Duplicate reply detected. At the end of the slug, it has added -2 and got posted as topic-name-2.

    Please help me resolve this issue AEAP.

    #228725
    Robin W
    Moderator

    This code should do it

    add_filter ('bbp_current_user_can_access_create_topic_form' , 'rew_only_one_topic', 10 , 1) ;
    add_filter( 'gettext', 'rew_change_text', 20, 3 );
    
    function rew_only_one_topic ($retval) {
    	//first check if they have access, only amend if they have
    	if ($retval==true) {
    		$user_id = wp_get_current_user()->ID;
    		$role = bbp_get_user_role( $user_id );
    		if ($role == 'bbp_participant') {
    		$last_posted = bbp_get_user_last_posted( $user_id );
    		if (time() <($last_posted + (60*60*24*31))) $retval = false ;
    		}
    	}
    	return $retval ;
    }
    
    function rew_change_text($translated_text, $text, $domain ) {
    	if ( $text == 'You cannot create new topics.') {
    		$user_id = wp_get_current_user()->ID;
    		$role = bbp_get_user_role( $user_id );
    		if ($role == 'bbp_participant') {
    			$last_posted = bbp_get_user_last_posted( $user_id );
    			if (time() <($last_posted + (60*60*24*31))) {
    				$translated_text = 'You cannot post a new topic - you have already posted a topic in the last month';
    			}
    		}
    	}
    	return $translated_text;
    }

    The 60*60*24*31 is 60 seconds, 60 minutes, 24 hours, 31 days, so you can change this to whatever you want in both places.

    and you can change $translated_text = ‘You cannot post a new topic – you have already posted a topic in the last month’ to whatever phrase in whatever language you want.

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets

    #228714
    Robin W
    Moderator

    untested, but this should do it

    add_filter( 'bbp_new_topic_redirect_to', 'rew_forum_redirect_topic' , 10 ,3 ) ;
    add_filter( 'bbp_new_reply_redirect_to', 'rew_forum_redirect_reply' , 10 ,3 ) ;
    
    function rew_forum_redirect_topic ($redirect_url, $redirect_to, $topic_id ){
    	$redirect_url = 'http://mysite.fr/newsfeed' ;
    return $redirect_url ;
    
    }
    
    function rew_forum_redirect_reply ($redirect_url, $redirect_to, $reply_id ){
    	$redirect_url = 'http://mysite.fr/newsfeed';
    return $redirect_url ;
    
    }
    #228667
    sruddy
    Participant

    for now the forums are on a page that’s not full width, and they share the space with a sidebar. Until I redevelop the site with new theme, and format, I would like the images to open their full size when clicked. Is this possible with a setting or some code?

    #228639
    Robin W
    Moderator

    when I setup custom Profile Fields

    ok, sorry to keep asking questions, but it will hopefully get me to the stage when I can give an answer 🙂

    so this is bbpress profile – yes?

    and how are you setting up custom profile fields? – code, plugin, template change etc.?

    #228571
    sruddy
    Participant

    So I guess I’m not understanding how this all works. The website is a photography club and is wordpress.org. I just added this bbPress forum plugin and have all the forums set up. I’m ready to test with two other people. I now need to have a place were the two others can register, I then want an email so I can review and approve them. How do i accomplish this? After that I think the login page with the shortcode provided by Robin W should work.

    #228560
    sruddy
    Participant

    I tried the shortcode on a new page named login. Looks the same as the login page I use to administer the site. So I guess I need a forum registration page first, then during registration I think I can make it so forum members can only see the website and forums??

    #228549

    In reply to: identify user with @

    Robin W
    Moderator

    I wish I could claim some credit – it was some code I found somewhere !

    From looking at the code, I’m presuming that bp has that functionality somewhere else – this just seems to add it for topics/replies.

    ankskv1
    Participant

    I am getting blank pages while opening topics and I am using TwentyTwentyTwo theme.
    I have used forum index short-code to show the forum on the page.

    And the forum index page is showing index at very small size can I increase that without changing theme? (Any suggestions on this)

    Website: https://coolguy.x10.mx/tcin/forum/

    #228539
    Robin W
    Moderator

    site login is fine.

    I tend to create a page – say aclled ‘login’ with this as the shortcode

    [bbp-login]

    and then have that page’s url as the one I send to users

    #228528

    In reply to: identify user with @

    carasse64
    Participant

    Thank you @mike80222. I have read an old topic on this forum where someone had created with feature with lines of code. I have to find it again 🙂

    #228527
    Robin W
    Moderator

    sorry, test was invalid – I had my test user with too many privileges!

    So, users who can ‘Throttle’ (see https://codex.bbpress.org/getting-started/before-installing/bbpress-user-roles-and-capabilities/ for list) bypass the duplicate check – so likely that if you were testing you will have that capability.

    Can you comer back if you still have an issue.

    #228449
    Robin W
    Moderator

    untested, but this should work

    add_filter( 'bbp_get_topic_post_date', 'rew_date_only' , 20, 6) ;
    
    function rew_date_only ($result, $topic_id, $humanize, $gmt, $date, $time ){
    		$topic_id = bbp_get_topic_id( $topic_id );
    
    		// 4 days, 4 hours ago
    		if ( ! empty( $humanize ) ) {
    			$gmt_s  = ! empty( $gmt ) ? 'G' : 'U';
    			$date   = get_post_time( $gmt_s, $gmt, $topic_id );
    			$time   = false; // For filter below
    			$result = bbp_get_time_since( $date );
    
    		// August 4, 2012 at 2:37 pm
    		} else {
    			$date   = get_post_time( get_option( 'date_format' ), $gmt, $topic_id, true );
    			$result = $date;
    		}
    
    		// Filter & return
    		return apply_filters( 'rew_date_only', $result, $topic_id, $humanize, $gmt, $date, $time );
    	}
    }

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets

    #228417
    DeepBlue
    Participant

    Hi Robin

    I have your function that you gave me above :

    // FORUM ADD DATE OF TOPIC CREATION
    add_action( 'bbp_theme_after_topic_started_by' , 'rew_add_date' ); 
    
    function rew_add_date () {
    	echo ' on ' ;
    	bbp_topic_post_date() ;
    }

    I would like to show only the date and remove the time ie :

    August 4 2012 instead of August 4 2012 at 2:37 pm

    how can i get that ?

    thanks !

    #228357
    Robin W
    Moderator

    I don’t know why somehow I became a very greedy person here?

    I look forward to having complete answers.

    This makes you look like you are demanding, I am simply someone who triers to help here

    But if you are asking, then use the ‘code’ button in the reply to post the exact code you are using, and I will try and help further

    #228354
    leehaeun29
    Participant

    ??

    I said the code you provided doesn’t turn out as a hyperlink – I didn’t ask what a href Attribute is?

    Also, what about my other questions about the font size and adding forums anonymously?

    I look forward to having complete answers.

    Thank you.

    #228350
    leehaeun29
    Participant

    Hello Robin,

    Thank you so much for your assistance. I was able to change the wording through the Code Snippets plugin. Now maybe it has to do with the plugin but when I copied the code you provided, it doesn’t show the hyperlink but plan texts (I used [] instead of <> so it delivers my questions) :

    “XX forum is visible only to XX group members and YY Forum is visible only to YY group members. Please click [a href=”link”]here[/a] and sign up for the XX or YY group”

    Is there any way I can make it hyperlink? Also, I would appreciate it if you could tell me how to enlarge the font size.

    Additionally, I would like to know how can I create an anonymous topic? Now it shows my ID but I would like to make it anonymous for privacy issues.

    I really appreciate your assistance. Thank you!

    #228345
    ollietubb1
    Participant

    Hi Robin,

    Sorry for slow reply, just picking this up again.

    So, I see what you are saying but it is this page where I need to inject the content:-

    I think what you are saying is, it will add a description into the individual forums.

    So, I tried your suggestion and set up a custom page, with the shortcode in WordPress default editor as it wouldn’t work with Divi! Added the text above, does the trick.

    https://wbc1.otiscreative.co.uk/forum/

    Thanks for your help,
    Ollie

Viewing 25 results - 1,101 through 1,125 (of 32,432 total)
Skip to toolbar