Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 7,876 through 7,900 (of 32,505 total)
  • Author
    Search Results
  • #166642
    jrb9406
    Participant

    Ok, I’ve been working at this all day (really several weeks) and here’s what I learned.

    bbp_add_user_forum_subscription requires user ID which must be obtained by doing

    $user_idd = bbp_get_user_id(0,FALSE,TRUE);

    these will not work:

    $user_idd = bbp_get_user_id()
    $user_idd = bbp_get_user_id(0,TRUE,FALSE)

    (note that I changed the variable from $user_id so as to not double define)

    This works. The working php code is below.

    <?php
    
    if (isset($_POST[‘action’])) {
    $forum = $_POST[‘action’];
    $forumint = 0 + $forum;
    $user_idd = bbp_get_user_id(0,FALSE,TRUE);
    $subs=bbp_is_user_subscribed_to_forum($user_idd, $forum);
    if($subs==false) {
    //if user not subscribed, then subscribe
    $add=bbp_add_user_forum_subscription( $user_idd, $forumint );
    }
    else {
    $rmv=bbp_remove_user_forum_subscription( $user_idd, $forumint );
    }
    exit;
    }
    ?>
    #166635
    jrb9406
    Participant

    sorry, one more edit to hopefully help. With the script below, it does not subscribe or unsubscribe from the forum, but when I execute the code and check my subscriptions page (from profile), the titles of the subscribed forums are removed, but the row for the forum remains (ie. when I click subscribe, my subscriptions page shows titles, when I click unsubscribe, the subscriptions page does not show the title for the forum I tried to unsubscribe to, but it shows the number of topics, posts, etc.).

    <?php
    if (isset($_POST[‘action’])) {
    $forum = $_POST[‘action’];
    $forumint = 0 + $forum;
    $user_id = bbp_get_user_id();
    $subs=bbp_is_user_subscribed_to_forum($user_id, $forum);
    if($subs==false) {
    //if user not subscribed, then subscribe
    $add=bbp_add_user_forum_subscription( $user_id, $forumint );
    $add2=bbp_add_user_subscription( $user_id, $forumint);
    }
    else {
    $rmv=bbp_remove_user_forum_subscription( $user_id, $forumint );
    $rmv=bbp_remove_user_subscription( 0, 79 );
    $rmv2=bbp_remove_user_subscription( $user_id, $forumint);
    }
    echo ‘forum ‘;
    var_dump ($forum);
    echo ‘subscribed ‘;
    var_dump ($subs);
    echo ‘add ‘;
    var_dump ($add);
    echo ‘remove ‘;
    var_dump ($rmv);
    echo ‘foruminteger ‘;
    var_dump ($forumint);
    echo ‘userid ‘;
    var_dump ($user_id);
    exit;
    }
    ?>
    #166633
    jrb9406
    Participant

    I am trying to make a single page where users can choose to subscribe or unsubscribe to their forums (see https://bbpress.org/forums/topic/manage-subscriptions/). I’m pretty new to php/java, so please excuse me if this is obvious.

    Basically, I have 3 forums (79, 80, 81). I have a button for each forum. When the user clicks a button, I use AJAX to run a php script. The php script is used to either subscribe or unsubscribe the user depending on whether they are already subscribed or not.

    My problem is that when a user is subscribed, I’m not able to remove their subscription, and vice versa. When I click a subscribe button, the php code executes, it is able to determine if the user is subscribed, and the if statement executes properly. My problem is that bbp_add_user_subscription and bbp_remove_user_subscription return false every time.

    Any help is greatly appreciated. The PHP and java script are below.

    <?php
    if (isset($_POST[‘action’])) {
    $forum = $_POST[‘action’];
    $forumint = 0 + $forum;
    $subs=bbp_is_user_subscribed_to_forum($user_id,$forum);
    if($subs==false) {
    //if user not subscribed, then subscribe
    $add=bbp_add_user_subscription($user_id,$forumint);
    }
    else {
    $rmv=bbp_remove_user_subscription($user_id,$forumint);
    //do_action(‘bbp_remove_user_subscription’, $user_id, $forumint)
    }
    echo ‘forum ‘;
    var_dump ($forum);
    echo ‘subscribed ‘;
    var_dump ($subs);
    echo ‘add ‘;
    var_dump ($add);
    echo ‘remove ‘;
    var_dump ($rmv);
    echo ‘foruminteger ‘;
    var_dump ($forumint);
    exit;
    }
    ?>
    <?php
    
    <!– initiate all buttons –>
    <button id=”790″ class=”button” onclick=”Subscriber(‘790’)”>Subscribe</button><br><br>
    <button id=”800″ class=”button” onclick=”Subscriber(‘800’)”>Subscribe</button><br><br>
    <button id=”810″ class=”button” onclick=”Subscriber(‘810’)”>Subscribe</button><br><br>
    
    <!– change button text on load based on user subscription –>
    
    <script>
    $( document ).ready(function() {
    $( “.button” ).click(function() {
    var ForumID = $(this).attr(“id”)/10;
    $.ajax({
    //url: ”, // url is empty because I’m working in the same file
    data: {‘action’: ForumID},
    type: ‘post’,
    success: function(result) {
    alert(“action performed successfully”); //this alert is fired
    $(‘div#result’).text(‘Button clicked: ‘ + result);
    }
    });
    });
    });
    </script>
    #166624
    Stephen Edgar
    Keymaster

    Do you have a wp_bb_terms table at all?

    You should have a table setup similar to this:

    (This is my BP 1.6.x database I use for testing bbPress imports, it should be pretty much what I’d expect your setup should also look like)

    #166619
    Stephen Edgar
    Keymaster

    I don’t like the Ning to BuddyPress converter, been there done that, tried to help fix it and all 😉

    I’m pretty sure this relates to which version of bbPress you are using when doing the import, what version of bbPress are you using in BuddyPress 1.6? Is it the “included” bbPress 1.x using just “group forums” or do you have bbPress 2.x installed and activated here as well?

    The Table 'foo.wp_bb_terms' doesn't exist] is a bbPress 1.x table, bbPress 2.x does not have this table.

    #166618
    shanebp
    Participant

    A site has 4 parent forums, each with several child forums.
    I want to filter bbp_has_forums based on the ID of one or more parent forum IDs.
    In this example, I expect the results to only include forums whose parent ID is 886, but all forums are displayed.

    <?php $args = array( 'post__parent_in' => array( 886 ) ); ?>
    <?php if ( bbp_has_forums( $args ) ) : ?>

    Is this possible?
    Am I missing something obvious?

    #166608
    Robkk
    Moderator

    Works when I tested it on my test site.

    Try some troubleshooting to see what could be causing the issue.

    Troubleshooting

    #166606
    Robkk
    Moderator

    Subscriber makes sense for a default WordPress role since WordPress was just for blogs, so the default registrant role would be a subscriber to see your blog posts.

    https://codex.wordpress.org/Roles_and_Capabilities

    Try creating a test user by manually doing so with an additional email you may have in the WordPress Register form. Then see what the forum role is. If it is blank still, make a test forum post to see if it changes.

    You can also try some troubleshooting if something is messing with the forum role being set.

    Troubleshooting

    fictionaddictionnf
    Participant

    I have this same issue when using the eCommerce Product Catalog by impleCode plugin

    #166598
    Robkk
    Moderator

    Oh yeah sorry the slug is “profile” on this site.

    It is easy to find a users profile by clicking the author link on their replies/topics.

    If you need something that could link to your profile, like say in the menu, you can try something like this.

    // Filter wp_nav_menu() to add profile link
    add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' );
    function my_nav_menu_profile_link($menu) {
        if (!is_user_logged_in())
            return $menu;
        else
            $current_user = wp_get_current_user();
            $user=$current_user->user_nicename ;
            $profilelink = '<li><a href="/forums/users/' . $user . '/">Profile</a></li>';
            $menu = $menu . $profilelink;
            return $menu;
     
    }
    #166596
    regeisle
    Participant

    I’m having all sorts of html code show up as part of bbpress email notifications. Worst when the text is pasted in from other webpages or emails, but that’s unavoidable with lots of people using a forum.

    Even random   characters when someone types directly in the editor.

    I’m using wordpress’s built in mce editor with only visual mode available. Latest versions of wp and bb. Are there any solutions to fix this?

    Example:

    Thanks in advance! Rich

    #166593
    Robkk
    Moderator

    This does not have to do with bbPress…but.

    If Drupal was your first CMS read this guide.

    https://codex.wordpress.org/Importing_Content#Drupal

    You may need to hire a developer again if you had more customizations created then just migrating from one CMS to another.

    Contact the WordPress support team for any WordPress specific help..

    Support Forums

    #166590
    Robkk
    Moderator

    Yeah you can insert a shortcode on the forum index page using some hooks that bbPress provides.

    bbp_template_after_forums_loop

    Here is a code snippet that will do what you are looking for though.

    Layout and functionality – Examples you can use

    For the freshness link it should link to whatever was the last activity, with that either being a reply or a topic created. If you want you can filter the forum freshness link to just show topics I guess. The filter is bbp_get_forum_freshness_link

    #166577
    tkse
    Participant

    I’ve been doing some testing tonight, and actually made the realization that the starter theme is not the way to go for me. The first suggestion of yours seem to give me what I’m after just as well, and with a lot less effort on my part in the next stages.

    In response to my other questions though (referencing this: https://bbpress.org/forums/topic/bbp-single-forum-wont-work/#post-166535):

    Surely, there’s got to be a way of displaying both the forum index AND other shortcode elements on the home page of the forum? Since it won’t allow me to do changes in wp-admin if I set a custom page as root, do I have to call the shortcode via PHP in my bbpress.php custom template file?

    Also, I’d love the front page “Latest update” to permalink the latest post, not the topic. Difficult task?

    #166562
    Robkk
    Moderator

    Sorry for the late reply. I hate this issue you have, because I cannot really find a resolution without straight up guessing to try to find something.

    I do see that you have removed it though. But you do not need to remove it with CSS or it will hide the other notices too.

    You can try this PHP function instead.

    add_filter( 'bbp_get_single_forum_description', 'ja_return_blank' );
    add_filter( 'bbp_get_single_topic_description', 'ja_return_blank' );
    function ja_return_blank() {
        return '';
    }

    If you want you can contact me so I can just see what could be causing the issue.

    Contact

    #166559

    In reply to: Problem with my theme

    Robkk
    Moderator

    It is just like customizing a regular WordPress theme.

    Just copy the bbpress.css file into your child theme in a folder called css then edit it to your liking.

    Theme Compatibility

    bbPress Styling Crib

    #166558
    Robkk
    Moderator

    Try any of the steps in the Internal Server Error part.

    https://codex.wordpress.org/Common_WordPress_Errors#Internal_Server_Error

    #166553
    Robkk
    Moderator

    It is weird that when I check the teststudents blog in the dashboard, I can see users listed as Participant as their site role, while it should be Subscriber.

    The WordPress backend menu is all off when I hover over menu items. I do not know what is causing that. Also some bbPress tools in the Tools section, seem to have their own menu items also, which I do not know why.

    There also seems to be forums on some blogs with the same content too??

    This is one for example.

    http://theglobalschool.net/science/tilliemcr/forums/topic/hello-world/

    You can probably find more by visiting the site, and adding /forums at the end of the url.

    If you haven’t already try some troubleshooting to see what is causing all of this.

    Troubleshooting

    #166546
    Robkk
    Moderator

    That is a really old topic that used bbPress v1 standalone, which is entirely different software than what you have now. So I would recommend not using any code from topics about 3 or more years old.

    You may need to install a Find and Replace plugin to remove the tt tags, or just change back to break tags.

    To add mutiple line breaks you may need to read this, maybe install the mentioned plugin, and maybe also active TinyMCE in bbPress using the bbPress Enable TinyMCE plugin.

    http://www.wpbeginner.com/beginners-guide/how-to-add-single-double-line-spacing-in-wordpress/

    #166545

    In reply to: Groups and Forums

    Robkk
    Moderator

    How you want your groups set up may be custom development for now, and you may need to hire a developer for that.

    Possibly the same thing for the topic form for now too, but you can just leave the topic form how it is by default and just scroll to the form.

    I think you may need just a conditional around the topic form so that only a member of the forum can create topics though, but that is if you leave the topic form how it is by default. The other way you want the topic form you may have to use the forum specific topic form shortcode.

    Robkk
    Moderator

    You can use the default registration forms in WordPress instead. The bbPress register shortcode is not really complete in functionality. The login shortcode should work decent enough though.

    #166532
    Robkk
    Moderator

    Does this help any?

    bbp_get_reply_topic_id()

    #166531
    Robkk
    Moderator

    copy loop-topics.php from the bbpress plugin into your child theme in a folder called bbpress and edit these lines.

    <li class="bbp-topic-voice-count"><?php _e( 'Voices', 'bbpress' ); ?></li>
    <li class="bbp-topic-reply-count"><?php bbp_show_lead_topic() ? _e( 'Replies', 'bbpress' ) : _e( 'Posts', 'bbpress' ); ?></li>

    You can change it like so.

    <li class="bbp-topic-voice-count"><?php _e( 'Participants', 'bbpress' ); ?></li>
    <li class="bbp-topic-reply-count"><?php bbp_show_lead_topic() ? _e( 'Comments', 'bbpress' ) : _e( 'Posts', 'bbpress' ); ?></li>

    Theme Compatibility

    #166527
    Robkk
    Moderator

    I took a break yesterday sorry.

    Have you tried some troubleshooting? It may be related to cache, a theme, a plugin conflict, or if you made your forums Hidden.

    Troubleshooting

    #166522
    KeithAdv
    Participant

    I’m going through the odious task of importing a Ning forum to bbPress. The hard part (or so I thought) is done. I was able to get about everything from Ning into BuddyPress.

    However, when I get to the last phase–BuddyPress to bbPress migration–which I thought would be easy-peasy, I lose all the replies to the forum topics! I’m following the migration process exactly (as far as I know) but it always fails. Here are the details:

    I’m currently on a local server using XAMPP.
    WordPress 4.2.4
    BuddyPress 2.3.3 (using the default theme)
    bbPress 2.5.8

    The only other plugins I have installed are The Events Calendar (which you kind of need for the Ning conversion) and BackupBuddy, so that I can restore/reset after every unsuccessful attempt.

    I have a smallish forum of fewer than 100 people and 4 groups.

    At the time of this writing, I’ve restored the site to its last successful state:
    – All data successfully imported into BuddyPress
    – bbPress is installed and activated
    – Final migration has not yet been attempted.

    So, you can see all forums and replies, etc., in the BuddyPress theme on the site. The bbPress forums section in the admin menu is empty, as expected.

    Now my typical next step, which always fails, is to follow the codex on migrating forums from BuddyPress to bbPress. I’ve been following it to the letter:

    Migrating from old forums to bbPress 2.2+

    Unfortunately, during Step 5, the actual import step, I get the following error message:


    WordPress database error: [Table 'foo.wp_bb_terms' doesn't exist]

    SELECT convert(term_relationships.object_id USING "utf8mb4") AS object_id,convert(term_taxonomy.term_taxonomy_id USING "utf8mb4") AS term_taxonomy_id,convert(terms.name USING "utf8mb4") AS name,convert(terms.slug USING "utf8mb4") AS slug FROM wp_bb_term_relationships AS term_relationships INNER JOIN wp_bb_term_taxonomy AS term_taxonomy USING (term_taxonomy_id) INNER JOIN wp_bb_terms AS terms USING (term_id) LIMIT 0, 100

    I can’t tell if it is just complaining or if the import has actually failed at that point. Nevertheless, I finish all the steps. At that point, the groups have become forums in bbPress and the topics have transferred but only the first post in each. All replies are gone and I haven’t found any way to restore them.

    One additional detail–I don’t know if it’s relevant. In order to do the Ning conversion, it’s best if you use BuddyPress v1.6, which I did. Afterward, I updated to the latest version. (Is that why wp_bb_terms didn’t get created?)

    I’d greatly appreciate any insight on this. I’m so happy to be getting away from Ning–I can’t believe I’m getting tripped up on the WP side! 🙂

Viewing 25 results - 7,876 through 7,900 (of 32,505 total)
Skip to toolbar