Skip to:
Content
Pages
Categories
Search
Top
Bottom

Creating New Plugins


  • bp-help
    Participant

    @bphelp

    I usually only give out help but now I need some advice from real BP developers. I don’t intend to sound like I do not appreciate others advice but this is strictly geared more for real BP developers. Anyways on with my question. I have a plugin I submitted to the repository you can examine it here:
    https://github.com/bphelp/private_community_for_bp_lite
    I got a email reply that told me “you should do this” to check if BuddyPress is loaded along with this link:
    http://codex.buddypress.org/developer/plugin-development/checking-buddypress-is-active/

    My issue is I already added that check to the plugins loader.php and I have tested it and it works as expected on my dev server.

    The interesting thing I have noticed is that not only my plugin but @modemlooper ‘s plugins, @imath ‘s plugins, and @sbrajesh ‘s plugins and multiple other revered plugin developers plugins can be installed and activated without any notice given when BP is not even installed. Tested with a plain WP 3.5.2 install with the twenty thirteen theme so what gives? Apparently we all have missed something, or is that email more of an automated email that anyone who tags their plugin with BuddyPress gets? Thanks!

Viewing 8 replies - 26 through 33 (of 33 total)

  • bp-help
    Participant

    @bphelp

    @modemlooper
    I don’t understand what the point of giving a notice is if my plugin has the requirement met.
    Mika E. pretty much said the same thing, but that is not how I want it to work and these people reviewing need to understand that. I want that notice to only display if BP is NOT activated period and it already does. I don’t see other developers getting this much hassle and though your point is well taken it should still not be a requirement until steps are taken to convey this requirement in the codex! Thanks!


    modemlooper
    Moderator

    @modemlooper

    You got rejected and asked why, I explained with code examples and you think It’s not necessary. Why ask for help to only reject the suggestions? Also, this type of response will get you rejected from repo.

    The WordPress community is about sharing knowledge and helping each other better the code whether it’s your plugin or core code. No one singled you out. Everyone gets their olugin reviewed and if something can be better then be thankful the volunteers on the repo suggested something. Your users will thank you for having a plugin that doesn’t break their site.


    bp-help
    Participant

    @bphelp

    @modemlooper
    Actually I didn’t get rejected. They are just swamped at the moment with plugin reviews. I am not rejecting your examples either to the contrary I am actually going to take your advice. My point is that there really needs to be documentation to reflect that there is higher expectations
    in place now in the codex and here:
    https://wordpress.org/plugins/about/
    because I have the requirements that it states. Please do no think I am being negative or unappreciative of you or the other volunteers on the review panel. I just think that everyone developing plugins need to be aware that the bar is being raised a bit so they can follow the advice as you have given before they submit the plugin for review. Thanks!


    modemlooper
    Moderator

    @modemlooper

    Since last year plugin reviews are getting stricter to avoid useless and or badly coded plugins for the benefit of not having to filter through crap when searching the repo.


    bp-help
    Participant

    @bphelp

    @modemlooper
    I can understand that. It is better for everyone. Once I downloaded a plugin that was supposed to let you have conditional profile fields or something to that effect and it did not even work at all so I can appreciate them taking a closer look before blindly allowing a useless plugin on the repository. Anyway I will be making the changes you suggested after I go out and get my lunch. Thanks again for the advice!


    bp-help
    Participant

    @bphelp

    @modemlooper
    This is what I am adding in the loader.php per your advice. I hope it looks good. I have tested it and I get the effect I want so thank you for the advice.

    
    /*** Make sure BuddyPress is loaded ********************************/
    function private_community_for_bp_lite_bp_check() {
        if ( !class_exists( 'BuddyPress' ) ) {
    	add_action( 'admin_notices', 'private_community_for_bp_lite_install_buddypress_notice' );
        }
    }
    
    function private_community_for_bp_lite_install_buddypress_notice() {
    	echo '<div id="message" class="error fade"><p style="line-height: 150%">';
    	_e('<strong>Private Community For BP Lite</strong></a> requires the BuddyPress plugin to work. Please <a href="https://buddypress.org/download">install BuddyPress</a> first, or <a href="plugins.php">deactivate Private Community For BP Lite</a>.');
    	echo '</p></div>';
    }
    
    function private_community_for_bp_lite_init() {
    	require( dirname( __FILE__ ) . '/private-community-for-bp-lite.php' );
    }
    
    add_action('plugins_loaded', 'private_community_for_bp_lite_bp_check', 999);
    add_action( 'bp_include', 'private_community_for_bp_lite_init' );
    

    modemlooper
    Moderator

    @modemlooper

    Looks good. One more suggestion per WP standards. Place all add_actions right below it’s function unless the action is inside a function in that case you place that actions function below the function the add action is inside. It’s to keep the code easier to manage when you have really long file and scrolling up and down gets tedious.

    /*** Make sure BuddyPress is loaded ********************************/
    function private_community_for_bp_lite_bp_check() {
        if ( !class_exists( 'BuddyPress' ) ) {
    	add_action( 'admin_notices', 'private_community_for_bp_lite_install_buddypress_notice' );
        }
    }
    add_action('plugins_loaded', 'private_community_for_bp_lite_bp_check', 999);
    
    function private_community_for_bp_lite_install_buddypress_notice() {
    	echo '<div id="message" class="error fade"><p style="line-height: 150%">';
    	_e('<strong>Private Community For BP Lite</strong></a> requires the BuddyPress plugin to work. Please <a href="https://buddypress.org/download">install BuddyPress</a> first, or <a href="plugins.php">deactivate Private Community For BP Lite</a>.');
    	echo '</p></div>';
    }
    
    function private_community_for_bp_lite_init() {
    	require( dirname( __FILE__ ) . '/private-community-for-bp-lite.php' );
    }
    add_action( 'bp_include', 'private_community_for_bp_lite_init' );

    bp-help
    Participant

    @bphelp

    @modemlooper
    Makes sense to me. I had been doing that but as I have browsed through other plugins code I have noticed a number of them adding the add_actions near the bottom unless like you said they are within a function. I appreciate you letting me know the correct WP standards because it is cleaner and easier than scrolling up and down and searching for its function. I will make that change immediately and thank you again for the advice!

Viewing 8 replies - 26 through 33 (of 33 total)
  • The topic ‘Creating New Plugins’ is closed to new replies.
Skip to toolbar