Need some information about Status plugin.

I would like to avoid links being submitted as images, or general updates. Is there an easy way to have it auto detect that the user inputs a link?

  • Katya Tsihotska

    Hi Estevan

    Hope you had a wonderful day!

    I've just checked on my own install and from what I see if you add image URL it will be automatically recognized as Image, but if you'll add URL to the web-page it will be automatically recognized as a Link.

    Could you please provide us more details, so we'll have a better understanding of your issue? It would be better if you'll describe step by step how we can replicate it.

    Kind regards,
    Katya

  • Estevan

    Katya,

    Thank you for the reply. After initially contacting support, I think this may end up being a custom code problem. But I'll outline what I'm looking to do, and see if it works. Apologies for the long reply. It seems more complex that I think it really is.

    First - What am I trying to do?
    I want to have a front facing status update similar to the one used on LinkedIn (http://prntscr.com/gwk0ai) - so far I've tried WPMUDev Status, WPMUDev Activities + and BuddyBoss Wall to try and see how they all interact.

    I am attempting to create a social sharing site with Buddy Press functionality.

    Ideally, using the built in activity update section, the user could add the following:
    - A simple update "twitter style text and thoughts"

    - A link - All three of the above allow for the link to be pulled in properly. But I love the functionality of the WPMUDev Status plugin where it will attach the posted link to the post type link. Not just a status update.

    This is where the initial question comes in. A user can still post a link in the status box. And it will post as a status. They need to click on the link Icon for it to auto register as a link. I would like to have it auto detect that it's a link and classify as a link, not a status post.

    - A photo - Same thing as above in WPMUDev Status, it allows users to share photos via urls, and then have them posted as a gallery. Ideally, I'd like the users/contributors to be able to upload the media.

    - A Full Blog post - I am using BuddyBoss User Blog for this. I believe all i'll need to do is add a button and link over to the new blog page.

    I would like the input box to be on the home page flanked by two columns (http://prntscr.com/gwk0z0). I am using the Socialize Theme at the moment - but might be changing as I get more familiar with BP.

    The WPMUDev Status plugin is built as a back end tool, not really designed for this purpose. In addition the Activities + plugin works great, but is not available in a short code, or widget to be added outside of the profile or group pages.

    The reason for the mapping to post types, is that I want to be able to include links, and photos shared in the mix of full articles. By keeping them as their own post types, it will allow for their own pages. I.e. if someone wanted to see all photos shared to the site, or all links shared.

    So, the idea was to try and utilize the Status plugin and remove the need for approval on each post. It's still a work in progress.

    Thank you for the time both to read this and reply,

    Estevan

  • Katya Tsihotska

    Hi Estevan

    It sounds like a very interesting idea, but I'm afraid that it's very complex task and it really needs a lot of custom coding. Unfortunately, I'm not able to find any plugin that will be 100% suitable for all your needs. However, I'll ping our SLS team in order if they'll be able to help you remove the need for approval on each post.

    Please keep in mind that our SLS Team deals with more complicated issues, thus it may take a little longer for them to reply here. Thank you for your patience while we look into this further.

    Kind regards,
    Katya

  • Estevan

    Thank you again for the time to reply and think through this with me. I am giving myself a crash course in how the updates function of BP works, and agree with you that it's a bit more difficult than initially thoughts.

    If I find any solutions, I'll let you know, as I assume that this would be a benefit to the community given that LinkedIn has moved to this model of update inputs.

    Have a great day,

    Estevan

  • Ivan

    Hi Estevan !

    Regarding removing the need for approval on each post - You could try adding the following snippet in a mu-plugin

    <?php
    function wpmu_status_change_as_published( $data, $postarr ) {
        $user = wp_get_current_user();
        if ( !empty( $data['post_status'] ) && 'pending' == $data['post_status'] && in_array( 'subscriber', (array) $user->roles ) ) {
            $data['post_status'] = 'publish';
        }
    
        return $data;
    }
    
    add_filter( 'wp_insert_post_data', 'wpmu_status_change_as_published', 10, 2 );

    Note: this code works only for users with subscriber role. If you want to use it for another role - you can change subscriber to guest (for example). If you want to use it for several roles you can replace in_array( 'subscriber', (array) $user->roles ) checking to array_intersect( array( 'subscriber', 'guest', 'another_role' ), (array) $user->roles ) in this snippet.

    Best regards,
    Ivan.

  • Estevan

    Ivan,

    Thank you for the reply apologies for the delay. I have tested the snippet and as far as I can tell, it's working.

    In working through my process of what I am trying to accomplish, I have two questions that I am hopeful you can help answer.

    Q1. I only want the share link option to be available. Is there a way to set it as the default/first option? For simplicity, I used CSS to hide/display none, the other options. But when I try to modify the php (dashboard_widget.php) it breaks the plugin widget.

    Q2. Rather than me selecting the default category, is there a way to display the drop down, so that upon each link submission, it can be selected? (see screen cap for some clarification)

    Thanks,

    Estevan

  • Ash

    Hello Estevan

    #1: You don't need to edit any file, try adding the following css:

    #wdqs-generic-switch, #wdqs-video-switch, #wdqs-image-switch{
    	display: none;
    }

    You can use this css in a plugin called Simple Custom CSS: https://wordpress.org/plugins/simple-custom-css/ Or you can use a child theme: https://premium.wpmudev.org/blog/how-to-create-wordpress-child-theme/

    #2: There is no way out of the box. Let's see if Ivan can come up with any idea.

    Have a nice day!

    Cheers,
    Ash

  • Estevan

    Ash,

    Thanks for the reply. For the first option, I have already modified the CSS and have them set to display: none. However, the code still defaults to the post option. See screen cap. If I were to write in the box and hit enter, it would try and post as an update.

    [image pos="0"] (not letting me upload the png. - http://prntscr.com/h1jk9e)

    I'll give Ivan some time to reply, as I know he's busy.

    Cheers,

    Estevan

  • Ivan

    Hi Estevan !

    Unfortunately, both changes which you want are impossible to add without plugin customization. I attach customized plugin but remember that you will lose these changes after updating the plugin.
    Please, unzip it to {wordpress_folder}/wp-content/plugins/ folder via FTP.

    And also you should add the following snippet in a mu-plugin

    <?php
    function wpmu_status_plugin_change_category( $post_ID, $post, $update ) {
        if ( !$update && !empty( $_POST['action'] ) && 'wdqs_post' ===  $_POST['action'] && !empty( $_POST['wdqs_category'] )) {
    		wp_set_post_categories( $post_ID, array( $_POST['wdqs_category'] ) );
        }
    }
    
    add_action( 'wp_insert_post', 'wpmu_status_plugin_change_category', 10, 3 );

    Best regards,
    Ivan.

    • Estevan

      Ivan,

      As a novice, I'm trying to work my way through this and make updates (like exclude categories etc.)

      I've run into an issue that hopefully is simple, if not please let me know and I'll seek other avenues.

      The Categories are displayed out of order. I.e. parent and child categories are scattered.

      http://prntscr.com/h8wwhv -- where I want the categories to be organized like this: http://prntscr.com/h8wx57

      The wp_dropdown_categories reference provides the right mix, and I've tried modifying what you've shared with various args ('parent' => 0, 'orderby', 'child_of' etc... )

      Any help would be great. With the number of categories, the parent child order is very important to keeping things easy and organized.

      Estevan

  • Estevan

    Ivan,

    I ran into some other plugin conflicts and am working on those before giving the big thumbs up.

    That said, one quick question. This setting shows all categories on the front end. I have a few categories that power the feature sliders that I would like to hide.

    Is there a line that I can add to this scrip to hide certain categories by ID?

    "wp_set_post_categories( $post_ID, array( $_POST['wdqs_category'] ) );"
    I.e.
    -- wp_set_post_categories( $post_ID, array( $_POST['wdqs_category'] )exclude ID(15, 21) );

    Thanks,

    Estevan

  • Ash

    Hello Estevan

    Please try this:

    function wpmu_status_plugin_change_category( $post_ID, $post, $update ) {
        if ( !$update && !empty( $_POST['action'] ) && 'wdqs_post' ===  $_POST['action'] && !empty( $_POST['wdqs_category'] )) {
    		$categories = $_POST['wdqs_category'];
    
    		if( ( $key = array_search( 15, $categories ) ) !== false ) {
    			unset( $categories[$key] );
    		}
    
    		if( ( $key = array_search( 21, $categories ) ) !== false ) {
    			unset( $categories[$key] );
    		}
    
    		wp_set_post_categories( $post_ID, array( $categories ) );
        }
    }
    
    add_action( 'wp_insert_post', 'wpmu_status_plugin_change_category', 10, 3 );

    Hope it helps! Please feel free to ask more questions if you have any.

    Have a nice day!

    Cheers,
    Ash

  • Estevan

    Ash,

    Thank you for the help. It unfortunately didn't work. Given that the section of the plugin that makes this work is outside the base code and will get overwritten should I update, your code helped me think about where the exclude could be placed.

    For reference should this help anyone else. I was able to exclude category id's by adding a small bit of code to the "dashboard_widget.php" file in the lib>forms section of the plugin.

    line 13 updated from:

    $categories = get_categories(array('type'=>'post', 'taxonomy'=>'category', 'hierarchical'=>1, 'hide_empty'=>0,));

    to
    $categories = get_categories(array('type'=>'post', 'taxonomy'=>'category', 'hierarchical'=>1, 'hide_empty'=>0,'exclude'=> array( 21, 22, 23 ),));

    The array IDs now hide those from being displayed within the "status" widget.

    Thanks again for the help. Estevan

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.