We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

In Join page how to change account type select to radio button | Forum

Topic location: Forum home » Support » General Questions
Ash
Ash May 24 '20
Hi All


In the join page, i want to change css of ACCOUNT TYPE drop-down to radio button select, can you pls guide

Problem is people are selecting wrong account type while joining.


Cheers!

Ash

Norias
Norias May 24 '20

hi,


you can use this:


#joinForm select[name="accountType"] {

    color: red;

}


and for the options :


#joinForm select[name="accountType"] option {

    color: green

}

Ash
Ash May 25 '20

Quote from Norias

hi,


you can use this:


#joinForm select[name="accountType"] {

    color: red;

}


and for the options :


#joinForm select[name="accountType"] option {

    color: green

}

Hi This will make the colors changed in drop down, i am sorry if i uses the wrong words.. i want to SHOW all the Account Type & make it SINGLE-SELECT via RADIO-BUTTON not as drop-down select.. i tried looking in join_index.php & html both but i could not, so need help..
Dev Forward
Dev Forward May 25 '20
Go to:


/ow_system_plugins/base/controllers/join.php


On or around line 499.


You will find this code:


    protected function init( array $accounts )

    {

        if ( $this->displayAccountType )

        {

            $joinAccountType = new Selectbox('accountType');

            $joinAccountType->setLabel(OW::getLanguage()->text('base', 'questions_question_account_type_label'));

            $joinAccountType->setRequired();

            $joinAccountType->setOptions($accounts);

            $joinAccountType->setValue($this->accountType);

            $joinAccountType->setHasInvitation(false);

            $this->addElement($joinAccountType);

        }

    }



This is the code you need to change. 


The question type needs to be changed to RadioField, and the invitation needs to be removed or else you'll get an error message. Change it to this:


    protected function init( array $accounts )

    {

        if ( $this->displayAccountType )

        {

            // $joinAccountType = new Selectbox('accountType');

            $joinAccountType = new RadioField('accountType');

            $joinAccountType->setLabel(OW::getLanguage()->text('base', 'questions_question_account_type_label'));

            $joinAccountType->setRequired();

            $joinAccountType->setOptions($accounts);

            $joinAccountType->setValue($this->accountType);

            // $joinAccountType->setHasInvitation(false);

            $this->addElement($joinAccountType);

        }

    }


I do not see how this would cause any problems, BUT - I have not thoroughly tested or checked this code change, so use at your own risk.

The Forum post is edited by Dev Forward May 25 '20
Marcus
Marcus May 25 '20
mind sharing your url. 
Marcus
Marcus May 25 '20
p. s why would need to play aroud with core code no offencr to folks above when all you need to do is edit that section on admin prifile questions area. 
dave Leader
dave May 25 '20

Marcus, I dont believe that the users profile questions allows one to change the account type field type.  If i recall that is not part of the scope.


Dev Forward  appreciate the help.  :)


Norias thanks for sharing that, im bad with level 2 css.   :)


Ash i hope you are writing down all these changes to the core, if oxwall ever does release a new version you are going to either lose all your changes or youll have to do the update manually file by file in order to update. 

The Forum post is edited by dave May 25 '20
Ash
Ash May 25 '20

Quote from Dev Forward Go to:


/ow_system_plugins/base/controllers/join.php


On or around line 499.


You will find this code:


    protected function init( array $accounts )

    {

        if ( $this->displayAccountType )

        {

            $joinAccountType = new Selectbox('accountType');

            $joinAccountType->setLabel(OW::getLanguage()->text('base', 'questions_question_account_type_label'));

            $joinAccountType->setRequired();

            $joinAccountType->setOptions($accounts);

            $joinAccountType->setValue($this->accountType);

            $joinAccountType->setHasInvitation(false);

            $this->addElement($joinAccountType);

        }

    }



This is the code you need to change. 


The question type needs to be changed to RadioField, and the invitation needs to be removed or else you'll get an error message. Change it to this:


    protected function init( array $accounts )

    {

        if ( $this->displayAccountType )

        {

            // $joinAccountType = new Selectbox('accountType');

            $joinAccountType = new RadioField('accountType');

            $joinAccountType->setLabel(OW::getLanguage()->text('base', 'questions_question_account_type_label'));

            $joinAccountType->setRequired();

            $joinAccountType->setOptions($accounts);

            $joinAccountType->setValue($this->accountType);

            // $joinAccountType->setHasInvitation(false);

            $this->addElement($joinAccountType);

        }

    }


I do not see how this would cause any problems, BUT - I have not thoroughly tested or checked this code change, so use at your own risk.



Quote from Dev Forward Go to:


/ow_system_plugins/base/controllers/join.php


On or around line 499.


You will find this code:


    protected function init( array $accounts )

    {

        if ( $this->displayAccountType )

        {

            $joinAccountType = new Selectbox('accountType');

            $joinAccountType->setLabel(OW::getLanguage()->text('base', 'questions_question_account_type_label'));

            $joinAccountType->setRequired();

            $joinAccountType->setOptions($accounts);

            $joinAccountType->setValue($this->accountType);

            $joinAccountType->setHasInvitation(false);

            $this->addElement($joinAccountType);

        }

    }



This is the code you need to change. 


The question type needs to be changed to RadioField, and the invitation needs to be removed or else you'll get an error message. Change it to this:


    protected function init( array $accounts )

    {

        if ( $this->displayAccountType )

        {

            // $joinAccountType = new Selectbox('accountType');

            $joinAccountType = new RadioField('accountType');

            $joinAccountType->setLabel(OW::getLanguage()->text('base', 'questions_question_account_type_label'));

            $joinAccountType->setRequired();

            $joinAccountType->setOptions($accounts);

            $joinAccountType->setValue($this->accountType);

            // $joinAccountType->setHasInvitation(false);

            $this->addElement($joinAccountType);

        }

    }


I do not see how this would cause any problems, BUT - I have not thoroughly tested or checked this code change, so use at your own risk.

wow it worked! Kudos!!! 


A small prob, there are 2 more place this need needs to be changed as well


1)If you signup via google connect then you skip the writing and the select account type drop-down comes (here also will need to show radio-button single select


2)In search user the same function show in selecting account type drop down, even here radio-button should show..


Were will i find the codes, will i need to do the same change activity?


Help will be really appreciated! 


Thanks in advance

Cheers! 

Ash
Ash May 25 '20
Did the same change in user_search.php & its done!


Google connect, i am unable to find the codes..

Norias
Norias May 25 '20
The Selectbox('accountType') code can be found in this files :


oxwall/ow_system_plugins/base/controllers/complete_profile.php:76

oxwall/ow_system_plugins/base/controllers/edit.php:134

oxwall/ow_system_plugins/base/controllers/join.php:489

oxwall/ow_system_plugins/base/controllers/user_search.php:185


I haven't test anything, just made a grep search, but maybe it can help...

The Forum post is edited by Norias May 25 '20
Ash
Ash May 25 '20

Quote from Norias The Selectbox('accountType') code can be found in this files :


oxwall/ow_system_plugins/base/controllers/complete_profile.php:76

oxwall/ow_system_plugins/base/controllers/edit.php:134

oxwall/ow_system_plugins/base/controllers/join.php:489

oxwall/ow_system_plugins/base/controllers/user_search.php:185


I haven't test anything, just made a grep search, but maybe it can help...

Thanks Mate! I will try a hand..
Dev Forward
Dev Forward May 25 '20
I haven't tested it at all, but it looks like what you want is in the first file Norias listed:


oxwall/ow_system_plugins/base/controllers/complete_profile.php


On or around line 76.


        $joinAccountType = new Selectbox('accountType');
        $joinAccountType->setLabel(OW::getLanguage()->text('base', 'questions_question_account_type_label'));
        $joinAccountType->setRequired();
        $joinAccountType->setOptions($accounts);
        $joinAccountType->setHasInvitation(false);



It just needs the same changes as above, I suspect.

The Forum post is edited by Dev Forward May 25 '20
Ash
Ash May 25 '20

Quote from Dev Forward I haven't tested it at all, but it looks like what you want is in the first file Norias listed:


oxwall/ow_system_plugins/base/controllers/complete_profile.php


On or around line 76.


        $joinAccountType = new Selectbox('accountType');
        $joinAccountType->setLabel(OW::getLanguage()->text('base', 'questions_question_account_type_label'));
        $joinAccountType->setRequired();
        $joinAccountType->setOptions($accounts);
        $joinAccountType->setHasInvitation(false);



It just needs the same changes as above, I suspect.

Yes solved! THANKS A TON!
Marcus
Marcus May 25 '20
opppps folks my bad i misread the whole thing.

im pretty sure you can change that with just a bit of js. 
The Forum post is edited by Marcus May 25 '20
Ash
Ash May 25 '20

Quote from Marcus opppps folks my bad i misread the whole thing.
im pretty sure you can change that with just a bit of js. 
You mean to say JS in footer? How? Can u pls show an example please, it would be really helpful~
Marcus
Marcus May 26 '20
pls email me ur url or share it here
Ash
Ash May 26 '20

Quote from Marcus pls email me ur url or share it here
Hi Marcus, send you details via pvt message, pls do check!


Thanks in advance! Cheers!

Marcus
Marcus May 26 '20
thanks ill get back yo u asap
Marcus
Marcus May 26 '20

Here is my solution BUT to make it work properly you gotta bind it to correct page and that requires plugin. But I don't think it will conflict with other forms.


Add this whole thing to ./admin/settings/page Custom tail code




<script>
$( "select" ).addClass( "myClass" );

$( ".myClass" ).wrap( "<div class='myClassWrapp'></div>" );

var count =  $('.myClass option').length;
$('.myClass').attr('size', count)
</script>

<style type="text/css">

.myClass option::before {
  content: "\2610";
  width: 1.3em;
  text-align: center;
  display: inline-block;
}
.myClass option:checked::before {
  content: "\2611";
}


.myClass {
    border: none;
    margin: -5px -17px -5px -5px;
padding: 16px;
font-size:16px;
}

.myClassWrapp {
    margin: 20px;
    overflow: hidden;
    vertical-align: top;
    display: inline-block;

}
</style>


Ash
Ash May 26 '20

Quote from Marcus

Here is my solution BUT to make it work properly you gotta bind it to correct page and that requires plugin. But I don't think it will conflict with other forms.


Add this whole thing to ./admin/settings/page Custom tail code




<script>
$( "select" ).addClass( "myClass" );

$( ".myClass" ).wrap( "<div class='myClassWrapp'></div>" );

var count =  $('.myClass option').length;
$('.myClass').attr('size', count)
</script>

<style type="text/css">

.myClass option::before {
  content: "\2610";
  width: 1.3em;
  text-align: center;
  display: inline-block;
}
.myClass option:checked::before {
  content: "\2611";
}


.myClass {
    border: none;
    margin: -5px -17px -5px -5px;
padding: 16px;
font-size:16px;
}

.myClassWrapp {
    margin: 20px;
    overflow: hidden;
    vertical-align: top;
    display: inline-block;

}
</style>


Thanks Marcus! Taking out time and helping out really matters!!! And this looks awesome.. i will be connecting your soon in pvt, for getting this plugin built.


Cheers!

Ash

Pages: 1 2 »