Skip to:
Content
Pages
Categories
Search
Top
Bottom

Allow Images (0.9) Plugin – set permissions


  • pastorbobsforum
    Member

    @pastorbobsforum

    Hello.

    How can I allow only certain members (or at least user types) to post images?

    I am using the Allow Images (0.9) plugin on bbpress 1.0.2. The plugin is working fine, is just that I don’t want everyone to post his image, since I cannot afford it.

    Thank you.

    Regards,

    Bob

Viewing 4 replies - 1 through 4 (of 4 total)

  • _ck_
    Participant

    @_ck_

    The images are hosted elsewhere when using the [img] tag so bandwidth doesn’t matter.

    Are you thinking of uploaded attachments which is another plugin entirely?

    Unless maybe you mean you only trust certain users to be able to post images at all because you are afraid of content you don’t want from unknowns. That would be possible.

    If you want the latter, try replacing the plugin with this:

    <?php
    /*
    Plugin Name: Allow Images (moderators only)
    */
    add_filter( 'bb_allowed_tags', 'allow_img_tag' );
    function allow_img_tag( $tags ) {
    if (bb_current_user_can('moderate')) {
    $tags['img'] = array('src' => array(), 'title' => array(), 'alt' => array());
    }
    return $tags;
    }
    ?>

    That will allow moderators or higher to post image tags, everyone else will end up encoded. You could also optionally use the throttle permission which is the checkbox in the user’s profile that allows then to post faster than 30 seconds apart, but use it also as a flag that they can post images (just change moderate to throttle)


    pastorbobsforum
    Member

    @pastorbobsforum

    Hello.

    What I wanted was to allow only certain users to post images. And following your advice, this is what I did.

    function allow_images_allowed_tags( $tags ) {

    if (bb_current_user_can('moderate'))

    {

    $tags = array('src' => array(), 'title' => array(), 'alt' => array());

    }

    return $tags;

    }

    add_filter( 'bb_allowed_tags', 'allow_images_allowed_tags' );

    ?>

    <?php

    Worked just fine.

    Thank you once again.

    Regards,

    Bob


    flamboyant1
    Participant

    @flamboyant1

    very goodd


    comeback1993
    Participant

    @comeback1993

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar