<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Spoilers Only Show for Certain Member ratings. - wpForo Integration				            </title>
            <link>https://wpforo.com/community/wpforo-integration/spoilers-only-show-for-certain-member-ratings/</link>
            <description>Discussion Board</description>
            <language>en-US</language>
            <lastBuildDate>Sat, 11 Jul 2026 17:20:25 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: Spoilers Only Show for Certain Member ratings.</title>
                        <link>https://wpforo.com/community/wpforo-integration/spoilers-only-show-for-certain-member-ratings/#post-128963</link>
                        <pubDate>Tue, 09 Dec 2025 21:11:52 +0000</pubDate>
                        <description><![CDATA[thanks]]></description>
                        <content:encoded><![CDATA[<p>thanks</p>]]></content:encoded>
						                            <category domain="https://wpforo.com/community/wpforo-integration/">wpForo Integration</category>                        <dc:creator>kezeo</dc:creator>
                        <guid isPermaLink="true">https://wpforo.com/community/wpforo-integration/spoilers-only-show-for-certain-member-ratings/#post-128963</guid>
                    </item>
				                    <item>
                        <title>Spoilers Only Show for Certain Member ratings.</title>
                        <link>https://wpforo.com/community/wpforo-integration/spoilers-only-show-for-certain-member-ratings/#post-126656</link>
                        <pubDate>Tue, 02 Sep 2025 23:48:08 +0000</pubDate>
                        <description><![CDATA[Hey everyone,
I’ve been using wpForo for a while now, and one thing I always wished it had was the ability to hide spoilers unless members are actually participating in the forum. So, I dec...]]></description>
                        <content:encoded><![CDATA[<p data-start="158" data-end="173">Hey everyone,</p>
<p data-start="175" data-end="419">I’ve been using <strong data-start="191" data-end="201">wpForo</strong> for a while now, and one thing I always wished it had was the ability to hide spoilers unless members are actually participating in the forum. So, I decided to crack open the ol’ PHP book and put something together.</p>
<p data-start="421" data-end="522">It works perfectly for my needs, but you can easily tweak it to fit yours. Here’s how to set it up:</p>
<h3 data-start="524" data-end="557">Step 1: Install Code Snippets</h3>
<ul data-start="558" data-end="757">
<li data-start="558" data-end="612">
<p data-start="560" data-end="612">Install and activate the plugin <strong data-start="592" data-end="609">Code Snippets</strong>.</p>
</li>
<li data-start="613" data-end="675">
<p data-start="615" data-end="675">In your WordPress dashboard, go to <strong data-start="650" data-end="672">Snippets → Add New</strong>.</p>
</li>
<li data-start="676" data-end="757">
<p data-start="678" data-end="757">Give it a name you’ll remember (I called mine <em data-start="724" data-end="753">WPForo Members Only Spoiler</em>).</p>
</li>
</ul>
<h3 data-start="759" data-end="783">Step 2: Add the Code</h3>
<p data-start="784" data-end="814">Paste in the following code:</p>
<p>&nbsp;</p>
<pre contenteditable="false">function magicianleaks_restrict_spoiler_by_rating($content) {
    if ( is_admin() || !function_exists('WPF') ) {
        return $content;
    }

    // --- Configuration ---
    $required_rating = 6;
    // ---------------------

    $member_rating = 0;

    if ( is_user_logged_in() ) {
        $member = WPF()-&gt;member-&gt;get_member(get_current_user_id());
        if ( isset($member) ) {
            $member_rating = intval($member);
        }
    }

 
    if ( $member_rating &lt; $required_rating ) {
        $restriction_html = '&lt;div class="wpf-spoiler-wrap"&gt;
                                &lt;div class="wpf-spoiler-head wpf-spoiler-restricted"&gt;Spoiler (Restricted)&lt;/div&gt;
                                &lt;div class="wpf-spoiler-body"&gt;
                                    You must have a member rating of ' . esc_html($required_rating) . ' or higher to view this content.
                                &lt;/div&gt;
                            &lt;/div&gt;';

  
        $pattern = '/&lt;div class="wpf-spoiler-wrap"&gt;.*?&lt;div class="wpf-spoiler-head"&gt;.*?&lt;\/div&gt;.*?&lt;div class="wpf-spoiler-body"&gt;.*?&lt;\/div&gt;\s*&lt;\/div&gt;/s';
        
        $content = preg_replace($pattern, $restriction_html, $content);
    }

    return $content;
}

add_filter('wpforo_content_after', 'magicianleaks_restrict_spoiler_by_rating', 99);
</pre>
<p>&nbsp;</p>
<h3 data-start="2150" data-end="2173">Step 3: Save &amp; Test</h3>
<ul data-start="2174" data-end="2235">
<li data-start="2174" data-end="2208">
<p data-start="2176" data-end="2208">Save and activate the snippet.</p>
</li>
<li data-start="2209" data-end="2235">
<p data-start="2211" data-end="2235">Clear your site cache.</p>
</li>
</ul>
<p data-start="2237" data-end="2403">That’s it! Spoilers will now only be visible to members who meet your required rating level (default is <strong data-start="2344" data-end="2349">6</strong>, but you can change it to whatever level you want).</p>
<p>&nbsp;</p>
<div id="wpfa-0" class="wpforo-attached-file"><a class="wpforo-default-attachment" href="//wpforo.com/wp-content/uploads/wpforo/default_attachments/1756856888-2025-09-02_19-45-55.png" target="_blank" title="2025-09-02_19-45-55.png"><i class="fas fa-paperclip"></i>&nbsp;2025-09-02_19-45-55.png</a></div>]]></content:encoded>
						                            <category domain="https://wpforo.com/community/wpforo-integration/">wpForo Integration</category>                        <dc:creator>MagicianLeaks</dc:creator>
                        <guid isPermaLink="true">https://wpforo.com/community/wpforo-integration/spoilers-only-show-for-certain-member-ratings/#post-126656</guid>
                    </item>
							        </channel>
        </rss>
		