Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 4,526 through 4,550 (of 32,481 total)
  • Author
    Search Results
  • 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?

    #189635

    In reply to: bbPress Post Via Mail

    Stephen Edgar
    Keymaster

    This plugin supports posting to bbPress by email https://github.com/rmccue/falcon

    It’s out of date and needs some testing and reporting what does and doesn’t work

    If anyone could help with the I could help get any code changes required added ๐Ÿ™‚

    #189632
    liderxlt
    Participant

    Hello, people again. I know that this is not the official forum of the plugin but as there are few add-ons for the import in bbpress I am sure that some time they will have used it.

    I’m still struggling to import and update my forum automatically. As you can see in previous topics I was trying to import from xml files and with the plugin allimport.

    Hello, people again. I know that this is not the official forum of the plugin but as there are few add-ons for the import in bbpress I am sure that some time they will have used it.

    I’m still struggling to import and update my forum automatically. As you can see in previous topics I was trying to import from xml files and with the plugin allimport.

    Now I try to import with the bbPress Import & Export plugin.The problem is
    โ€œAJAX Errorโ€ message when importing

    I thought the structure of the csv file was wrong so I made a clean forum with topic and replic, export it to import it again but the same error comes out.

    The first time I import, I also appreciate the error message but it was the only time I import some topic, then I could not import anymore.

    I leave the structure of the csv file.

    "ID","post_date","post_date_gmt","post_content","post_title","post_status","comment_status","post_parent","menu_order","post_type","post_mime_type","post_alter_id","tag_topic"
    "241","2018-01-20","2016-02-02","CONTENIDO","2415/15 | NOMBRES s/ JUICIO EJECUTIVO","publish","closed","19","0","topic","","241","2415/15"
    "285","2018-01-20","2016-02-02","CONTENIDO","2859/15 | NOMBRES ","publish","closed","19","0","topic","","285","2859/15"
    "172","2018-01-20","2016-02-02","CONTENIDO","1723/14 | NOMBRES s/ JUICIO EJECUTIVO","publish","closed","19","0","topic","","172","1723/14"
    "226","2018-01-20","2016-02-02","CONTENIDO","226/12 | NOMBRES s/ JUICIO EJECUTIVO","publish","closed","19","0","topic","","226","226/12"
    "227","2018-01-20","2016-02-02","CONTENIDO","227/12 | NOMBRES s/ JUICIO EJECUTIVO","publish","closed","19","0","topic","","227","227/12"
    "258","2018-01-20","2016-02-02","CONTENIDO","2583/15 | NOMBRES s/ JUICIO EJECUTIVO","publish","closed","19","0","topic","","258","2583/15"
    "257","2018-01-20","2016-02-02","CONTENIDO","2575/15 | NOMBRES s/ JUICIO EJECUTIVO","publish","closed","19","0","topic","","257","2575/15"
    "255","2018-01-20","2016-02-02","CONTENIDO","2557/15 | NOMBRES s/ JUICIO EJECUTIVO","publish","closed","19","0","topic","","255","2557/15"
    "256","2018-01-20","2016-02-02","CONTENIDO","2569/15 | NOMBRES s/ JUICIO EJECUTIVO","publish","closed","19","0","topic","","256","2569/15"
    "258","2018-01-20","2016-02-03","CONTENIDO","2586/15 | NOMBRES s/ JUICIO EJECUTIVO","publish","closed","19","0","topic","","258","2586/15"

    I’m working on a localhost installation.
    Regards!

    #189627
    Pascal Casier
    Moderator

    I just added this on my test site:

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

    And I when I go to the profile of a user (in my case /forums/users/user1/), I now correctly find:
    <meta name='robots' content='noindex,follow' />

    Could you have a check on your side?

    swagataminnovations
    Participant

    @pascal, thank you very much for your consideration.

    However, I think you should make an effort to upgrade your plugin with the mentioned feature so that the migrated comments to bbpress can be shown under the individual posts by the users.

    I cannot see any reason why we should wait for the permission of the other plugin author?

    Because you are not copying anybody’s codes, you are only creating a similar functionality in your plugin

    #189585
    Robin W
    Moderator

    your smtp service will be expecting the correct email address

    what is set is

    dashboard>settings>general>email address

    and does it match your smtp?

    1. You should be aware that many spam filters strip messages that do not come from the correct address. So if your site is mysite.com and your email address in wordpress settings>general is fred@gmail.comthen it is likely that messages will be dumped in transit. You need to set up email to come from your site eg fred@mysite.com, your hosting provider can help if needed.
    2. Just bbpress?
    Then you need to see if this is wordpress wide or just bbpress.
    Try https://wordpress.org/plugins/check-email/

    #189584
    suraj1977
    Participant

    Hi Robin,
    Thanks for the reply.
    I have tried with above plugin. Unfortunately, it didn’t help.
    I have added above code in Child theme’s function file. Still unable to send registration/verification mails.
    Kindly suggest.

    Suraj Awadhani

    #189577
    Robin W
    Moderator

    It wasn’t until I started googling this that I notice it is a recurring issue with bbpress sites using smtp, and hasn’t got a definitive answer.

    As far as I can see two things seem to help.

    1. amending the from address
    2. not sending bulk emails

    this plugin seems to address these two issues

    Can you try it and report back

    AsynCRONous bbPress Subscriptions

    also there is a code snippet that lets you change the from address that smtp may well need -I don’t think it is needed as the plugin does this I hope (I haven’t tested the plugin), but quoted just in case ๐Ÿ™‚

    However, something causes that in the forum post notifications the โ€œFromโ€ is set back to the default <noreply@domain.com>, although it is set to different/custom address by the WP Mail SMTP plugin. My web hosting service blocks the PHP mails sent from unknown addresses, so thatโ€™s the reason why the e-mails are not delivered.

    /*BBPress email fix*/
    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';
    }
    #189553
    Robin W
    Moderator

    Not sure what to advise for best.

    I’m not a bbpress author, so have no direct influence on code.

    However I have 6 plugins that are sub-plugins to bbpress most of which have shortcodes that won’t display correctly under 2.6rc5.

    I have asked the authors to reconsider restricting bbpress – the min file is only 32kb, so won’t affect load times to go on all pages – it is just downloaded once when the site is accessed.

    If they decide to go as is, I will need to duplicate part or all of the bbpress.css file in my plugins, which means that someone using 3 of my plugins will get the same css downloaded 4 times – 3 by me and one by bbpress which is not good ๐Ÿ™‚

    So watch this space.

    if you are deep into coding, you could just enqueue a copy of bbpress.css in your theme, or probably much easier just dump the contents of bbpress.css into your theme’s css – that will fix it.

    #189549
    TechHaus
    Participant

    @robin-w, I owe you big time! Thank you. I will check to see if that causes any other issues on the site, but for now, it seems to have fixed it on my local site.

    I guess for now I will rely on sidebar widgets for bringing the forum to the front page. Do you think I should attempt my own loop there instead of using the shortcode, or just wait a bit until the 2.6 officially comes out?

    Thank you soooo much for looking into this for me.

    #189548
    Robin W
    Moderator

    I’ve now set up a quick test site for 2.65c5 to validate

    I can confirm that

    <?php echo do_shortcode("[bbp-forum-index]"); ?>

    doesn’t work but the shortcode on a page on it’s own does.

    However your issue with profiles is a theme/bbpress one, it all works on my test site.

    Can you try adding this to your themes css

    #bbpress-forums ul.bbp-forums, #bbpress-forums ul.bbp-lead-topic, #bbpress-forums ul.bbp-replies, #bbpress-forums ul.bbp-search-results, #bbpress-forums ul.bbp-topics {
    	overflow: visible !important;
    	}

    that seemed to fix it for your site, but I haven’t checked that it doesn’t create issues elsewhere !

    #189544
    Robin W
    Moderator

    ok, 2.6 is trying to just load on bbpress content pages, but obviously is missing those that use code.

    I’ll update the trac ticket

    #189542
    TechHaus
    Participant

    Good call! And guess what, it works if I use the shortcode on a page via the wordpress backend.

    bbpress Shortcode test

Viewing 25 results - 4,526 through 4,550 (of 32,481 total)
Skip to toolbar