Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/12/2015 07:00:06 PM (10 years ago)
Author:
imath
Message:

Make sure Site admins can set the "register" and "activate" pages in the pages association settings screen even if signups are not allowed

In 2.2, when signups are not allowed, it is not possible to associate a WordPress page to the register or the activate specific components. It introduced some confusion for some site admins and had an impact on plugins allowing users to invite others.

We will keep on working on the best way to deal with these directory pages in the next release. In the meantime, we are bringing back the possibility to always set the association for the register and the activate specific components.

props boonebgorges

See #6176
Fixes #6197 (trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/admin/functions.php

    r9139 r9478  
    121121        buddypress()->active_components = $ac;
    122122    }
     123
     124    /**
     125     * @group bp_core_activation_notice
     126     */
     127    public function test_bp_core_activation_notice_register_activate_pages_notcreated_signup_allowed() {
     128        $bp = buddypress();
     129        $reset_bp_pages = $bp->pages;
     130        $reset_admin_notices = $bp->admin->notices;
     131
     132        // Reset pages
     133        $bp->pages = bp_core_get_directory_pages();
     134
     135        add_filter( 'bp_get_signup_allowed', '__return_true', 999 );
     136
     137        bp_core_activation_notice();
     138
     139        remove_filter( 'bp_get_signup_allowed', '__return_true', 999 );
     140
     141        $missing_pages = array();
     142        foreach( buddypress()->admin->notices as $notice ) {
     143            preg_match_all( '/<strong>(.+?)<\/strong>/', $notice['message'], $missing_pages );
     144        }
     145
     146        $this->assertContains( 'Register', $missing_pages[1] );
     147        $this->assertContains( 'Activate', $missing_pages[1] );
     148
     149        // Reset buddypress() vars
     150        $bp->pages = $reset_bp_pages;
     151        $bp->admin->notices = $reset_admin_notices;
     152    }
     153
     154    /**
     155     * @group bp_core_activation_notice
     156     */
     157    public function test_bp_core_activation_notice_register_activate_pages_created_signup_allowed() {
     158        $bp = buddypress();
     159        $reset_bp_pages = $bp->pages;
     160        $reset_admin_notices = $bp->admin->notices;
     161
     162        add_filter( 'bp_get_signup_allowed', '__return_true', 999 );
     163
     164        $ac = buddypress()->active_components;
     165        bp_core_add_page_mappings( array_keys( $ac ) );
     166
     167        // Reset pages
     168        $bp->pages = bp_core_get_directory_pages();
     169
     170        bp_core_activation_notice();
     171
     172        remove_filter( 'bp_get_signup_allowed', '__return_true', 999 );
     173
     174        $missing_pages = array();
     175        foreach( buddypress()->admin->notices as $notice ) {
     176            preg_match_all( '/<strong>(.+?)<\/strong>/', $notice['message'], $missing_pages );
     177        }
     178
     179        $this->assertNotContains( 'Register', $missing_pages[1] );
     180        $this->assertNotContains( 'Activate', $missing_pages[1] );
     181
     182        // Reset buddypress() vars
     183        $bp->pages = $reset_bp_pages;
     184        $bp->admin->notices = $reset_admin_notices;
     185    }
    123186}
Note: See TracChangeset for help on using the changeset viewer.