Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 3,851 through 3,875 (of 32,481 total)
  • Author
    Search Results
  • #198167
    BrianHenryIE
    Participant

    When you stop and start it should continue from where it was before. This is part of the standard bbPress importer setup. Unless you choose: “Start Over: Restart the converter from the beginning (This forces all steps back to 0. Avoid duplicate data by purging or resetting first.)” on the Import Forums screen. As it suggests, under the Reset Forums tab you can delete all existing forums, topics and posts. Unfortunately, my plugin doesn’t delete the Redirection plugin settings or the images it imports (although it may be possible to hook into the forum reset code and achieve that).

    You will have to start the import again to import the images and attachments. The converter scans each post as it’s importing for local links and then retrieves the files from the uploads folder. Some are direct links, some are links via Invision’s ~attachment.php?id=123 which need to query the database to find the true file path, and some are older style Invision v3 attachments.

    As you see, the converter just creates its own forums and ignores what’s there, so just delete them.

    I don’t think there’s any need, unless something goes wrong, to give me any access. I suggest doing a feature comparison between Invision and bbPress and see what plugins you’re going to need to retain tools you were using in Invision. If they match what I know I need, I’ll work on converting the appropriate data for both of us.

    Antipole
    Participant

    It turns out to be horribly messy in my original approach. I had to poke around to pick up stuff in different places depending on whether it was invoked from the font or backend. As an example:

    $forum_id =  bbp_get_topic_forum_id($topic_id);  // This often does not work here
    		if (!$forum_id){	// need to find it elsewhere, which is different for front and backend submissions
    			$forum_id = $_POST['bbp_forum_id'] ? $_POST['bbp_forum_id'] : $_POST['parent_id'];
    			}

    Note for frontend it is to be found in $_POST[‘bbp_forum_id’] and for backend submissions $_POST[‘parent_id’]

    In the end I adopted Robin’s suggestion for hooking onto bbp_topic_attributes_metabox_save for backend and onto bap_new_topic and bap_new_reply for frontend.

    So I now have a much simpler plugin which is sending notifications when topics or replies are actually published (even after moderation) and which works with publication from front or back ends and for moderation approval in front or backends.
    Subscription choices are lost during moderation and not available in the backend. So I force-subscribe users to their own topics and to topics they reply to on publication. (They can unsubscribe later if they wish.)

    Thank you very much to those who contributed to me getting there.
    Code is to be found here

    boborg
    Participant

    I have been troubleshooting an issue with embedded iframe table from datawrapper.de. The responsive iframe code was not changing height parameters on small screens so table was cut off. After disabling plugins I found that the problem went away after disabling bbpress.

    datawrapper.de support told me this:
    A part of the embed code contains the character string [b], it seems that your CMS automatically replaces this with an html strong tag, so the embed script no longer works.

    So I guess the replace [b] with an html strong tag is part of bbpress? Any way to turn that off in bbpress?

    #198134
    BrianHenryIE
    Participant

    The forums should import ok, just without the proper title and description, and you’ll be able to see them at /wp-admin/edit.php?post_type=forum. When mine import, one parent forum with no posts contains our 13 actual forums.

    The upload folder is for copying across the images, emoticons, and attachments users have added to their posts on Invision 4 forum. If your Invision 4 forum is still live (which it probably is), the URL of your forum with /uploads added should work fine. If you set $ipb_uploads_url to null the forums themselves should import no problem, but without media.

    The table prefix is dependent on how your Invision database was set up initially. Typically, if it’s the only application using the database, there’s no need for a prefix, but if multiple applications (e.g. WordPress and Invision) share a database it’s prudent to set a prefix on the database table names so you can be confident both applications won’t try to use the same table name (e.g. “users”), and it’s essential if multiple instances of the same application share the same database (e.g. two independent WordPress installations).

    The forums->topics->replies associations all work correctly for me. Are you saying that your replies have imported but aren’t associated correctly with their topics? This isn’t something that needs the importer to complete to verify is working. Although, the topics might show how many replies are part of the topic before the replies themselves have been imported. My import takes a few hours to complete.

    Let me know how you get on. I’ve still to do more work on this myself before I finally migrate our forums so now is a good time for feedback and suggestions.

    #198127
    Robin W
    Moderator

    I doubt that this will get coded.

    If you want a specific solution, contact me via

    Contact me

    Robin W
    Moderator

    in your original code, try

    $reply_id = bbp_get_topic_id( $post->ID );
    $topic_id = $_POST['parent_id']  ;
    $forum_id = bbp_get_topic_forum_id( $topic_id );
    $reply_author_id = bbp_get_reply_author_id($reply_id);
    

    I think that $_POST[‘parent_id’] should be available at the point the transition_post_status runs

    you might also find that $post->parent_id is there as well

    #198109
    Radzio125
    Participant

    Hi, I want to display 3 latest topics with new replies for each forum category. In loop-single-forum.php file I created this:

    $count = bbp_get_forum_topic_count();
    $user = bbp_get_topic_author_id( bbp_get_forum_last_topic_id() );
    if ( $count != 0 ) {
    	echo '<a href="'. bbp_get_forum_last_topic_permalink().'"></a>'; // Link to the topic
    	echo'<a href="'. bbp_get_user_profile_url( $user ) .'"><img class="avatar" src="'. bp_core_fetch_avatar ( array( 'item_id' => $user, 'type' => 'full', 'html' => false ) ).'" /></a>'; // Link to the topic author profile with author's avatar
    	echo '<div class="title">'. bbp_get_forum_last_topic_title().'</div>'; // Title of the topic with last activity
    	echo '<div class="activity">Last activity '. bbp_get_forum_last_active_time().'</div>'; // Time of the topic last activity
    } else {
    	echo 'No topics'; // Information if there is no topics
    }

    How to display two more topics (if they exist)?

    Antipole
    Participant

    @robin-w Ahh yes! Thanks for putting me right on the number of args.
    If I follow your route, I will have work to do to work out when a topic/reply is changing to ‘publish’ as in my code.

    Antipole
    Participant

    @Barry – thanks for your interest.

    Standard WP and bbPress email notifications fall short because

    1. When a WP post is held for moderation, admin/moderators do not get any notification.
    2. When a WP post or comment is held for moderation and subsequently approved, subscribers are not notified
    3. When bbPress topics or replies are held for moderation and subsequently approved, subscribers are not notified.
    4. Sometimes it is best for admin or moderator to create or moderate topics or replies in the backend. Standard bbPress does not send subscriber notifications when they are published from the backend.

    I am working on a plugin which uses the transition_post_status hook to look for publications of the above and make notifications. I show the full plugin as of now here.

    The section above line 76 deals with WP posts held for moderation and subsequently approval. It is basically cloned from another plugin as acknowledged.

    From line 72 is my work. It looks for a topic or reply status changing to ‘publish’.
    It works when a topic or reply is published from the frontend but not from the backend. The relevant bit of code gets executed correctly, but the relevant variables are not set up correctly. I suspect that some of the functions I am calling rely on globals that are set up by the bbPress frontend but these are not in place for backend actions.

    My trace statements reveal that:

    1. Publishing a topic from the frontend works fine – BUT trace shows that $forum_id is set to zero. So the bbPress_notify_forum_subscribers call works without the $forum_id parameter being set. It must work it out otherwise.
    2. Publishing a topic from the backend fails to notify subscribers. bbPress_notify_forum_subscribers presumably fails to workout the forum-id behind the scenes.
    3. On reply publication, the code gets the $reply_id OK but the notifications do not get sent, so it must fail to work out the missing information.

    I think my basic approach of using the transition_post_status hook is good as it allows me to act when a post changes to publish from draft/pending etc. whether from the front or backends. But the calls to collect the required ids are not all they seem and rely on behind the scenes poking around in stuff that is not in place when invoked from the backend.

    Robin W
    Moderator

    @antipole

    you need to specify the number of arguments in the call so..

    function test_reply_call($reply_id, $topic_id, $forum_id, $reply_to){
    	error_log("Trace rest reply: $reply_id: ". strval($reply_id) . "; $topic_id: " . strval($topic_id) . "; $forum_id: " . strval($forum_id) . "; $reply_to: " . strval($reply_to));
    	}
    add_action('bbp_reply_attributes_metabox_save', 'test_reply_call', 10 , 4);

    the ’10’ is the priority – 10 is the standard, the higher the number the higher the priority so the order in which any other links to this hook are run, and the ‘4’ the numbers of arguments you are calling through

    Barry
    Participant

    Hi @antipole,

    Looking back at your original strategy, you only shared a fragment of your code – so it’s hard to be sure of this – but I’m wondering if the problem are the assumptions you are making about the type of $post your callback is receiving.

    https://gist.github.com/barryhughes/30bacb98b716ecaa864f0b6eaa7c051c

    Does a revised approach like the one I shared above work for you? It should give you the author ID (whether that is the author of the reply or the topic) and the forum ID. If you need to, you could add an extra test to confirm the status change reflects publication (vs a topic being set back to draft by an admin).

    #198087
    Robin W
    Moderator

    I think this does it

    $count = rew_count_no_replies () ;
    
    function rew_count_no_replies () {
    	global $wpdb;
    	$type = bbp_get_topic_post_type() ;
    	$count = (int) $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts, $wpdb->postmeta	
    	WHERE $wpdb->posts.post_type = '$type'
    	AND ( $wpdb->posts.post_status = 'publish' OR $wpdb->posts.post_status = 'private' )
    	AND $wpdb->posts.ID = $wpdb->postmeta.post_id 
        AND $wpdb->postmeta.meta_key = '_bbp_reply_count'
        AND $wpdb->postmeta.meta_value = 0 ");
    	return $count ;
    }
    Antipole
    Participant

    @robin-w thanks. I am experimenting with your suggestion. I have

    function test_reply_call($reply_id, $topic_id, $forum_id, $reply_to){
    	error_log("Trace rest reply: $reply_id: ". strval($reply_id) . "; $topic_id: " . strval($topic_id) . "; $forum_id: " . strval($forum_id) . "; $reply_to: " . strval($reply_to));
    	}
    add_action('bbp_reply_attributes_metabox_save', 'test_reply_call');

    This is fired when I post a reply in the backend, but I get

    Fatal error: Uncaught ArgumentCountError: Too few arguments to function test_reply_call(), 1 passed in /home/…/wp-includes/class-wp-hook.php on line 288 and exactly 4 expected in /home/…/wp-content/plugins/ovni-submission-notifications/pending-submission-notifications.php

    The do_action in bbp_reply_attributes_metabox_save does use 4 arguments. What am I doing wrong please?

    Robin W
    Moderator

    there is also

    do_action( 'bbp_topic_attributes_metabox_save', $topic_id, $forum_id );

    for topics

    Robin W
    Moderator

    you could hook your code to this action
    do_action( 'bbp_reply_attributes_metabox_save', $reply_id, $topic_id, $forum_id, $reply_to );

    which fires when a reply post is saved in admin and that gives you all the items you want

    Antipole
    Participant

    Various email notification functions work when a topic or reply is submitted or edited from the frontend but not from the backend. I have code which is hooked on to transition_post_status to take over notification functions when a topic or reply is published from the front or backend. It works great for topics, but I am having trouble with replies.

    I have the following code fragment fired on publication of a reply:

    $reply_id = bbp_get_topic_id( $post->ID );
    $topic_id = bbp_get_reply_topic_id( $reply_id );
    $forum_id = bbp_get_topic_forum_id( $topic_id );
    $reply_author_id = bbp_get_reply_author_id($reply_id);
    error_log("Trace point reply to be published topic_id:". strval($topic_id) . " reply_id: " . strval($reply_id) . " forum_id: " .  strval($forum_id). " author_id: " . strval($reply_author_id));

    In all cases, $reply_id and $reply_author_id are found correctly.
    When invoked from the frontend, $forum_id is found correctly, but not from the backend.
    $topic_id is shown as zero whether from front or backend.
    So bbp_get_reply_topic_id($reply_id) is not functioning as I anticipate. I have tried bbp_get_reply_topic_id( $$post->ID ) with the same result.

    How do I get the topic_id from the reply_id? Can SKS please help here?

    #198058
    Robin W
    Moderator
    // filter to show more than 50 sub forums on a forum
     function bbp_increase_subforums_per_page( $args = array() ) {
     $args['posts_per_page'] = 100 ;
     return $args;
     }
     add_filter( 'bbp_before_forum_get_subforums_parse_args', 'bbp_increase_subforums_per_page' );
    #198043
    Radzio125
    Participant

    Hi, how to get count of the all topics with no replies? I want to create something like this:

    $count = ????
    if ( $count != 0 ) {
    echo '<a href=".../no-replies/">Topics with no replies<span class="count">'. $count .'</span></a>';
    }

    Is there a easy way to do this? I will be grateful for help.

    #198025
    Robin W
    Moderator

    ok,try this- same code but different “‘” !!

    // filter to show more than 50 topics on a forum
     function bbp_increase_topic_per_page( $args = array() ) {
     $args['posts_per_page'] = 100 ;
     return $args;
     }
     add_filter( 'bbp_before_has_topics_parse_args', 'bbp_increase_topic_per_page' );
    #198016
    eldaras
    Participant

    Hi !

    Sorry for resurrecting this old post, but I had the same question and I was wondering if the *best* current implementation might be home_url(bbp_get_root_slug()); to link from anywhere in a wordpress multi lingual site.

    I also looked at the implementation of the breadcrumbs, as they include a link to the root of the forum, but it looked like the implementation only worked when the user is inside one of the forum pages (maybe it has a dependency to a global object?).

    Thanks!

    #198004
    Robin W
    Moderator

    without testing, I suspect this will work

    // filter to show more than 50 topics on a forum
     function bbp_increase_topic_per_page( $args = array() ) {
     $args[‘posts_per_page’] = 100 ;
     return $args;
     }
     add_filter( ‘bbp_before_has_topics_parse_args’, ‘bbp_increase_topic_per_page’ );
    #197990

    In reply to: bbPress Moderation

    tapiohuuhaa
    Participant
    Phillip Burger
    Participant

    My request / idea for this topic comes from being involved in WordPress.com and WordPress.org forums. As people in these forum may know, there is a lot of confusion about where to input topics when people need help with WordPress. Because of this confusion, it leads to many Topics (basically support tickets) in the wrong forums.

    An example of this is when people post to the WordPress.com forums for a question about a self-hosted WordPress site. This takes the staff and volunteers working on WordPress.com away from supporting that system and instead causes a need to support this other question and most of the support is educating the difference in .com and .org. Once those replies go the tickets, some people opening the topics are still not sure what to do – and telling them “go to the other forum” might be confusing, and at the least will cause duplicate work.

    So, the idea: a feature in bbPress that allows a forum (in this example, the WordPress.org forum) staff to “pull” a topic from another forum (WordPress.com forum) and get the data setup as a topic in the forum where it makes sense.

    Ideally, this would pull over the threaded history, somehow note the users in the discussion as users of the old forum or the new forum (maybe call user: username[wordpress.org] vs username), and tags as needed…and then allow the discussion to continue on the new forum while noting the move and closing the ticket on the old forum.

    There is a problem that the user opening the topic needs to exist – and the user in WordPress.com may only exist in that system, so one option would be that part of pulling the topic over would do an automated user creation behind the scenes on the “new forum” if a simple search did not find the user to assign the topic to in the new forum.

    I also think that in order to do some kind of migration of topic from the UI side (just past in a URL and basically “scrape” the data) would be nice but for the better administration the data would be pulled with API calls and this could be done by URL and some kind of nonce/code that only a staff members who has high access on both forums would know/generate. They log in to the old forum, go to the Topic they want to copy and click something to enable the copy – this would give them the nonce/code. They go to the new forum and note where they are pulling from URL, the nonce/code and the user they want to assign the topic to in the new forum.

    This is a long winded explanation, but I think similar to other situations where a company or organization could have a legitimate need for multiple forums platforms (instead of just splitting by forum in one site) and a method to essentially “move a topic to the right forum” could have a nice benefit – not to mention the simplification of support for the WordPress community.

    I would love feedback and if this is something useful, it would be great to know what the next steps are to follow through.

    (this is a similar idea to what is in https://bbpress.org/forums/topic/copyduplicate-topic-into-another-forum/ but it seems different so I did not just put a reply there)

    kanonkanonka
    Participant

    I use bbp_topic_favorite_link to display “add to favorite topic button”.

    But this button does not work within the loop below to display the topic list.

    <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
      <article>
        <h2><?php the_title();?></h2>
        <?php bbp_topic_favorite_link( array( 'topic_id' => ''.$post->ID.'', ) ); ?>
      </article>
    <?php endif; endwhile; ?>	

    When I click on the button, “Add to favorites” can be done, but the page will be reloaded.

    Why will it be reloaded in the loop, although it will not be reloaded on the topic page?

    How do I stop reloading?

    #197983
    okhitblog
    Participant

    I’m trying to add the imageshack toolbar to my edit form, and I added it under the “post_content” field in edit-form.php but it’s not showing up anywhere.

    It worked when I just stuck it at the bottom of post-form.php, under the part about “Enter a few words (called tags)”

    I see a second “post_content” field in post-form.php … is this redundant code?

    It seems like this edit form should just be in edit-form.php and therefore changes only need to be made there and called when necessary (add presented as such depending on if it’s a reply/new post/edit/etc…

    Also, when trying to add it to the Reply form (in topic.php) I see a call to post_form();.

    Logic (in my mind) would have it that this function is in the file called post-form.php – which I’ve already added the toolbar too, as well as added it to edit-form.php.

    So where is this post_form(); located? 🙂

    (I”m really not trying to be a pain in the butt!)

    BTW, this is the imageshack toolbar:

    <iframe src=”http://www.imageshack.us/iframe.php?txtcolor=C0C0C0&type=blank&size=30&#8243; scrolling=”no” frameborder=”0″ width=”300″ height=”90″ allowtransparency=”true”> You must have an iframe-compatable browser to view the ImageShack.us upload form.</iframe>

    You can see it in action on https://okhithq.com/ when you create a new post, but no where else.

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