Skip to:
Content

BuddyPress.org

Changeset 9940


Ignore:
Timestamp:
06/12/2015 02:44:08 PM (9 years ago)
Author:
johnjamesjacoby
Message:

Groups: bp_is_last_group_creation_step() & bp_is_first_group_creation_step() improvements:

  • Add documentation
  • Update to modern coding standards
  • Add filters, and pass relevant data through them
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-template.php

    r9939 r9940  
    47734773    }
    47744774
     4775/**
     4776 * Is the user looking at the last step in the group creation process
     4777 *
     4778 * @since BuddyPress (1.1.0)
     4779 *
     4780 * @return bool True if yes, False if no
     4781 */
    47754782function bp_is_last_group_creation_step() {
    4776     $bp = buddypress();
    4777 
    4778     $keys      = array_keys( $bp->groups->group_creation_steps );
    4779     $last_step = array_pop( $keys );
    4780 
    4781     if ( $last_step == bp_get_groups_current_create_step() ) {
    4782         return true;
    4783     }
    4784 
    4785     return false;
    4786 }
    4787 
     4783    $bp     = buddypress();
     4784    $steps  = array_keys( $bp->groups->group_creation_steps );
     4785    $step   = array_pop( $steps );
     4786    $retval = ( $step === bp_get_groups_current_create_step() );
     4787
     4788    return (bool) apply_filters( 'bp_is_last_group_creation_step', $retval, $steps, $step );
     4789}
     4790
     4791/**
     4792 * Is the user looking at the first step in the group creation process
     4793 *
     4794 * @since BuddyPress (1.1.0)
     4795 *
     4796 * @return bool True if yes, False if no
     4797 */
    47884798function bp_is_first_group_creation_step() {
    4789     $bp = buddypress();
    4790 
    4791     $keys       = array_keys( $bp->groups->group_creation_steps );
    4792     $first_step = array_shift( $keys );
    4793 
    4794     if ( $first_step == bp_get_groups_current_create_step() ) {
    4795         return true;
    4796     }
    4797 
    4798     return false;
     4799    $bp     = buddypress();
     4800    $steps  = array_keys( $bp->groups->group_creation_steps );
     4801    $step   = array_shift( $steps );
     4802    $retval = ( $step === bp_get_groups_current_create_step() );
     4803
     4804    return (bool) apply_filters( 'bp_is_first_group_creation_step', $retval, $steps, $step );
    47994805}
    48004806
Note: See TracChangeset for help on using the changeset viewer.