Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Custom Profile Field Node
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 11 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\ProfileFields;
|
||||
@@ -162,8 +161,12 @@ class _Field extends \IPS\CustomField
|
||||
{
|
||||
foreach ( $fields as $row )
|
||||
{
|
||||
|
||||
if ( ( $row['pf_admin_only'] and $location !== static::STAFF ) or ( $location === static::REG and !$row['pf_show_on_reg'] ) or ( $location === static::PROFILE and !$row['pf_member_edit'] ) or ( $location === static::SEARCH and ( !$row['pf_search_type'] or $row['pf_member_hide'] ) ) )
|
||||
if (
|
||||
( $row['pf_admin_only'] and $location !== static::STAFF ) or
|
||||
( $location === static::PROFILE and !$row['pf_member_edit'] ) or
|
||||
( $location === static::SEARCH and ( !$row['pf_search_type'] or $row['pf_member_hide'] ) ) or
|
||||
( $location === static::REG and !$row['pf_show_on_reg'] )
|
||||
)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -182,7 +185,6 @@ class _Field extends \IPS\CustomField
|
||||
|
||||
if ( $location === static::STAFF )
|
||||
{
|
||||
/* @link https://community.invisionpower.com/4bugtrack/active-reports/required-profile-fields-shouldnt-be-required-for-admins-r8058/ */
|
||||
$row['pf_not_null'] = 0;
|
||||
}
|
||||
|
||||
@@ -263,10 +265,25 @@ class _Field extends \IPS\CustomField
|
||||
public function form( &$form )
|
||||
{
|
||||
parent::form( $form );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\TextArea( 'pf_format', $this->id ? $this->format : '', FALSE, array( 'placeholder' => "<strong>{title}:</strong> {content}" ), NULL, NULL, NULL, 'pf_format' ) );
|
||||
$form->addheader( 'pfield_permissions' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'pf_admin_only', $this->id ? !$this->admin_only : TRUE, FALSE, array( 'togglesOn' => array( 'pf_show_on_reg', 'pf_member_edit', 'pf_member_hide' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'pf_show_on_reg', $this->id ? $this->show_on_reg : TRUE, FALSE, array(), NULL, NULL, NULL, 'pf_show_on_reg' ) );
|
||||
|
||||
if ( \IPS\Settings::i()->quick_register )
|
||||
{
|
||||
/* Quick register is enabled, so do not allow required to be set */
|
||||
if ( isset( $form->elements['']['pf_not_null'] ) )
|
||||
{
|
||||
unset( $form->elements['']['pf_not_null'] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Quick register is off, so show normal 'reg' field */
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'pf_show_on_reg', $this->id ? $this->show_on_reg : TRUE, FALSE, array(), NULL, NULL, NULL, 'pf_show_on_reg' ) );
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'pf_member_edit', $this->id ? $this->member_edit : TRUE, FALSE, array(), NULL, NULL, NULL, 'pf_member_edit' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'pf_member_hide', $this->id ? !$this->member_hide : TRUE, FALSE, array(), NULL, NULL, NULL, 'pf_member_hide' ) );
|
||||
}
|
||||
@@ -288,11 +305,6 @@ class _Field extends \IPS\CustomField
|
||||
{
|
||||
$values['pf_member_hide'] = $values['pf_member_hide'] ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
if( isset( $values['pf_show_on_reg'] ) )
|
||||
{
|
||||
$values['pf_show_on_reg'] = $values['pf_show_on_reg'] ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
if( array_key_exists( 'pf_search_type', $values ) )
|
||||
{
|
||||
@@ -303,7 +315,7 @@ class _Field extends \IPS\CustomField
|
||||
{
|
||||
$values['pf_format'] = '';
|
||||
}
|
||||
|
||||
|
||||
return parent::formatFormValues( $values );
|
||||
}
|
||||
|
||||
@@ -339,6 +351,14 @@ class _Field extends \IPS\CustomField
|
||||
parent::delete();
|
||||
\IPS\Db::i()->dropColumn( 'core_pfields_content', "field_{$this->id}" );
|
||||
unset( \IPS\Data\Store::i()->profileFields );
|
||||
|
||||
if ( isset( static::$multitons[ $this->id ] ) )
|
||||
{
|
||||
unset( static::$multitons[ $this->id ] );
|
||||
}
|
||||
|
||||
/* Do we need to do stuff with profile steps? */
|
||||
\IPS\Member\ProfileStep::resync();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user