WordPress.org

Plugin Directory

Changeset 739334


Ignore:
Timestamp:
07/11/13 18:26:20 (9 months ago)
Author:
tmoorewp
Message:

Publicize: remove the permission check from displaying Page accounts that could be used. Also, default Publicize checkboxes on published posts to unchecked so that there is no accidental Publicizing of said post.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jetpack/trunk/modules/publicize/publicize-jetpack.php

    r723197 r739334  
    1919 
    2020        add_action( 'load-settings_page_sharing', array( $this, 'force_user_connection' ) ); 
     21         
     22        add_filter( 'publicize_checkbox_default', array( $this, 'publicize_checkbox_default' ), 10, 4 ); 
    2123 
    2224        add_action( 'transition_post_status', array( $this, 'save_publicized' ), 10, 3 ); 
     
    336338        check_admin_referer( 'options_page_facebook_' . $_REQUEST['connection'] ); 
    337339 
    338         $me = $options_to_show[0]; 
    339         $pages = $options_to_show[1]['data']; 
     340        $me    = ( ! empty( $options_to_show[0] )         ? $options_to_show[0]         : false ); 
     341        $pages = ( ! empty( $options_to_show[1]['data'] ) ? $options_to_show[1]['data'] : false ); 
    340342 
    341343        $profile_checked = true; 
     
    398400 
    399401                        <?php foreach ( $pages as $i => $page ) : ?> 
    400                             <?php if ( ! isset( $page['perms'] ) ) { continue; } ?> 
    401402                            <?php if ( ! ( $i % 2 ) ) : ?> 
    402403                                <tr> 
     
    637638        } 
    638639    } 
     640     
     641    /**  
     642    * Already-published posts should not be Publicized by default. This filter sets checked to  
     643    * false if a post has already been published.  
     644    */  
     645    function publicize_checkbox_default( $checked, $post_id, $name, $connection ) {  
     646        if ( 'publish' == get_post_status( $post_id ) )  
     647            return false;  
     648 
     649        return $checked;  
     650    } 
    639651} 
Note: See TracChangeset for help on using the changeset viewer.