• Resolved Clivesmith

    (@clivesmith)


    I need to stop users from creating Forums and Topics, I want the forums and topics to stay visible, but I dont want users to be able to create new ones, I only want them to create replies to topics.

    I used to do this with bbp toolkit. Any ideas please

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Robin W

    (@robin-w)

    Can your users create forums?

    and do you want new topics closed in one forum, several forums or all forums?

    Thread Starter Clivesmith

    (@clivesmith)

    Hi Robin,

    I only have guests, I only want them to submit a reply to a topic which I moderate. I do not want them to create forums or topics.

    Thanks

    Clive

    Plugin Author Robin W

    (@robin-w)

    add_filter ('bbp_current_user_can_publish_topics' , 'rew_only_logged_in' ) ;
    
    function rew_only_logged_in ($retval) {
    	if (! is_user_logged_in()) $retval = false ;
    return $retval ;
    }

    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
    https://en-gb.wordpress.org/plugins/code-snippets/

    Plugin Author Robin W

    (@robin-w)

    only keymasters can create forums, so this code just stops anonymous users from creating topics, which should do what you need.

    Thread Starter Clivesmith

    (@clivesmith)

    Hi Robin,

    Thats great, thank you.

    Is it possible to stop the messages, “Oh, Bother! No topics were found here” and “you must be logged in to create new topics”

    Regards

    Clive

    You change the message text, and hide it in the “Forum Index” tab (#15):

    wp-admin/options-general.php?page=bbp-style-pack&tab=forums_index_styling

    Worst case, you could even hide it with just css:

    #bbpress-forums .bbp-template-notice {
      display: none;
    }
    Thread Starter Clivesmith

    (@clivesmith)

    Hi Codejp3,

    Thank you for replying, I had tried to change the text to spaces and tried both hiding and unhiding the #15 as you suggest but it did not work.

    I have just added you code to the css file, it only removes the “Oh, Bother! No topics were found here” message not the “you must be logged in to create new topics”

    I just tested Forum Index #15 on my test site and sure enough, the text will change, but hiding checkbox is broken. I’m working on an update to hand over to @robin-w later today and will include a fix for this. In the meantime, that css code will hold you over, and you can safely delete it once an update rolls out with #15 working again.

    To hide the “you must be logged in” message:

    
    #bbpress-forums .bbp-no-topic .bbp-template-notice {
        display: none;
    }

    That will hide the message, but still display the login form.

    or combine them both into one:

    #bbpress-forums .bbp-template-notice, #bbpress-forums .bbp-no-topic .bbp-template-notice {
        display: none;
    }

    Thread Starter Clivesmith

    (@clivesmith)

    I tried the combine

    #bbpress-forums .bbp-template-notice, #bbpress-forums .bbp-no-topic .bbp-template-notice {     display: none; }

    But that did not work.

    Thread Starter Clivesmith

    (@clivesmith)

    Hi codej3,

    Sorry it is working, I seem to be having a problem with caching.

    Thank you for your help.

    Regards

    Clive

    New update with #15 fix included should be released within the next few days after robin has a chance to go through the update. It’s BIG, so it may take a little while until it’s released officially.

    The update also includes caching enhancements to try to prevent the very issue you experienced (and quite a few others do too). Any time a new file is generated, the version number of that generated file is updated, telling all browsers to load the new file instead of using what it has cached. Should help eliminate the abundance of “it’s not working …oh wait, yeah it is, it was just a caching issue” support topics.

    The update does NOT include a new option to hide the “you must be logged in to create new topics” like you also wanted to do, but I did take note and maybe it’ll be included in the future. The CSS code will hold you over until then.

    Cheers

    Thread Starter Clivesmith

    (@clivesmith)

    HI codejp3,

    Thank you, Thats great.

    I am not sure why I am having the cache issue, I am using Cloudflare, I have purged the cache several times but my PC still sees the messages, I have tried different browsers and kept refreshing the page. My wifes Ipad does not show the messages. Hopefully it will sort itself out.

    Thanks for all your help

    Regards

    Clive

    If one device is not including the custom CSS, but another device is, then it’s a device-specific browser cache issue. A way to try to get around that is to hold the “shift” key when you click the refresh button, which tells the browser to do a “hard refresh” reloading files instead of using its’ local cache.

    My caching fix in the upcoming update should take care of that. It’ll bust local WP cache, bust the Cloudflare cache, and tell browsers to re-cache the files any time you change settings/regenerate the style files within Style Pack.

    Thread Starter Clivesmith

    (@clivesmith)

    Yes, the “shift” key works I will try to remember that, when you say bust the cloudflare cache, I hope you dont mean permanantly.

    Nope. It will only bust the local WP cache & Cloudflare cache when you actually make a change within Style Pack that causes your CSS/JS files to be re-generated. Otherwise, whatever is currently cached by either is what gets served to end user browsers.

    Furthermore, the changes I added, don’t clear the cache site-wide. They only affect Style Pack generated files, so even when the cache is busted, it should have minimal impact on lost performance.

    It’s necessary in order to make sure you’re serving the latest/greatest to end users, but done so in a manner that it only happens when actually needed, and only for the specific CSS/JS files it’s needed for.

    Ideally, you’ll never have to manually mess with WP cache or Cloudflare cache for reasons related to Style Pack. It’ll be automated based directly on the changes you make within the plugin.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Close forums and topics ?’ is closed to new replies.