Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 4,551 through 4,575 (of 32,518 total)
  • Author
    Search Results
  • #189730
    Robin W
    Moderator

    Nothing I know of to do that – it could be coded but beyond free help.

    #189727
    Pascal Casier
    Moderator

    Hi @process_of_illumination ,
    I see you have found the functions that you need.

    Try to avoid adding 5 functions if you can do it in 1, so at least change it to:

    add_action( 'wp_head', 'casiepa_add_noindex' );
    function casiepa_add_noindex() {
      if ( bbp_is_favorites() ) {
        wp_no_robots();
      }
      if ( bbp_is_topic_tag() ) {
        wp_no_robots();
      }
      if ( bbp_is_single_user_replies() ) {
        wp_no_robots();
      }
      if ( bbp_is_single_user_profile() ) {
        wp_no_robots();
      }
      if ( bbp_is_single_user_topics() ) {
        wp_no_robots();
      }
    }

    Of course the shortest way would be:

    add_action( 'wp_head', 'casiepa_add_noindex' );
    function casiepa_add_noindex() {
      if ( bbp_is_favorites() || bbp_is_topic_tag() || bbp_is_single_user_replies() || bbp_is_single_user_profile() || bbp_is_single_user_topics() ) {
        wp_no_robots();
      }
    }

    PS image removed.

    #189724
    chumtarou
    Participant

    Thanks very much Robin, great plugin and look forward to your future updates.

    One of the reasons we are hoping to show how many subscribers each forum has is to help market the popularity to entice more subscribers. It would be great to have the option to add the shortcode in the main forum page.

    Thanks very much!

    #189723
    Stephen Edgar
    Keymaster

    Thanks for the update, it was worth a try 😉

    Are you getting the correct post_parent now with those changes you’ve made?

    The notes I added in reply to @liderxlt above I’m pretty sure will get that sorted for @liderxlt

    I’m happy to look at any raw data or datebase dumps you have Mike, maybe a forum and/or topic WXR dump like that of which @liderxlt posted.

    #189715
    Robin W
    Moderator

    this function is now in

    bbp topic count

    see

    dashboard>settings>bbp topic count>shortcodes

    #189714
    Robin W
    Moderator

    I’ve just (today) released a new version of my “bbp topic count” plugin with a new shortcode which will show the top X users across the forums.

    I’ll take a quick look to see if I can make this forum specific.

    In the meantime take a look at

    dashboard>settings>bbp topic count>shortcodes to see what it is and how to use it.

    Robin W
    Moderator

    I think I have code that fixes this in

    Gravity Forms to bbPress (Force Topics to Specified Forum)

    jsteckler1
    Participant

    Hi @casiepa,

    I have failed in my attempt to set post_parent to _bbp_forum_id. Could you help me build on the code provided by @cjerrells perhaps? Though he was focused on replies, we were both experiencing the same issue on the front-end.

    Or, alternatively, I am only using ONE forum. Is there any code I could use to force ALL topics created to be sent to a specified forum?

    crookie
    Participant

    Hi, I am using the TinyMCE Editor for my Forum. The Editor display only when I comment for a Topic. When I Edit a Post or create a new Topic, it doesn’t display. I have noticed that it shows an Error in both Pages (Edit Post & Create Topic) by Debug:

    TypeError: d is undefined - tinymce.min.js:34:6212

    I would be happy if someone could Help.

    #189702
    Mike Costanzo
    Participant

    Stephen,

    I’ll ask about the database schema, but since Rainmaker is proprietary software there’s no guarantee that I will be able to get it. Stay tuned.

    Also, liderxlt asked if I was able to solve the problem. The answer is… kind of. Since I’m copying all of my content over from one site to another, in my desperation I ended up hacking the WordPress Importer plugin so that it does not look for conflicts in the $post_parent value during import. This means that existing Post content will be overwritten if it shares the same $post_parent value, which would be an untenable solution in most cases. But since my content will be identical from site to site, I’m counting it as a necessary evil.

    Here is the snippet I excised from ‘wordpress-importer.php’:

    if ( $post_parent ) {		
    // if we already know the parent, map it to the new local ID		
    if ( isset( $this->processed_posts[$post_parent] ) ) {		
    $post_parent = $this->processed_posts[$post_parent];		
    // otherwise record the parent for later		
    } else {		
    $this->post_orphans[intval($post['post_id'])] = $post_parent;		
    $post_parent = 0;		
    }		
    }

    Of course, I made these changes as a separate (cloned) plugin, so I also had to update the register_importer function as well. That way I have access to the original Importer for non-Forum Posts and Pages.

    Like I said, this is a brute force hack, and not an elegant solution. If anyone has an elegant solution, I’m all ears. Thanks!

    #189701

    Hi,

    I think I understood a little how it works and came out with this:

    add_action( 'wp_head', 'casiepa5_add_noindex' );
    function casiepa5_add_noindex() {
      if ( bbp_is_favorites() ) {
        wp_no_robots();
      }
    }
     
    add_action( 'wp_head', 'casiepa4_add_noindex' );
    function casiepa4_add_noindex() {
      if ( bbp_is_single_user_replies() ) {
        wp_no_robots();
      }
    }
    
    add_action( 'wp_head', 'casiepa3_add_noindex' );
    function casiepa3_add_noindex() {
      if ( bbp_is_single_user_profile() ) {
        wp_no_robots();
      }
    }
    
    add_action( 'wp_head', 'casiepa2_add_noindex' );
    function casiepa2_add_noindex() {
      if ( bbp_is_single_user_topics() ) {
        wp_no_robots();
      }
    }
    
    add_action( 'wp_head', 'casiepa_add_noindex' );
    function casiepa_add_noindex() {
      if ( bbp_is_topic_tag() ) {
        wp_no_robots();
      }
    }

    I tested it and it seems ok.

    Do you think it is the correct procedure?

    Thanks,

    the Process

    PS: could you please remove the picture with the link to my test site? Thanks 🙂

    jsteckler1
    Participant

    Hi @casiepa,

    Thank you for jumping in!

    Some additional details about my situation:

    Upon submission of a specified Gravity Form, I am attempting to create a new topic under a specified forum (Forum ID: 31086).

    While creating the new Topic was simple enough with the Custom Post add-on—which successfully created the Topic, including the body of the topic post, accordingly—the topic was being listed under “No Forum.” @cjerrells post got me closer, encouraging me to add another custom field named _bbp_forum_id with a default value of 31086 (the forum ID). After doing that, the assigned forum seemed to display correctly on the backend, but:

    1) The breadcrumb would only display the forum after editing and resaving the post again

    — It still will not, however, show on the front-end forum among the other forum topics

    2) The topic would finally display correctly on the front-end among the other forum topics only after adding a reply to the topic post.

    Here is a screenshot of my Gravity Form settings, as well as the code cjerrells kindly provided within my functions.php file. My ability to write php is still very elementary, and it seems a bit difficult to find a full list of bbPress actions and hooks, so I wasn’t sure exactly what needed to be altered to fit my needs.

    I would be beyond appreciative if you could give it all a look and get back to me with any thoughts or ideas you may have.

    cjerrells
    Participant

    @jsteckler1: We use GF to set a custom field called “_mu_autogenerated_post_to” and then our code looks like this:

    
    /*
     * Small fix for posting new introductions to the introductions thread
     * Would be nice to use the GF hook but post_id not set with Custom Post Types addon -_-
     */
    function set_post_parent($post_id)
    {
        if (get_post_meta($post_id,"_mu_autogenerated_post_to",true))
        {
            remove_action( 'save_post', 'set_post_parent',10); // Avoid infinite loop when wp_update_post calls save_post
            $target_discussion = get_post_meta($post_id,"_mu_autogenerated_post_to",true);
            error_log("Detected new _mu_autogenerated_post_to " . $target_discussion);
            wp_update_post( array('ID' => $post_id,'post_parent'=>$target_discussion) );
            error_log("Updated post parent.");
            add_action( 'save_post', 'set_post_parent',10);
        }    
        else
        {
           // error_log("Ignoring non-_mu_autogenerated_post_to post creation");
        }
    }
    add_action( 'save_post', 'set_post_parent',10);
    

    Hope that helps!

    #189677
    Robin W
    Moderator

    ok, so for site you are working on look at a single reply ID that is not working

    assuming you table have the wp_ prefix, then in sql type

    SELECT * FROM wp_posts WHERE ID = xx

    where xx is the name of the reply

    copy that line into anything (word, notepad etc.)

    then

    SELECT * FROM wp_postmeta WHERE post_id = xx

    and copy that.

    Then go into dashboard and do whatever you are doing to fix

    then repeat

    then come back here and say what items have changed if any

    that will get us much further forward even if nothing has changed.

    #189670
    jsteckler1
    Participant

    Ah, sorry! I missed that reply!

    But unfortunately that code broke the site (all good now that I removed the code, of course, so no worries whatsoever).

    #189667
    Robin W
    Moderator

    it may well be that my code needs debugging, but I have stacks of work os – so very limited in helping you 🙂

    #189665
    jsteckler1
    Participant

    Might it be useful to leverage any of the Gravity Forms “pre” and “after” submission hooks?

    add_action( 'gform_pre_submission', 'pre_submission' );

    add_action( 'gform_after_submission', 'after_submission', 10, 2 );

    Full documentation here and here.

    #189662
    Robin W
    Moderator

    ok, let’s see if this works

    This just adds an action on any post save and if it is a forum and has no post parent, we add your default one

    AGAIN THIS IS UNTESTED !!

    add_action( 'save_post', 'add_forum_id' );
    
    function add_forum_id( $post_id ) {
    	//get post type and post parent id
    	$post_type = get_post_type($post_id) ;
    	$post_parent = wp_get_post_parent_id ($post_id) ;
    	//if it's a forum and has no post parent (allows for normal topic creation, and other posts type creation etc.)
    	if ($post_type == bbp_get_forum_post_type() && (empty ($post_parent))) {
    		// Update topic (post) 1234  forum (post) 321
    		$my_post = array(
    			'ID'           => $post_id,
    			'post_parent'   => 31086,
    		);
    
    		// Update the post into the database
    		wp_update_post( $my_post );
    	}
    
    }
    #189661
    jsteckler1
    Participant

    Robin,

    You are a saint and I can’t even begin to express how much I appreciate you taking the time to help me out with this. Really.

    I assure you I am “proficient enough” to use an FTP client for any potential changes; I’m just very elementary in terms of writing the code myself.

    I added the code to my functions.php, but, as you suspected, it did not yield the desired result.

    I’m also totally open to ditching that plugin solution entirely, unless there is some other way you know of that I could restructure my forum in such a way that it becomes accordingly hierarchical. Or perhaps some implementation revolved around categories or topic tags? I’m open to anything that will get these submissions routed into a specified forum.

    Again, thank you so much, and please let me know if there’s anything I can provide you with that might fill in any potential blanks.

    To that end, maybe the Gravity Forms submission hooks might help? The documentation can be found here.

    #189659
    Robin W
    Moderator

    Forums and Topics are totally separate custom post types, correct?

    Yes.

    I am reticent to start delving into this plugin – there are hundreds of thousand of plugins in wordpress and I only go into those that are specifically bbpress and then only a few of those – it can take a day easily to look at and understand a plugins code 🙂

    There is a hook in topic creation that you could use

    The following code is untested, but you could put this in your functions file. You must be able to edit that file outside of wordpress (ie NOT using dashboard>appearance>editor) in case it errors so you can amend it.

    add_action( 'bbp_new_topic_pre_extras', 'new_topic_id', 10, 1 );
    
    function new_topic_id ($forum_id=0) {
    	if (empty ($forum_id)) $forum_id  = 31086 ;
    	return $forum_id ;
    }
    

    This will put any topic that doesn’t have a forum into that forum.

    #189655
    Pascal Casier
    Moderator

    If you do not want to use a plugin, check out this snippets (that you could add into your functions.php):

    add_filter( 'wp_mail_from_name', 'email_sent_from_name' );
    function email_sent_from_name( $name )
    {
        return 'SITE NAME';
    }
    add_filter( 'wp_mail_from', 'email_sent_from' );
    function email_sent_from( $email )
    {
        return 'email@example.com';
    }

    Or for more granular tasks, consider even:

    add_filter('bbp_get_do_not_reply_address','my_bbp_no_reply_email');
    function no_reply_email(){
        $email = 'noreply@yourdomain.com'; // any email you want
        return $email;
    }
    
    add_filter('bbp_subscription_to_email','my_bbp_subscription_to_email');
    function my_bbp_subscription_to_email(){
        $email = 'noreply@yourdomain.com'; // any email you want
        return $email;
    }
    #189650

    Unfortunately I found this problem with the code:

    add_action( 'wp_head', 'casiepa_add_noindex' );
    function casiepa_add_noindex() {
      if ( bbp_is_single_user_profile() ) {
        wp_no_robots();
      }
    }

    It does not add the noindex to profile sub pages:

    Correctly in no NOINDEX:

    /forumgm/profile/jacobus-johannes

    still in INDEX:

    /forumgm/profile/jacobus-johannes/topics
    /forumgm/profile/jacobus-johannes/replies
    /forumgm/profile/jacobus-johannes/favorites

    And that is bad for Mr G indexing too many unuseful pages 🙁

    the Process

    #189649
    Robin W
    Moderator

    a topic’s forum is simply its post_parent

    so your topic has a post_id and your forum has a post_id

    so

    // Update topic (post) 1234  forum (post) 321
      $my_post = array(
          'ID'           => 1234,
          'post_parent'   => 321,
           );
    
    // Update the post into the database
      wp_update_post( $my_post );
    #189648

    Thank you very much Pascal,

    your code works smoothly!

    Could you tell me, please, how to change this:

    bbp_is_single_user_profile

    to prevent indexing /topic-tag/? I am not a developer and tried some “variations on the theme” like:

    add_action( 'wp_head', 'casiepa_add_noindex' );
    function casiepa_add_noindex() {
      if ( bbp_is_single_user_profile() ) {
        wp_no_robots();
      }
    }
    
    add_action( 'wp_head', 'casiepa_add_noindex' );
    function casiepa_add_noindex() {
      if ( bbp_is_single_topic_tag() ) {
        wp_no_robots();
      }
    }

    with the scarce results I am used to.

    Thanks,

    the Process

    #189645
    Pascal Casier
    Moderator

    If you are just exporting and importing, why not using the standard WP tools export and import? See https://codex.bbpress.org/getting-started/exporting-data/

    Or are you trying to do something special?

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