snipt

Ctrl+h for KB shortcuts

PHP

"if user does not have an avatar"

<?php global $bp; if(bp_core_fetch_avatar( array( 'item_id' => $bp->loggedin_user->id, 'no_grav' => true, 'html'=> false ) ) != bp_core_avatar_default()) {} ?>
https://snipt.net/embed/af34fde97a9831faab21c9da12be8494/
/raw/af34fde97a9831faab21c9da12be8494/
af34fde97a9831faab21c9da12be8494
php
PHP
1
2019-07-15T07:06:57
True
False
False
/api/public/snipt/53920/
if-user-does-not-have-an-avatar
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?php</span> <span class="k">global</span> <span class="nv">$bp</span><span class="p">;</span> <span class="k">if</span><span class="p">(</span><span class="nx">bp_core_fetch_avatar</span><span class="p">(</span> <span class="k">array</span><span class="p">(</span> <span class="s1">&#39;item_id&#39;</span> <span class="o">=&gt;</span> <span class="nv">$bp</span><span class="o">-&gt;</span><span class="na">loggedin_user</span><span class="o">-&gt;</span><span class="na">id</span><span class="p">,</span> <span class="s1">&#39;no_grav&#39;</span> <span class="o">=&gt;</span> <span class="k">true</span><span class="p">,</span> <span class="s1">&#39;html&#39;</span><span class="o">=&gt;</span> <span class="k">false</span> <span class="p">)</span> <span class="p">)</span> <span class="o">!=</span> <span class="nx">bp_core_avatar_default</span><span class="p">())</span> <span class="p">{}</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
buddypress

PHP

Remove Buddypress top admin bar

1
2
3
4
5
<?php
// to add in the theme's function.php file (create it if not existing)
remove_action('wp_footer', 'bp_core_admin_bar', 8);
remove_action('admin_footer', 'bp_core_admin_bar', 8);
?>
https://snipt.net/embed/189ea398ada4e6bdb4f2b4ad05c1d69c/
/raw/189ea398ada4e6bdb4f2b4ad05c1d69c/
189ea398ada4e6bdb4f2b4ad05c1d69c
php
PHP
5
2019-06-30T19:08:59
True
False
False
/api/public/snipt/20727/
remove-buddypress-top-admin-bar
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a><span class="c1">// to add in the theme&#39;s function.php file (create it if not existing)</span> </span><span id="L-3"><a name="L-3"></a><span class="nx">remove_action</span><span class="p">(</span><span class="s1">&#39;wp_footer&#39;</span><span class="p">,</span> <span class="s1">&#39;bp_core_admin_bar&#39;</span><span class="p">,</span> <span class="mi">8</span><span class="p">);</span> </span><span id="L-4"><a name="L-4"></a><span class="nx">remove_action</span><span class="p">(</span><span class="s1">&#39;admin_footer&#39;</span><span class="p">,</span> <span class="s1">&#39;bp_core_admin_bar&#39;</span><span class="p">,</span> <span class="mi">8</span><span class="p">);</span> </span><span id="L-5"><a name="L-5"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
buddypress, hack, php, wordpress