BuddyDev

Search

[Resolved] BuddyPress Simple Front End Post | 'Add Media' button not appearing.

  • Participant
    Level: Initiated
    Posts: 10
    Brendan on #14550

    Hello, I’m looking to figure out why I can’t add media to my posts. I’ve created a form using this method:

    function share_a_story_post() {
        $settings = array(
            'post_type'             => 'community-story',
            //which post type
            'post_author'           =>  bp_loggedin_user_id(),
            //who will be the author of the submitted post
            'post_status'           => 'publish',
            //how the post should be saved, change it to 'publish' if you want to make the post published automatically
            'current_user_can_post' =>  is_user_logged_in(),
            //who can post
            'show_categories'       => true,
            //whether to show categories list or not, make sure to keep it true
            'allowed_categories'    => /* array( 1, 2, 3, 4 ) */ get_all_category_ids(),
            //array of allowed categories which should be shown, use  get_all_category_ids() if you want to allow all categories
    		'allow_upoad' => true,
        );
     
        $form = bp_new_simple_blog_post_form( 'community story post', $settings );
        //create a Form Instance and register it
    }
    

    The editor doesn’t show any media upload button.

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #14573

    Hi Brendan,

    Please add the option

    
    
    allow_upload'=> true,
    
    

    to the above setting.

    Hope that helps.

    EDIT:- I see you already have it, I am looking further.

    Regards
    Brajesh

    • This reply was modified 5 years, 11 months ago by Brajesh Singh. Reason: noted that the setting was already there
  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #14576

    The problem might be related to upload capability.

    The plugin does add the upload and edit_post cap to users(using user_has_cap filter) if it is a BuddyPress page.

    For non BuddyPress age, you may want to filter on

    
    bsfep_enable_upload_filters
    
    

    and return true for your page.

    For example,

    
    
    add_filter( 'bsfep_enable_upload_filters', '__return_true' );
    
    

    Will do it in all cases(I will suggest avoiding that and enabling it specific to your cases).

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 10
    Brendan on #14583

    Awesome. Are you suggesting I add it to the page template that calls the form? or should I add it as part of the form setup function?

    
    function share_a_story_post() {
    }
    
    • This reply was modified 5 years, 11 months ago by Brendan.
  • Participant
    Level: Initiated
    Posts: 10
    Brendan on #14620

    I’m not certain where to add the filter that you’re suggesting.

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #14621

    Hi Brendan,
    sorry about that.

    Here is how it works:-

    WordPress needs the user to have ‘upload_files’ and ‘edit_post’ capability to allow user upload and then attach the uploaded media to post.

    Since this is a common thing, The plugin does it if you are using the form on any of the BuddyPress section.

    If you are not using it from BuddyPress section, we need to manually enable it.

    For now, I will suggest putting it in your theme’s functions.php as we need the capability to be updated for ajax upload too.

    Please give a try and let me know what happens.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 10
    Brendan on #14627

    Adding it to the functions.php seems to work so far.

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #14656

    Thank you for confirming.

The topic ‘ [Resolved] BuddyPress Simple Front End Post | 'Add Media' button not appearing.’ is closed to new replies.

This topic is: resolved